Scunningham99
Programmer
Howdy
Quick Q:
I want PK to be populated when a new record is entered using a sequence, but im stuck as to which trigger to use. I have tried using when-new-record-instance which is not good as everytime i go to new block it increments the counter. This is not good as i only wish it to increment when i wish to insert a new record.
I have tried pre-insert and on-insert which also do not work as they error as the PK field (custno) is null when i try and save.
Heres the code in the trigger:-
select customers_custno.nextval
into :CUSTNO --select nextval from sequence into field
from dual;
Im sure this is something simple, but im having a bad day!
any help would be greatly appreciated!
Sy UK
Quick Q:
I want PK to be populated when a new record is entered using a sequence, but im stuck as to which trigger to use. I have tried using when-new-record-instance which is not good as everytime i go to new block it increments the counter. This is not good as i only wish it to increment when i wish to insert a new record.
I have tried pre-insert and on-insert which also do not work as they error as the PK field (custno) is null when i try and save.
Heres the code in the trigger:-
select customers_custno.nextval
into :CUSTNO --select nextval from sequence into field
from dual;
Im sure this is something simple, but im having a bad day!
any help would be greatly appreciated!
Sy UK