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 > Parameter Passing In Db2

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-30-08, 05:31
skarri skarri is offline
Registered User
 
Join Date: Sep 2008
Posts: 16
Parameter Passing In Db2

this is the way in oracle to ask a user to pass a required value
Quote:
select ename from emp where mgr=&12;
output will be:
Quote:
Enter value for 12: 7788
old 1: select ename from emp where mgr=&12
new 1: select ename from emp where mgr=7788

ENAME
----------
ADAMS
so how do we do this in DB2
__________________
"TALK SENSE TO FOOL. HE CALLS U FOOLISH"
Reply With Quote
  #2 (permalink)  
Old 10-30-08, 07:46
stolze stolze is offline
Registered User
 
Join Date: Jan 2007
Location: Jena, Germany
Posts: 2,662
You write a shell/Perl/Python/... script that does the I/O that and then the script executes SQL statements. There is rarely the need to invent another language/extension for that.
__________________
Knut Stolze
IBM DB2 Analytics Accelerator
IBM Germany Research & Development
Reply With Quote
  #3 (permalink)  
Old 10-30-08, 13:03
madhu_kaza madhu_kaza is offline
Registered User
 
Join Date: Apr 2008
Posts: 39
You can write one scalar UDF where you can pass mgr value as input parameter and return ename as output.

Thanks,
Madhavi
Reply With Quote
  #4 (permalink)  
Old 10-30-08, 13:24
stolze stolze is offline
Registered User
 
Join Date: Jan 2007
Location: Jena, Germany
Posts: 2,662
I understood the question in such a way that the '&12' syntax actually triggers a user-interaction over the console and the user has to enter some value there.
__________________
Knut Stolze
IBM DB2 Analytics Accelerator
IBM Germany Research & Development
Reply With Quote
  #5 (permalink)  
Old 10-30-08, 15:51
dav1mo dav1mo is offline
Registered User
 
Join Date: Dec 2007
Location: Richmond, VA
Posts: 782
same syntax exists in QMF.
Reply With Quote
  #6 (permalink)  
Old 10-31-08, 08:13
skarri skarri is offline
Registered User
 
Join Date: Sep 2008
Posts: 16
Yes,i would require an output as Mr.STOLZE mentioned
__________________
"TALK SENSE TO FOOL. HE CALLS U FOOLISH"
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