problem with executing procedure

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ilikesuresh
    New Member
    • Aug 2007
    • 47

    problem with executing procedure

    Hi all,
    I have written athe following program to execute a procedure number of times using korn shell scripting
    Code:
    for number in `cat $INPUT_FILE`
    do
       $SQLPLUS -S $sql_user_name/$sql_user_pwd@$sql_service <<EOF 1>>$LOG_FILE 2>>$LOG_FILE
        set head off;
        set echo off;
        set serveroutput on;
        exec number_names(&1);
        $number
        EOF
    done
    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
  • bykwzpz
    New Member
    • Jan 2008
    • 12

    #2
    Originally posted by ilikesuresh
    Hi all,
    I have written athe following program to execute a procedure number of times using korn shell scripting
    Code:
    for number in `cat $INPUT_FILE`
    do
       $SQLPLUS -S $sql_user_name/$sql_user_pwd@$sql_service <<EOF 1>>$LOG_FILE 2>>$LOG_FILE
        set head off;
        set echo off;
        set serveroutput on;
        exec number_names(&1);
        $number
        EOF
    done
    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.

    Comment

    • ghostdog74
      Recognized Expert Contributor
      • Apr 2006
      • 511

      #3
      you might want to bring your EOF to start on the beginning of line
      Code:
      for blah .......
      do
          sqlplus blah.... << EOF
      
      EOF # put it at start of line
      done

      Comment

      Working...