2

当我试图从 Unix 服务器执行 SQL 脚本时,它显示错误,但我从 sql navigator 运行的相同 SQL 工作正常..请帮助我..

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 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

提前致谢 !!

4

1 回答 1

1

我不记得 Oracle 命令行客户端是否允许额外的空格换行符。WHERE删除子句前的额外换行符。

更新

从文档中,空行在 SQLplus 中默认终止 SQL 语句。

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 (;).

您可以更改行为以使用分号而不是空行:

SET SQLTERMINATOR ON
于 2012-04-19T11:00:07.290 回答