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

Thread: UNIX environment variable in SQL script

  1. #1
    Join Date
    Apr 2001
    Posts
    10

    Question

    Is any way to pass the UNIX environmental variables to SQL*Plus script?
    I am using Oracle 8.0.6 on HP, and have defined the environmental variable $BANK.
    I want to use this variable in SQL*Plus script and later pass it into stored procedure.
    Or can I just pass the environmental variable to stored procedure?

    Kazik

  2. #2
    Join Date
    Nov 2000
    Location
    Israel
    Posts
    268
    Hi,
    you can create a script file that will deine a UNIX env parameter and call for it in the sql block :

    ---------------- CUT HERE ----------------------------
    #!/bin/csh -fb
    set param ="3"

    sqlplus system/manager@orcl << EOF | tee /tmp/$$TMP_FILE
    select some_value from some_table where some_param = $param
    EOF
    ---------------- CUT HERE ----------------------------

    ** If you are selecting from v$ views you should use v\$:
    select * from v\$session;
    because the OS will think it is a UNIX variable.

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