All Forums Database
18 Nov 2013
Start from specific sql in Stored Procedure

Is it possible to start execution of a Stored Procedure from a specific location?
My SP has a series of sqls with STEP_ID assigned. I need to pass a STEP_ID value and excute only from that STEP_ID till end. Note: STEP_ID values may not be sequential
Eg:

Replace Procedure ABC (
    IN STEP_ID  INTEGER
)

BEGIN

SET STEP_ID = 51;

INSERT INTO ....

SET STEP_ID = 53;

UPDATE ....

 

ulrich 816 posts Joined 09/09
18 Nov 2013

check the manuals 
you have
if then else and
case construct to achive what you want.
Ulrich

feel free to donate bitcoin:12kgAUHFUqvG2sQgaRBXFhCwyf9HXdkGud

Kawish_Siddiqui 37 posts Joined 03/07
18 Nov 2013

Following might help you

Replace Procedure ABC (IN STEP_ID  INTEGER)
Declare  RESUME_NEXT Varchar(10)
BEGIN
SET RESUME_NEXT = 'false';
IF (RESUME_NEXT = 'true' OR STEP_ID = 51) THEN
	INSERT INTO ....
	SET RESUME_NEXT = 'true';
END IF; 

IF (RESUME_NEXT = 'true' OR STEP_ID = 53) THEN
	UPDATE ....
	SET RESUME_NEXT = 'true';
END IF; 

 

PS: Please bear with syntax.

Kawish Siddiqui -

You must sign in to leave a comment.