1
In certain routine I have a Trigger that runs a code similar to the one below.
I’m having trouble in the first record, as in the first record does not have any code, the sum of + 1
is not being held, and I can’t do the Insert.
Have some way to play a default value, or some Oracle feature that bypasses when entering the first record?
INSERT INTO TABELA1 (
CODIGO
,CAMPO2
,CAMPO3)
VALUES
(
(select max(CODIGO)+1 from TABELA1)
,VALOR2,
VALOR3)
);
thanks to all, the nvl solved my problem, after that I decided to use the creation of sequence, and also worked well.
– Juliano