Hi,
I don't think you can monitor for it IN the statement itself. You do, however have several options :-
You could specify a higher severity level on the RUNSQLSTM.
You could monitor for the failure in the program that executes the RUNSQLSTM command.
You could check for the existence of the table before you execute the RUNSQLSTM.
Regards,
Martin Gilbert.
Last Wiki Answer Submitted: July 2, 2008 10:16 am by Gilly40023,625 pts.
If you live outside the United States, by submitting your email address you consent to having your personal data transferred to and processed in the United States.
rather than running a drop statement, call a stored procedure which does the drop. Inside the stored procedure check table exists before it drops it. If you have table to be dropped as a parameter passed into procedure you can re-use the procedure to drop other tables if needed in future.
I’m newbie enough that I can’t use either of those tips without some deep study and invention.
Numerous examples are in the Programming: SQL topic of the Information Center.
It’s difficult to give useful examples — a normal assumption would be that someone hired as a developer should already know SQL.
Giving SQL examples without including the fundamentals can be risky. It’s impossible to know how long an answer should be. Technically, the answer ought to be as long as a reference manual.
But perhaps you’re not a developer. You might be a user trying to get a task done without benefit of a development staff. Then how much should an answer about DROP TABLE include?
Or perhaps you are experienced in what Microsoft refers to as “SQL”? If so, then pointing you to the reference manuals and the Information Center is the answer that you need for now.
RUNSQLSTM SRCFILE(&SRCLIB/&SRCFILE) SRCMBR(&SRCMEM)
COMMIT(&COMMIT) ERRLVL(21)
The ERRLVL(21) will cause it to ignore the DROP error.
rather than running a drop statement, call a stored procedure which does the drop. Inside the stored procedure check table exists before it drops it. If you have table to be dropped as a parameter passed into procedure you can re-use the procedure to drop other tables if needed in future.
Can you give a code example? I’m newbie enough that I can’t use either of those tips without some deep study and invention. Thanks.
I’m newbie enough that I can’t use either of those tips without some deep study and invention.
Numerous examples are in the Programming: SQL topic of the Information Center.
It’s difficult to give useful examples — a normal assumption would be that someone hired as a developer should already know SQL.
Giving SQL examples without including the fundamentals can be risky. It’s impossible to know how long an answer should be. Technically, the answer ought to be as long as a reference manual.
But perhaps you’re not a developer. You might be a user trying to get a task done without benefit of a development staff. Then how much should an answer about DROP TABLE include?
Or perhaps you are experienced in what Microsoft refers to as “SQL”? If so, then pointing you to the reference manuals and the Information Center is the answer that you need for now.
Tom