我有一条插入数据的SQL语句:INSERT INTO BGS_PARAMETER_TAB (KEY, VALUE, OWNER, DEFAULTVALUE,REMARK) VALUES ('boss_request_head', 
'[FILEINFO]
VERSION=1.0
DELIMITER=|
DATA_ORDER=
[AUTHINFO]
USERNAME=admin
PASSWORD=111111
ENCRYPT_ALGORITHM=MD5[TASKINFO]
ORIGINAL_TASK_ID=44
TASK_NAME=来自BOSS的群发任务
TASK_TYPE=BUSS
TASK_DESC=来自BOSS的插入数据库提交的群发任务SRC_ID=10086DEST_FETCH_RULE=DATA
DEST_COUNT=44
DEST_DESC=CONTENT=内容信息见收件人号码文件
TEMPLATE=TRUEFILTER_NO_AUDIT=FALSE
FILTER_NO_DUPLICATE=TRUE
FILTER_NO_DISTURB=TRUE
FILTER_MESSAGE_COUNTER=TRUE
PRIORITY=5
REMINDER=
START_TIME=
END_TIME=
NO_DISTURB_TIME=
CLIENT_TYPE_FORBIDDEN=
CLIENT_CITY_FORBIDDEN=
NUMBER_LIST_FORBIDDEN=
', 'admin', 
'[TASKINFO]
ORIGINAL_TASK_ID=231312313
TASK_NAME=套餐介绍
TASK_TYPE=BUSS
TASK_DESC=介绍最新的短信资费套餐SRC_ID=106586080001DEST_FETCH_RULE=DATA
DEST_COUNT=3000000
DEST_DESC=除移动公司领导外的所有客户TITLE=欢迎访问海南移动网上营业厅
URL=http://ha.chinamobile.com/FILTER_NO_AUDIT=TURE
FILTER_NO_DUPLICATE=TURE
FILTER_NO_DISTURB=TURE
FILTER_MESSAGE_COUNTER=TUREPRIORITY=5
REMINDER=13880039759,13880039777
START_TIME=2008-01-25 23:00:00
END_TIME=2008-01-25 23:00:00
NO_DISTURB_TIME=ALLDAY 09:00-17:00,WEEKEND 00:00-24:00
CLIENT_TYPE_FORBIDDEN=GOLD,VIP
CLIENT_CITY_FORBIDDEN=01,20,22
NUMBER_LIST_FORBIDDEN=BLACKLIST,CMCCMANAGER
', NULL); 
最初我是将这条SQL语句写在一个insert_init_data.sql文件中,然后在数据库服务器上执行以下命令执行改sql文件:
sqlplus / as sysdba
SQL>@insert_init_data.sql
确莫名其妙的出现以下的错误:SP2-0042: unknown command "[TASKINFO]" - rest of line ignored.
SP2-0734: unknown command beginning "ORIGINAL_T..." - rest of line ignored.
SP2-0734: unknown command beginning "TASK_NAME=..." - rest of line ignored.
SP2-0734: unknown command beginning "TASK_TYPE=..." - rest of line ignored.
SP2-0044: For a list of known commands enter HELP
and to leave enter EXIT.
SP2-0734: unknown command beginning "TASK_DESC=..." - rest of line ignored.
SP2-0734: unknown command beginning "SRC_ID=100..." - rest of line ignored.
SP2-0734: unknown command beginning "DEST_FETCH..." - rest of line ignored.
SP2-0734: unknown command beginning "DEST_COUNT..." - rest of line ignored.
SP2-0044: For a list of known commands enter HELP
and to leave enter EXIT.
SP2-0042: unknown command "DEST_DESC=" - rest of line ignored.
SP2-0734: unknown command beginning "CONTENT=ÄÚ..." - rest of line ignored.
SP2-0734: unknown command beginning "TEMPLATE=T..." - rest of line ignored.
SP2-0734: unknown command beginning "FILTER_NO_..." - rest of line ignored.
SP2-0044: For a list of known commands enter HELP
and to leave enter EXIT.
SP2-0734: unknown command beginning "FILTER_NO_..." - rest of line ignored.
SP2-0734: unknown command beginning "FILTER_NO_..." - rest of line ignored.
SP2-0734: unknown command beginning "FILTER_MES..." - rest of line ignored.
SP2-0042: unknown command "PRIORITY=5" - rest of line ignored.
SP2-0044: For a list of known commands enter HELP
and to leave enter EXIT.
SP2-0042: unknown command "REMINDER=" - rest of line ignored.
SP2-0310: unable to open file "_TIME=.sql"
SP2-0042: unknown command "END_TIME=" - rest of line ignored.
SP2-0734: unknown command beginning "NO_DISTURB..." - rest of line ignored.
SP2-0734: unknown command beginning "CLIENT_TYP..." - rest of line ignored.
SP2-0734: unknown command beginning "CLIENT_CIT..." - rest of line ignored.
SP2-0044: For a list of known commands enter HELP
and to leave enter EXIT.
SP2-0734: unknown command beginning "NUMBER_LIS..." - rest of line ignored.
SP2-0734: unknown command beginning "', 'admin'..." - rest of line ignored.
SP2-0734: unknown command beginning "'[TASKINFO..." - rest of line ignored.
SP2-0734: unknown command beginning "ORIGINAL_T..." - rest of line ignored.
SP2-0044: For a list of known commands enter HELP
and to leave enter EXIT.
SP2-0734: unknown command beginning "TASK_NAME=..." - rest of line ignored.
SP2-0734: unknown command beginning "TASK_TYPE=..." - rest of line ignored.
SP2-0734: unknown command beginning "TASK_DESC=..." - rest of line ignored.
SP2-0734: unknown command beginning "SRC_ID=106..." - rest of line ignored.
SP2-0044: For a list of known commands enter HELP
and to leave enter EXIT.
SP2-0734: unknown command beginning "DEST_FETCH..." - rest of line ignored.
SP2-0734: unknown command beginning "DEST_COUNT..." - rest of line ignored.
SP2-0734: unknown command beginning "DEST_DESC=..." - rest of line ignored.
SP2-0734: unknown command beginning "TITLE=»¶Ó­..." - rest of line ignored.
SP2-0044: For a list of known commands enter HELP
and to leave enter EXIT.
SP2-0734: unknown command beginning "URL=http:/..." - rest of line ignored.
SP2-0734: unknown command beginning "FILTER_NO_..." - rest of line ignored.
SP2-0734: unknown command beginning "FILTER_NO_..." - rest of line ignored.
SP2-0734: unknown command beginning "FILTER_NO_..." - rest of line ignored.
SP2-0044: For a list of known commands enter HELP
and to leave enter EXIT.
SP2-0734: unknown command beginning "FILTER_MES..." - rest of line ignored.
SP2-0042: unknown command "PRIORITY=5" - rest of line ignored.
SP2-0734: unknown command beginning "REMINDER=1..." - rest of line ignored.
SP2-0310: unable to open file "_TIME=2008-01-25.sql"
SP2-0734: unknown command beginning "END_TIME=2..." - rest of line ignored.
SP2-0734: unknown command beginning "NO_DISTURB..." - rest of line ignored.
SP2-0734: unknown command beginning "CLIENT_TYP..." - rest of line ignored.
SP2-0734: unknown command beginning "CLIENT_CIT..." - rest of line ignored.
SP2-0044: For a list of known commands enter HELP
and to leave enter EXIT.
SP2-0734: unknown command beginning "NUMBER_LIS..." - rest of line ignored.
SP2-0042: unknown command "', NULL)" - rest of line ignored.
而我通过客户端工具直接执行这条SQL,却没有出现错误,插入成功....
请问有遇到过这种情况的吗?是什么原因啊?

解决方案 »

  1.   

    -- 所有的换行符,可以用 chr(10)替换,示例如下:scott@SZTYORA> select 'Hello '||chr(10)||' My name is luoyoumou' from dual;'HELLO'||CHR(10)||'MYNAMEISLUOYOUMOU'
    --------------------------------------------------------
    Hello
     My name is luoyoumou
      

  2.   

    遇到换行的地方用chr(10)
    --你可以参考这个看看
    SQL> create table test (vname varchar2(1000));表已创建。SQL> insert into test values('[FILEINFO]
      2  VERSION=1.0
      3  DELIMITER=|
      4  DATA_ORDER=
      5  [AUTHINFO]
      6  USERNAME=admin
      7  PASSWORD=111111
      8  ENCRYPT_ALGORITHM=MD5
      9  '||chr(10)||chr(10)||
     10  '[TASKINFO]
     11  ORIGINAL_TASK_ID=44
     12  TASK_NAME=来自BOSS的群发任务
     13  TASK_TYPE=BUSS
     14  TASK_DESC=来自BOSS的插入数据库提交的群发任务
     15  ')
     16  /已创建 1 行。SQL> select * from test;VNAME
    ------------------------------------------------------------
    [FILEINFO]
    VERSION=1.0
    DELIMITER=|
    DATA_ORDER=
    [AUTHINFO]
    USERNAME=admin
    PASSWORD=111111
    ENCRYPT_ALGORITHM=MD5
    [TASKINFO]
    ORIGINAL_TASK_ID=44
    TASK_NAME=来自BOSS的群发任务
    TASK_TYPE=BUSS
    TASK_DESC=来自BOSS的插入数据库提交的群发任务
      

  3.   


    [FILEINFO]后面也是有换行的吧,怎么没有用chr(10)替换,也换行了?
      

  4.   

    我今天也碰到这个问题了,可是把格式从UNICODE/UTF-8转换成UTF-8就解决问题了。