Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2012
    Posts
    1

    Red face Unanswered: 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.

  2. #2
    Join Date
    Sep 2009
    Location
    Ontario
    Posts
    1,057
    Provided Answers: 1
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •