You are browsing the archive for script.

Creating DB2 Stored Procedure from the command line

October 2, 2012 in Database

In order to create a DB2 stored procedures from the command line, all what you need to do is:
1. Place "@" at the end of your "CREATE PROCEDURE" script as follows:

CREATE PROCEDURE myScheme.myProcedure
IN someParameter BIGINT
-- Some SQL statements


2. Let’s assume that the script file name which contains the stored procedure sql is "someScript.sql", In order to execute the DB2 stored procedure creation script, run the following command from the command line:

db2 -td@ -svf someScript.sql

After running the command, you should see the success message as follows:

"DB20000I  The SQL command completed successfully.
Skip to toolbar