Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

taking input from a file????

Status
Not open for further replies.

alphaaa

Technical User
Jan 15, 2002
45
US
I have a sql script that prompts for a couple of inputs. what do i have to do so that it doesn't prompt for the inputs but takes the inputs from the command line. The reason i want it that way is that i want to invoke this sql script from a shell and shell will pass down those inputs as paramaters... Any help will be greatly appreciated. Thanks
 


Inside your sql script, you can make use of the &&n variables. Example;

-- start of your sql script, samp.sql

SELECT *
FROM tables
WHERE column1 = &&1
AND column2 = '&&2'; -- if char

-- end of samp.sql


Call your sql script from shell script

sqlplus user/pwd@db << !
@samp.sql $passed_var1 $passed_var2
!

# where passed_var# are the inputs of your sql script.
Robbie

&quot;The rule is, not to besiege walled cities if it can possibly be avoided&quot; -- Art of War
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top