Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can we View the DB2 Procedure and How can we execute the DB2 Procedure and just see the output of the procedure using DB2

Tags:

db2

db2-400

How can we View the DB2 Procedure (I mean what logic they have written ) and How can we execute the DB2 Procedure and just see the output of the procedure using DB2

like image 943
Someone Avatar asked Aug 04 '10 00:08

Someone


People also ask

How do I view a stored procedure in mainframe?

In the left pane of the screen that is displayed, select the Data Source Explorer tab and expand the Database Connections group. Select the appropriate database to expand its objects tree. Select Schemas, Stored Procedures and right click on the desired stored procedure.

How do I run a stored procedure in DB2 LUW?

Use the CREATE PROCEDURE command to do this. You can either use the DB2 command prompt or place the command in a program and compile and run it. If you use the DB2 command prompt, you first connect to the DB2 LUW Server where the stored procedure will be executed.


1 Answers

DB2 stores the system related tables under syscat schema. So a query on syscat.routines will give you the Stored Procedure content.

A typical example: if you got a stored procedure by the name update_employee, the below query works:

select text from syscat.routines where routinename = 'update_employee'

Using the db2 describe command, you can see the table schema and can determine which all columns you want to view.

Invoking a stored procedure is already answered in "How to call a stored procedure in IBM System i Access for Windows GUI Tool" and you can refer that. (Eg: call myStoredProc(parm1, parm2, ?); )

I suggest you read the DB2 stored procedure details from IBM website.

like image 74
Liju Mathew Avatar answered Nov 15 '22 12:11

Liju Mathew