Pass parameters to oracle SQL Query [message #568089] |
Tue, 09 October 2012 08:21 |
ramtin
Messages: 37 Registered: November 2008
|
Member |
|
|
Hi I am trying to pass the parameters to query and I need to pass few parameters to query. Can I make it like like then I run it, then it come up and ask the parameter like this:
SQL> @text
para1 XXXXX
para2 XXXXX
And then the result of query will come up. I would like to put label for each parameter( likepara1). Please advise
Thank you for your help in advance
Regards,
Mohammad
|
|
|
|
|
Re: Pass parameters to oracle SQL Query [message #568102 is a reply to message #568093] |
Tue, 09 October 2012 08:45 |
ramtin
Messages: 37 Registered: November 2008
|
Member |
|
|
I have query and need to run it in SQLplus. I found out with following like I can get the parameter but I still need to put the label for parameter because they are few parameter and user need to know with the parameter he/she need to put in order.
AND WFR_YEAR_CODE >= '&f_year_code'
AND WFR_YEAR_CODE <= '&t_year_code'
Thanks
|
|
|
|
|
|
|
|
|
|
Re: Pass parameters to oracle SQL Query [message #568212 is a reply to message #568123] |
Wed, 10 October 2012 04:42 |
|
ramoradba
Messages: 2457 Registered: January 2009 Location: AndhraPradesh,Hyderabad,I...
|
Senior Member |
|
|
If you read the link posted by Michel,You can understand.
----This My script content.
--This will accept "Char" datatype as an Input and it will pront you when you execute the script as 'Please Enter start_date:'
Dev>host type e:\test.sql
undef start_date
accept start_date char prompt 'Please Enter start_date:'
select to_date(&start_date,'yyyymmdd') from dual;
---Now I am calling that script from sqlplus
Dev>@ e:\test.sql
Please Enter start_date:20121010
old 1: select to_date(&start_date,'yyyymmdd') from dual
new 1: select to_date(20121010,'yyyymmdd') from dual
TO_DATE(2
---------
10-OCT-12
Dev>
|
|
|