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 > Data Access, Manipulation & Batch Languages > Unix Shell Scripts > How to pass user input from shell script to sql procedure

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-14-12, 06:57
rituaricent rituaricent is offline
Registered User
 
Join Date: Jan 2012
Posts: 1
Red face How to pass user input from shell script to sql procedure

Hi,
I have one .sh file in which i am taking two inputs from user that is
read pakage_name
read status
now i am calling one procedure like
sqlplus -s ${MISSREFDATA_USER}/${MISSREFDATA_PASSWD}@cms_db_server/IXP @${MISSING_REFDATA_DIR}/schema/utils/sql/ModifyScheduledStatus.sql ${MISSING_REFDATA_DIR}
these two values that i take from user (package_name and status), i have to pass to this ModifyScheduledStatus.sql call

Please help how i can pass these values and how can i capture them in my ModifyScheduledStatus.sql file for further use.
Reply With Quote
  #2 (permalink)  
Old 01-14-12, 10:47
kitaman kitaman is offline
Papabi's friend
 
Join Date: Sep 2009
Location: Ontario
Posts: 629
Combine your .sh script and your .sql script into one file.
Code:
read PACKAGE_NAME
read STATUS
export PACKAGE_NAME STATUS
sqlplus -s connection_string <<EOF
select * from $PACKAGE_NAME where status = $STATUS
etc
EOF
Make sure that EOF starts in column 1
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