Quote:
quote:Originally posted by Blueman137
Hi All
I try to use this trigger for inserting RecordID in Shoppingcart Table.
DECLARE
NEXTID NUMBER(3);
BEGIN
SELECT MAX(RECORDID) INTO NEXTID FROM SHOPPINGCART;
:NEW.RECORDID := LTRIM(NEXTID+1);
END;
************************************************** *
It is an empty table now. By inserting the other fields and leaves the RecordID for triggering. The Oracle shows this error
ORA-01400; can not insert null into (âSCOTTâ.âSHOPPINGCARTâ.âRECORDIDâ)
************************************************** *
How could I solve this error?
Thanks in advance
Blueman137
|
try as : ":NEW.RECORDID := LTRIM(NVL(NEXTID,0)+1);"
But best to use sequence for this scope.
;)