Click here to Skip to main content
15,888,802 members
Please Sign up or sign in to vote.
1.29/5 (6 votes)
See more:
Can any one tell me what is the use of trigger and cursor in sql with example
Posted

Ask Google[^]
About 70,10,000 results in(0.20 seconds).

Here are some very good articles on Trigger.
Check this:
Triggers -- SQL Server[^]
http://www.sqlteam.com/article/an-introduction-to-triggers-part-i[^]
http://msdn.microsoft.com/en-us/library/ms189799.aspx[^]

Before posting another question ask Google[^] first and please read
Code Project Quick Answers FAQ[^]
 
Share this answer
 
trigger fires when insert,Update ,delete statemet execute


eg:

if we have table name : t1
if we calculate the sum and updated in another table t2 when insert into t1 occurs,


eg:


CSS
CREATE OR REPLACE TRIGGER tr1
BEFORE
insert on sampletable
for each row
begin
SELECT sampletable2.id.nextval INTO :NEW.R_ID  FROM dual;
end;



cursor:

What is Cursor in sql server[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900