Results 1 to 5 of 5
  1. #1
    Join Date
    Jan 2003
    Posts
    26

    Red face Unanswered: Error in passing SQL Stmt to Shell Script

    Dear Friends,
    I have encounted the following error while I tried like this

    > cat sample2.sh
    #!/bin/sh
    echo "SELECT username FROM dba_users;" >>$sqlstr
    echo "EXIT" >>$sqlstr

    echo $sqlstr

    sqlplus system/manager@BHI @$sqlstr
    >

    I am executing it like
    > sample2.sh
    SELECT username FROM dba_users;
    EXIT

    SQL*Plus: Release 8.1.7.0.0 - Production on Sun Dec 19 13:51:26 2004
    (c) Copyright 2000 Oracle Corporation. All rights reserved.
    Connected to:
    Oracle8i Enterprise Edition Release 8.1.7.0.0 - Production
    With the Partitioning option
    JServer Release 8.1.7.0.0 - Production
    SP2-0310: unable to open file ""
    SQL>

    It struck here. I tried using this sqlplus system/manager@BHI `@$sqlstr`
    then I get the following error
    ./sample2.sh: @: not found

    SQL*Plus: Release 8.1.7.0.0 - Production on Sun Dec 19 13:57:33 2004
    (c) Copyright 2000 Oracle Corporation. All rights reserved.
    Connected to:
    Oracle8i Enterprise Edition Release 8.1.7.0.0 - Production
    With the Partitioning option
    JServer Release 8.1.7.0.0 - Production
    SQL>

    I am following the script found at the following link as my example
    http://www.injunea.demon.co.uk/pages/page210.htm

    Please shed some light.
    Thanks
    Kumar

  2. #2
    Join Date
    Apr 2004
    Location
    Boston, MA
    Posts
    325
    what's the value of "$sqlstr"?
    vlad
    +-----------------------+
    | #include <disclaimer.h> |
    +-----------------------+

  3. #3
    Join Date
    Jan 2003
    Posts
    26

    Error in passing SQL Stmt to Shell Script

    Quote Originally Posted by vgersh99
    what's the value of "$sqlstr"?
    You can see the value in while executing the script itself. Please take note that I have used echo $sqlstr to display it is value. I find no problem in that.

  4. #4
    Join Date
    Jun 2002
    Location
    UK
    Posts
    525
    ...so why haven't you noticed that sqlstr is blank/unset?

  5. #5
    Join Date
    Apr 2004
    Location
    Boston, MA
    Posts
    325
    seems like '$sqlstr' is the path to a file to be populated with SQL commands.
    So...... what IS the pathname?
    vlad
    +-----------------------+
    | #include <disclaimer.h> |
    +-----------------------+

Posting Permissions

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