If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Unix Shell Scripts > Error in passing SQL Stmt to Shell Script

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-19-04, 15:05
sgnerd sgnerd is offline
Registered User
 
Join Date: Jan 2003
Posts: 26
Red face 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
Reply With Quote
  #2 (permalink)  
Old 12-19-04, 16:43
vgersh99 vgersh99 is offline
Registered User
 
Join Date: Apr 2004
Location: Boston, MA
Posts: 325
what's the value of "$sqlstr"?
__________________
vlad
+-----------------------+
| #include <disclaimer.h> |
+-----------------------+
Reply With Quote
  #3 (permalink)  
Old 12-19-04, 23:16
sgnerd sgnerd is offline
Registered User
 
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.
Reply With Quote
  #4 (permalink)  
Old 12-20-04, 06:55
Damian Ibbotson Damian Ibbotson is offline
Padawan
 
Join Date: Jun 2002
Location: UK
Posts: 525
...so why haven't you noticed that sqlstr is blank/unset?
Reply With Quote
  #5 (permalink)  
Old 12-20-04, 09:48
vgersh99 vgersh99 is offline
Registered User
 
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> |
+-----------------------+
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On