RhythmAddict112
Programmer
Hi all...I have a stored procedure that does an insert, grabs the ID value and then updates another table with that ID. This works fine...My problem is I need to output the ID value as well and Im not sure of the syntax/way to go about this because frankly my pl/sql are lacking....I'd greatly appreciate if someone could point me ni the right direction of this...my stored procedure is below....basically, i want to output my nID variable...
thank you in advance!
Code:
CREATE OR REPLACE PACKAGE NewBatch
AS
PROCEDURE NewBatch
(
Dt IN VARCHAR2,
glbRegion IN VARCHAR2,
glbUser IN VARCHAR2,
cBillSys IN VARCHAR2,
strPromoCodes IN VARCHAR2,
BatchID IN VARCHAR2
New
);
END;
/
CREATE OR REPLACE PACKAGE BODY NewBatch
AS
PROCEDURE NewBatch
(
Dt IN VARCHAR2,
glbRegion IN VARCHAR2,
glbUser IN VARCHAR2,
cBillSys IN VARCHAR2,
strPromoCodes IN VARCHAR2,
BatchID IN VARCHAR2
)
IS
nID tbl_OWR_Batch.id%type;
BEGIN
Insert INTO tbl_OWR_Batch (dCreated, cRegion, cCreatorID, cBillSys, cComment) Values (Dt,glbRegion,glbUser,cBillSys,
strPromoCodes) returning ID into nID;
Update tbl_OpenWindowRequests SET iBatch = nID WHERE ID IN BatchID AND cBillSys = cBillSys;
END;
END;
/