Skip to Main Content

Infrastructure Software

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Pass Variables from Shell to SQLPlus ??

663605Jan 30 2009 — edited Aug 31 2009
Hi all,
I need to know if it's possible to pass variables from a shell script to
sqlplus.
The script reads a Table Name from user input & executes a Select statement
based on
that input.

Script:
....
echo "Enter table name: \c "
read answer

sqlplus 'oracle/*** ' <<!
spool columns.sql
@select.sql
spool off
exit
!

Inside SELECT.SQL , i need to use the variable "answer" to run
the query.



( $answer doesn't do the job...?:| )




Any help would be highly appreciated.
Thanks in advance...

Edited by: Lynda M. on Jan 30, 2009 9:19 AM
This post has been answered by Ivan Kartik on Jan 30 2009
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 28 2009
Added on Jan 30 2009
16 comments
63,686 views