Monday, June 20, 2011

TriggerInOracle

Triggers in oracle




1)First u need to login to oracle.Then you need to sign in through your username
and password.
2)Second step is to create a sequence.
3)Then you can create a Trigger

Example :
create sequence seqsup1 start with 1 increment by 1;
create or replace trigger sup1 before insert on supplier for each row
declare
c supplier.sid%type;

begin
select seqsup1.nextval into c from dual;
if c>1 then
c:=c+1;
:new.Sid:='SUP00'||c;
else
:new.Sid:='SUP00'||c;
end if;
end;
.
/

For further errros and doubts u can mail me here harshdamania123@gmail.com



No comments:

Post a Comment