Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: sqlplus using Here document does not recognize v$ view ?
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
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