Tuesday, 5 March 2013

Use The Referencing Clause

If we want we can use the referencing clause to specify a different name [similar to alias name] for :old and :new correlation names.  This is the syntax:
referencing [old as old_name] [new as new_name]
Example:
Create or replace triggergenerateprofID
before insert on professor
referencing new as new_prof
for each row
begin
if :new_prof.pid is null then
select profids.nextval into :new_prof.pid from dual;
end if;
end triggergenerateprofID;

No comments:

Post a Comment