"缺少逗号"在表中插入clob值时出错

时间:2016-09-15 12:29:29

标签: mysql oracle11g plsqldeveloper

CREATE TABLE fcc_consistency_check
(
    cons_id         VARCHAR2(30),
    cons_desc       VARCHAR2(4000),
    cons_query      CLOB,
    module_id       VARCHAR2(2),
    main_tab_name   VARCHAR2(30),
    hist_tab_name   VARCHAR2(30),
    col_name        VARCHAR2(4000),
    col_type        VARCHAR2(4000),
    check_reqd      VARCHAR2(1)
);


INSERT INTO fcc_consistency_check
VALUES ('CHK_BC003','Missing records in contract_event_log','select a.CONTRACT_REF_NO ,a.Latest_Event_Seq_No,                                                 
 c.PREV_WORKING_DAY from cstb_contract A ,sttm_dates c
 where module_code = 'BC'
 and c.Branch_code='000'
 and not exists (select * from cstb_contract_event_log B
 where a.contract_ref_no = b.contract_ref_no 
 and latest_event_seq_no = event_seq_no);',
 'BC','BCCC_EVENT_LOG_MISREC','BCCC_EVENT_LOG_MISREC_HISTORY','CONTRACT_REF_NO,LATEST_EVENT_SEQ_NO,EOD_DATE','VARCHAR2(16),NUMBER,DATE','Y');

无法插入clob值,我收到此错误

  

ORA-00917:缺少逗号

当我尝试插入单个列值时,我发现错误就是列cons_query

1 个答案:

答案 0 :(得分:0)

问题是您的查询中有引号:

'select a.CONTRACT_REF_NO
 ,a.Latest_Event_Seq_No,
 c.PREV_WORKING_DAY from cstb_contract A ,sttm_dates
 where module_code = 'BC'
^string starst here:
                     ^ends here, there's a commma missing

然而,实际问题不是逗号丢失,而是你有引号忘记逃避。例如,你需要编写module_code = ''BC''以逃避这些引号(你有其他引号,而不仅仅是'BC')。