Unexpected end of file

Hi,

On adding below code to my script shows the error on executing else script works fine.

sqlplus $user_name/$password <<EOL
truncate table order;
commit;
truncate table order_hist; 
commit;           
insert into order(ID,TRAN,CUST_NAME,OPT_VAL) select * from order_bkp;
insert into order_hist(ID,TRAN,CUST_NAME,OPT_VAL) select * from order_hist_bkp;
drop table order_bkp;
drop table order_hist_bkp;
EOL

Error:
syntax error: unexpected end of file

Where mistake is done in the above ?

With Regards

Are you sure there isn't an error (for example an unterminated quote), probably in the lines just before this section?

Hi,

There is no unterminated quote before this.

is this can be due to use of multiple if ...else statement in the code ?

With Regards

First impression, you are not exiting sqlplus.
Last line before "EOL" should be:

If this isn't the fix, please post the whole script (blanking any passwords etc.).
Please state what Operating System you have and what Shell you use.
Please post the complete error message (case-significant with all punctuation). There is no Shell or Oracle which will just give an error message "syntax error: unexpected end of file".

does your final "EOL" appear exactly as listed i.e. with no spaces/tabs before it on the line ? (This would cause it to break...)

1 Like

Hi,

Its was problem of spaces, removed and it worked.

Thanks

With Regards