Home » Other » Client Tools » Command line parameters for sql script ?
Command line parameters for sql script ? [message #314744] Thu, 17 April 2008 12:34 Go to next message
McLan
Messages: 36
Registered: April 2008
Member
I have sql script named do_needful.sql, this does some processing.
I want to pass input parameter for this script (some thing like command line parameters in unix shell script) as below:
sqlplus> @do_needful.sql <inputfile or input parameter>

is this possible?

Regards,
McLan
Re: Command line parameters for sql script ? [message #314745 is a reply to message #314744] Thu, 17 April 2008 12:37 Go to previous messageGo to next message
Michel Cadot
Messages: 68625
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Just try what you want and you see it works.

Regards
Michel
Re: Command line parameters for sql script ? [message #314749 is a reply to message #314745] Thu, 17 April 2008 12:50 Go to previous messageGo to next message
McLan
Messages: 36
Registered: April 2008
Member
How to access input parameter in do_needful.sql?
If I want to do some decision making based on the input parameter,
if (command_line_pram_value > 5) then
{
do some thing
}
Re: Command line parameters for sql script ? [message #314754 is a reply to message #314749] Thu, 17 April 2008 13:04 Go to previous message
Michel Cadot
Messages: 68625
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Quote:
How to access input parameter in do_needful.sql?

&1, &2... (like $1, $2... in Unix shell).

SQL*PlusŪ User's Guide and Reference

Quote:
if (command_line_pram_value > 5) then

SQL*Plus does not contain a language it is just a basic line tool.
You have to use PL/SQL for this but what you can do depends on what you want to do. PL/SQL does not interact with client but you can pass and get back values to/from PL/SQL.

Regards
Michel
Previous Topic: plsql developer problem
Next Topic: Output File
Goto Forum:
  


Current Time: Fri Mar 29 00:57:39 CDT 2024