dbTalk Databases Forums  

Newbie: batch statements and return codes.

comp.databases.ibm-db2 comp.databases.ibm-db2


Discuss Newbie: batch statements and return codes. in the comp.databases.ibm-db2 forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Derek Clarkson
 
Posts: n/a

Default Newbie: batch statements and return codes. - 08-15-2003 , 01:16 AM






Hi all,
I'm trying to work out how I am going to develope some procs and functions
within DB2. Usually what I do when playing with code and testing things is
to write up an sql file containing the commands I want to run and then get
the database to run it.

Currently I am looking at writing scripts to load some initial data. As part
of this I need to get the value from an identity field and pass it to
several other procs and functions. It appears that DB2 only allows me to
declare variables within a proc or function. However what I would like to
do is to declare a variable, then call a function to populate it with a
value, then pass the field to serveral following procs. Like this:

declare var int;
var = somefunction();
call someproca(var);
call someprocb(var);
call someprocc(var);
.....

Is there any way to do something like this in DB2 without having to declare
a proc containing this code ? I would like to be able to declare variables
at the CLP level and used then whilst testing and playing with various
procs.

I would also like to be able to call a function from the command propt and
display the returned result. Apart from embedding it in a select statement
(which means it gets call for each record found) I can't figure out how to
call it. Does anyone know how ?


cio
Derek.



Reply With Quote
Reply




Thread Tools
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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.