Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: running SQL script in UNIX command script

Re: running SQL script in UNIX command script

From: Jonathan Leffler <jleffler_at_earthlink.net>
Date: Fri, 05 Dec 2003 05:48:44 GMT
Message-ID: <0%Uzb.29137$sb4.15811@newsread2.news.pas.earthlink.net>


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?

Quotes around the exclamation mark. That prevents the shell from expanding $item_ctxdesc to an empty string, and $i to another empty string.

-- 
Jonathan Leffler                   #include <disclaimer.h>
Email: jleffler_at_earthlink.net, jleffler_at_us.ibm.com
Guardian of DBD::Informix v2003.04 -- http://dbi.perl.org/
Received on Thu Dec 04 2003 - 23:48:44 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US