2

when i am trying to execute the SQL script from Unix server its showing error but the same SQL i am running from sql navigator its working fine .. kindly help me on it..

INSERT INTO t_csocstudent_course_local
(SELECT   tsct.student_id,
          tsct.object_lookup_id,
          tsct.course_id,
          tsct.xcourse_id,
          clt.NAME,
          tsct.course_type,
          FROM   temp_stud_course tsct join course_local clt
   on tsct.COURSE_ID = clt.COURSE_ID

  WHERE   TO_CHAR (sc_timestamp, 'YYYYMMDDHH24MISS') >
              (SELECT   TO_CHAR (MAX (sc_timestamp), 'YYYYMMDDHH24MISS')
                 FROM   t_student_course_local)
          AND tsct.xcourse_id IN
                     ('EX1','EX2'));

Error :

Error in loading main table
Enter password:
SP2-0734: unknown command beginning "WHERE   TO..." - rest of line ignored.
              AND tsct.xcourse_id IN
              *
ERROR at line 3:
ORA-00933: SQL command not properly ended

Thanks in advance !!

0

1 Answer 1

1

I can't remember if the Oracle command line client permits extra whitespace linebreaks. Remove the extra linebreak before the WHERE clause.

Update

From the documentation, an empty line terminates a SQL statement by default in SQLplus.

SQLT[ERMINATOR] {;|c|OFF|ON}| 
   Set the char used to end and execute SQL commands to c. 
   OFF disables the command terminator - use an empty line instead.
   ON resets the terminator to the default semicolon (;).

You can change the behavior to use semicolons instead of empty lines:

SET SQLTERMINATOR ON
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.