Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2008
    Posts
    1

    Unanswered: Invoke a stored procedure from a shell script (SP returns a ref cursor)

    Hi,
    How do we invoke a stored procedure from shell script. The procedure returns a reference cursor from which the shell script will have to retrieve values from the table ?

  2. #2
    Join Date
    Jun 2003
    Location
    West Palm Beach, FL
    Posts
    2,713

    Wink

    Try something like:
    Code:
    #!/bin/ksh
    . /opt/app/oracle/local/bin/mydb_env.ksh
    (sqlplus -s userid/passwd <<!EOF
     set head off pages 0 lin 132 feed off trims on
     Var rc refcursor;
     exec my_sp(:rc);
     print :rc
     exit
    !EOF
    ) |\
    while read lin
    do
      echo "Line is: $lin"
    done
    The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb

Posting Permissions

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