Skip to Main Content

Infrastructure Software

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

shell script not ESCAPING(\) the $ sign for oracle database v$ view.

885068Aug 18 2015 — edited Aug 24 2015

Hello Experts-

Is there any error in my script or is there ANOTHER way to use escape character. Thanks In Advance

I am trying to query v$ view of database but the script is failing.

sqlplus -s /nolog<<-EOF >>$LOG_FILE

connect / as sysdba

SET ECHO OFF

select db_unique_name,TO_CHAR(SYSTIMESTAMP,'MM-DD-YY HH-MI') AS TIME_STAMP from v\$database,dual group by db_unique_name;

EXIT;

EOF`

ERROR::

select db_unique_name,TO_CHAR(SYSTIMESTAMP,'MM-DD-YY HH-MI') AS TIME_STAMP from v,dual group by db_unique_name

                                                                                *

ERROR at line 1:

ORA-04044: procedure, function, package, or type is not allowed here

So I do realize that the script is not processing the $ symbol but all my research was pointing to use '\' - escape character and I am not sure why this is NOT working.

Is it something to do my user profile ?

[oracle@hostname ~]$ stty -a

speed 38400 baud; rows 71; columns 237; line = 0;

intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>; eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 0;

-parenb -parodd cs8 -hupcl -cstopb cread -clocal -crtscts -cdtrdsr

-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff -iuclc -ixany -imaxbel -iutf8

opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0

isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt echoctl echoke

[oracle@hostname ~]$

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 21 2015
Added on Aug 18 2015
6 comments
8,939 views