Unanswered: What is in DB2 what Transac SQL is in SQL Server
We currently have DB2 scripts that execute from a DB2 command line (DB2 -vtf <jobname.db2>) and in which all statements (UPDATEs, DELETEs, INSERTs, CREATEs, etc.) execute one after another without caring whether the previous one completed successfully or failed.
We want do be able to direct the execution a little bit more and I have read on IBM's website about IF's, FOR's, REPEAT's, WHILE's, throwing and catching exceptions, etc. How exactly do these work? What do I need to create in order to execute such scripts? Is it stored procedures or is there something else like SQL Server's Transac SQL? Keep in mind we may want to connect to more than one database as we do with our current scripts (exporting data from database 1 to a file and then loading into database 2).
Thank you all in advance!
Last edited by Razor1973; 07-30-04 at 15:47.
Reason: Subject was wrong
1. the various commands are control statements and they are used in the sp and triggers.the sp runs under the connectivity of the client.
2. You can use type 2 connections and move back and forth among them.
3. You can write scripts that connect to db and did some work , reset the
connection and connected to another db and so on.
4. you can use the s options like db2 -stvf to stop on error.
Are we talking a Java or SQL stored procedure?
Also, as far as stopping on error, we don't necessarily want to do that, but say, we want to skip certain statements if there is an exception, but still execute others or something of the sort. We don't want exiting the procedure to be the only way to handle exceptions. For example:
<statement to update rows> is unsuccessful
<statement to insert rows>
<statement to update rows>