The begin/ end is suppose to be a part of the handler;

Perhaps you mean;

DECLARE CONTINUE HANDLER FOR SQLSTATE '38501' BEGIN;
CALL QSYS2.QCMDEXC('RMVLIBLE LIB(myLib)');
END;

CALL QSYS2.QCMDEXC('ADDLIBLE LIB(myLib) POSITION(*LAST)');


Or do you men to scope it - handlers can be made local to a scope :

BEGIN;
DECLARE CONTINUE HANDLER FOR SQLSTATE '38501' BEGIN;
CALL QSYS2.QCMDEXC('RMVLIBLE LIB(myLib)');
END;

CALL QSYS2.QCMDEXC('ADDLIBLE LIB(myLib) POSITION(*LAST)');
END;




On Wed, Aug 24, 2022 at 2:31 PM Jay Vaughn <jeffersonvaughn@xxxxxxxxx>
wrote:

In an sql trigger, I'm trying to implement the ability to add a library
list entry...

I have the below code...

On the first invocation everything works fine and myLIB gets added to the
libl.
But on the second invocation, it still fails with SQLSTATE '38501' because
myLib is in the library list...

I would think when SQLSTATE 38501 is detected it would not fail but
CONTINUE with what is in the BEGIN/END... no? What am I missing?

BEGIN DECLARE CONTINUE HANDLER FOR SQLSTATE '38501'
CALL QSYS2.QCMDEXC('RMVLIBLE LIB(myLib)');
END;
CALL QSYS2.QCMDEXC('ADDLIBLE LIB(myLib) POSITION(*LAST)');


tia
Jay
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/midrange-l.

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related
questions.

Help support midrange.com by shopping at amazon.com with our affiliate
link: https://amazon.midrange.com


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.