Path: newssvr20.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!newsfeed.telusplanet.net!newsfeed.telus.net!clgrps13.POSTED!not-for-mail
Message-ID: <3FCF76B6.80B3BF40@yahoo.net>
From: Hans Forbrich <forbrich@yahoo.net>
X-Mailer: Mozilla 4.8 [en] (Win95; U)
X-Accept-Language: en
MIME-Version: 1.0
Newsgroups: comp.databases.oracle.server
Subject: Re: running SQL script in UNIX command script
References: <b45e1530.0312040951.2b4fa2e7@posting.google.com>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Lines: 40
Date: Thu, 04 Dec 2003 18:03:11 GMT
NNTP-Posting-Host: 161.184.143.77
X-Trace: clgrps13 1070560991 161.184.143.77 (Thu, 04 Dec 2003 11:03:11 MST)
NNTP-Posting-Date: Thu, 04 Dec 2003 11:03:11 MST
Xref: newssvr20.news.prodigy.com comp.databases.oracle.server:249329

Dave wrote:
> 
> Oracle 8.1.7.3:
> 
> I have the following in a UNIX shell script:
> 
> #!/bin/ksh
> sqlplus /NOLOG <<!
> connect johndoe/password;
> select count(token_text) from dr$item_ctxdesc$i;
> 
> When I run it, I get this output:
> 
> SQL*Plus: Release 8.1.7.0.0 - Production on Thu Dec 4 12:50:20 2003
> 
> (c) Copyright 2000 Oracle Corporation.  All rights reserved.
> 
> SQL> Connected.
> SQL> select count(token_text) from dr
>                               *
> ERROR at line 1:
> ORA-00942: table or view does not exist
> 
> SQL> Disconnected from Oracle8i Enterprise Edition Release 8.1.7.4.0 -
> 64bit Production
> 
> So, it's running, connecting as my user, and then trying to run the
> select statement and failing at the 'from' command.
> 
> When I run this statement at the SQL prompt, or in a SQL script(called
> with @script.sql) it works.
> 
> What am I missing?

The fact that the $ is the general unix shell 'start of variable'. 

Before the shell passes this to SQLPlus, the shell tries to resolve the
$i and the $item_ctxdesc variables.  What are they set to, I wonder?

Try escaping the $ (usual escape char in unix tends to be a backslash.)
