i want to modify my current table which is currently generating id's using a trigger from 1 using sequence_name.nextval to something like DON-100 or REC-124 etc.I have seen some examples doing this using functions which modify the values after the trigger performs it's job which looks like overhead how can i modify my current trigger to produce these custom id's and is not too complex.
CREATE TABLE Atendant (
ID NUMBER(10) PRIMARY KEY,
NAME VARCHAR2(25 CHAR) NOT NULL
);
CREATE SEQUENCE Atendant_SEQ NOCACHE;
CREATE or replace TRIGGER Atendant_BI
BEFORE INSERT ON Atendant
FOR EACH ROW
DECLARE
BEGIN
IF :NEW.ID IS NULL THEN
:new.id := "ATN"Atendant_SEQ.nextval;
END IF;
END;
ID
to be aVARCHAR
then?