DBAsupport.com Forums - Powered by vBulletin
Results 1 to 3 of 3

Thread: Calling procedure from Shell script

  1. #1
    Join Date
    May 2006
    Posts
    41

    Calling procedure from Shell script

    Hi,

    How to call a stored procedure from shell script and vice-versa?

    Thanks

  2. #2
    Join Date
    May 2005
    Location
    Boracay
    Posts
    681
    I think its like calling a sql batch program.
    For example:

    shell1.exe
    ---------
    sqlplus system/manager @batch1.sql
    exit

    batch1.sql
    ----------
    execute dbms.refresh_db('fast');
    exit

    I think u can not do the reverse...u may opt to use
    scheduler or crontab to call the shell script.

    Am i right davey or partly
    Last edited by yxez; 09-12-2006 at 04:01 AM.

  3. #3
    Join Date
    Feb 2003
    Location
    Leeds, UK
    Posts
    367
    You can combine the shell script and the sql script into a single shell script. I assume in the example that oraenv is in /usr/local/bin. On some UNIX platforms it's located elsewhere

    PHP Code:
    #
    # Set up the oracle environment
    #
    export ORACLE_SID=TESTDB
    export ORAENV_ASK
    =NO
    export PATH
    =/usr/local/bin:$PATH
    #
    oraenv
    #
    sqlplus username/password <<EOF
    exec myprocedure
    ;
    exit
    EOF 
    To call a shell script from a stored procedure your looking at Java in the database on external procedures in C or similar.

Posting Permissions

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


Click Here to Expand Forum to Full Width