If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > procedure creation from db2cmd

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-17-06, 06:50
jayawant jayawant is offline
Registered User
 
Join Date: Jan 2006
Posts: 6
procedure creation from db2cmd

hi iam trying to create a simple stored procedure , but i want to do this by not using development centre. iam trying to create it from db2cmd , how do i go about it ,here is the procedure which iam trying to implement.


CREATE PROCEDURE SHIBSD01.FOR_TEST
(IN INPUT_VAR INTEGER,OUT OUTPUT_VAR INTEGER)
P1:BEGIN
SET OUTPUT_VAR = INPUT_VAR + 10;
END P1
;
Reply With Quote
  #2 (permalink)  
Old 03-17-06, 07:53
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
Use you favorite text editor and put the create statement into a file like this:
(note the @ sign is the create statement delimiter. you cannot use ; because it is needed inside the procedure body)

CREATE PROCEDURE SHIBSD01.FOR_TEST
(IN INPUT_VAR INTEGER,OUT OUTPUT_VAR INTEGER)
P1:BEGIN
SET OUTPUT_VAR = INPUT_VAR + 10;
END P1
@

Save the file. Then from the command window:

db2 connect to mydb user myuser using mypassword
db2 -td@ -svf filename

Note: you can put multiple statements into the file if you want to.

HTH
Andy
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On