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: sqlplus using Here document does not recognize v$ view ?

Re: sqlplus using Here document does not recognize v$ view ?

From: Howard J. Rogers <hjr_at_dizwell.com>
Date: Tue, 18 May 2004 07:45:46 +1000
Message-ID: <40a9327f$0$8988$afc38c87@news.optusnet.com.au>


Ted Chyn wrote:

> dear sir,
>
> why following sqlplus command using here document did not recognize
> the
> v$database(case 1). it worked in case 2 when login directly.
>
> my question : How to rectify case 1 to ensure unix here document works
> ?
>
>
> thanks ted
>
>
> =====
> 1. case 1
>
> SQL> Disconnected from Oracle9i Enterprise Edition Release 9.2.0.3.0 -
> 64bit Production
> With the Partitioning, OLAP and Oracle Data Mining options
> JServer Release 9.2.0.3.0 - Production
> /export/home/oracle/script > sqlplus -s /nolog <<eof
>

>>connect system/huni123_
>>select name from v$database;
>>exit
>>eof

>
> Connected.
> select name from v
> *
> ERROR at line 1:
> ORA-00942: table or view does not exist

It's actually quite nice when Oracle gives you an error message which tells you precisely what's wrong, albeit with a little bit of interpretation required.

Oracle says table "v" doesn't exist. You know your script contains the name "v$database". Therefore, there must be something about the "$" in your script that is causing Oracle to sort-of terminate the input and not read the following characters.

Happens a lot with "odd" characters. ">", "<", "$" ...they can all do it. If you want them to be read literally, your original script has to 'escape' them, by prefacing them with something that tells SQL*Plus to keep on reading. Usually, that's a "\".

So if you edit your input script file so it says "v\$database", you should get it working OK.

Regards
HJR Received on Mon May 17 2004 - 16:45:46 CDT

Original text of this message

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