By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,882 Members | 1,423 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,882 IT Pros & Developers. It's quick & easy.

problem with executing procedure

ilikesuresh
P: 47
Hi all,
I have written athe following program to execute a procedure number of times using korn shell scripting
Expand|Select|Wrap|Line Numbers
  1. for number in `cat $INPUT_FILE`
  2. do
  3.    $SQLPLUS -S $sql_user_name/$sql_user_pwd@$sql_service <<EOF 1>>$LOG_FILE 2>>$LOG_FILE
  4.     set head off;
  5.     set echo off;
  6.     set serveroutput on;
  7.     exec number_names(&1);
  8.     $number
  9.     EOF
  10. done
  11.  
  12.  
But if i execute the program the error i got is
syntax error at line 22 : `<<' unmatched
But when i executing the same program with one number(not including in the for loop) the program executed fine.
In the log file i am getting,

PL/SQL procedure successfully completed.

SP2-0042: unknown command "EOF" - rest of line ignored.
SP2-0042: unknown command "done" - rest of line ignored.


Please help me out from this issue.

Thanks in advance
Jan 17 '08 #1
Share this Question
Share on Google+
2 Replies


P: 13
Hi all,
I have written athe following program to execute a procedure number of times using korn shell scripting
Expand|Select|Wrap|Line Numbers
  1. for number in `cat $INPUT_FILE`
  2. do
  3.    $SQLPLUS -S $sql_user_name/$sql_user_pwd@$sql_service <<EOF 1>>$LOG_FILE 2>>$LOG_FILE
  4.     set head off;
  5.     set echo off;
  6.     set serveroutput on;
  7.     exec number_names(&1);
  8.     $number
  9.     EOF
  10. done
  11.  
  12.  
But if i execute the program the error i got is
syntax error at line 22 : `<<' unmatched
But when i executing the same program with one number(not including in the for loop) the program executed fine.
In the log file i am getting,

PL/SQL procedure successfully completed.

SP2-0042: unknown command "EOF" - rest of line ignored.
SP2-0042: unknown command "done" - rest of line ignored.


Please help me out from this issue.

Thanks in advance
Hi,

You might try revising your SQL code line to this:
$SQLPLUS -S $sql_user_name/$sql_user_pwd@$sql_service1>>$LOG_FILE 2>&1 <<EOF

In this line, you are instructing the system to send standard out and standard error to the same place as before, but the real source of your problem was the <<EOF had to be the last thing on the line. You're creating what is sometimes called a 'here document.' The <<EOF says to start taking instructions until the EOF character string appears again. By having output redirection within the commands, you created the error.

Hope this helps. I just joined in so that's why the delay in answering.
Jan 28 '08 #2

Expert 100+
P: 511
you might want to bring your EOF to start on the beginning of line
Expand|Select|Wrap|Line Numbers
  1. for blah .......
  2. do
  3.     sqlplus blah.... << EOF
  4.  
  5. EOF # put it at start of line
  6. done
  7.  
Jan 28 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.