Click here to Skip to main content
15,911,142 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear Friends,

create or replace PROCEDURE "SP_INSERTG"
(
ID_ NUMBER,
NAME_ nvarchar2,
CDATE_ timestamp,
MDATE_ timestamp,
output out NUMBER
)
AS
BEGIN -- sub-block begins
--SAVEPOINT start_transaction; -- mark a savepoint
Insert into tbl_G (GID,NAME,DDATE,DSTATE,MODIFIEDDATE) values(ID_,NAME_,CDATE_,'0',MDATE_);
IF( SQL%ROWCOUNT >= 1 )-- its Return 0 or 1
THEN
output := 1; --Output 1
ELSE
output := 0;-- Output 0
END IF;
NULL;

END SP_INSERTG;

This is My StoredProcedure in Oracle iam new to Oracle in this Sp i want to handle the Exceptions and Roll back the Transcation.If any body having idea please share with me.


Regards,

AnilKumar.D
Posted
Updated 3-Sep-13 3:24am
v2

1 solution

add following block before END SP_INSERTG;
SQL
COMMIT;
EXCEPTION
WHEN OTHERS THEN ROLLBACK TO start_transaction;

Refer to http://docs.oracle.com/cd/E11882_01/appdev.112/e17126/errors.htm#i3336[^] for further reference.

Regards,
Niral Soni
 
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