Skip to Main Content

SQL & PL/SQL

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!

set escape \ error

RengudiJan 18 2017 — edited Jan 18 2017

Hi

I am working oracle 11g R2 in Unix platform

I am getting error while executing my sql inside the shell

#!/bin/bash

LogDirectory='/tmp'

echo -n "Enter DBUSER > "

read DBUSER

DBUSER=$DBUSER

echo -n "Enter DBUSERPASSWORD > "

read DBUSERPASSWORD

DBUSERPASSWORD=$DBUSERPASSWORD

echo -n "Enter SID > "

read SID

MYDB=$SID

echo -n "Enter start_date > "

read start_date

start_date=$start_date

echo -n "Enter end_date > "

read end_date

end_date=$end_date

sqlplus -s ${DBUSER}/${DBUSERPASSWORD}@${MYDB}<<EOF

set linesize 4000

set verify off

set feedback off

set pagesize 9999

set markup html on entmap on spool on preformat off

set escape \

define start_date     = $start_date;

define end_date     = $end_date;

spool output.xlsx

select \$start_date,\$end_date from dual;

spool off

set markup html off entmap off spool off preformat on

exit

EOF

set linesize 2000 verify on feedback on

error message

string beginning &quot;define sta...&quot; <br>

is too long. maximum size is 1 character.

<br>

<pre>

select $start_date,$end_date from dual

       *

</pre>

ERROR at line 1:

<br>

ORA-00911: invalid character

<br>

Whats wrong here?

Thanks

Raj

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 15 2017
Added on Jan 18 2017
4 comments
507 views