We have a VB6 application that uses SQL Server and Oracle and we are extending to DB2/400. In Oracle, we can post multiple statements as follows:
update table1 where col1 = 1;
update table2 where col3 = 6;
By passing the whole script as a SQL string through ODBC rather than make discrete, separate passes. When attempting this same code to AS/400 (v4r5) it errors. Can this process be accomplished in AS/400 SQL? If so, how?
This can be accomplished by moving the code to an SQL Stored procedure and executed on ODBC Call statement instead. This provide the same performance benefits.
Create Procedure Proc1() Language SQL Begin update table1 where col1 = 1; update table2 where col3 = 6; . . End;
MORE INFORMATION ON THIS TOPIC
Search400.com's targeted search engine: Get relevant information on DB2/400.
The Best Web Links: tips, tutorials and more.
Check out this online event, Getting the Most out of SQL & DB2 UDB for the iSeries.
Dig Deeper on DB2 UDB (universal databases)
Related Q&A from Kent Milligan
To solve the SQL error -321 on IBM i6.1, use the new values statement to overcome the error. If you are using an older release, declare a cursor ... Continue Reading
When working with DB2 files with columns that have both short and long names, there is no option choose which column names are returned via ODBC ... Continue Reading
When developing tables in a parent-child relationship, use a primary key and a foreign key along with a unique ID to make your database easier to ... Continue Reading
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.