通过oracle SQL Developer询问替换值

时间:2012-05-07 01:57:28

标签: oracle insert

我有一个像这样的插入查询:

INSERT INTO CONSUMER
            (CONS_ID_NO,
             LOCATION_ID,
             AREA_CODE,
             CONS_NO,
             CAT_CODE,
             KEY_ID,
             CONS_NAME,
             ADDRESS1,
             ADDRESS2,
             ADDRESS3,
             ADDRESS4,
             PHONE,
             DATE_CONNECT,
             FLAT,
             NO_OF_FLATS,
             BULK,
             OPENING_BALANCE,
             BALANCE_DATE,
             ROUTE_CODE,
             ROUTE_ORDER,
             METER_NO,
             METER_FIXATION_DATE,
             METER_OWNER,
             METER_WORKING,
             DISCONNECT,
             ALERT,
             LAST_READING,
             LAST_READING_DATE,
             LAST_READING_STATUS,
             PIC_AMT,
             PIC_KL,
             PIC_FROM,
             SC,
             MR,
             ARREARS,
             AS_ON_DATE,
             SCHEDULE_NO,
             MAIN_TYPE,
             SUB_TYPE,
             BILL_UPTO,
             CONS_SERVICE,
             CONS_SERVICE_ARREAR_CLEARED,
             PART_CONSUMER,
             BILL_ID_NO,
             READING_POSTED,
             METER_DIGITS,
             LAST_ADJUSTED_READING,
             LAST_ADJUSTED_DATE,
             LAST_ADJUSTED_STATUS)
VALUES      ('2112104945',
             '141',
             'CPW',
             '5225',
             'D',
             1946415,
             'ASHRAF PERILACODE
 & NASEEHA.K',
             'PERILACODEKP 1X/617A',
             'DHARSAN
 NAGAR',
             'PEROORKADA',
             '--',
             NULL,
             To_timestamp('2002-03-25
 00:00:00.0', 'DD-MON-RR HH.MI.SSXFF
 AM'),
             'N',
             NULL,
             NULL,
             52,
             To_timestamp('2002-03-01 00:00:00.0', 'DD-MON-RR
 HH.MI.SSXFF AM'),
             811,
             73,
             '10075256',
             To_timestamp('2010-11-12
 00:00:00.0', 'DD-MON-RR HH.MI.SSXFF
 AM'),
             'O',
             'Y',
             'N',
             'V',
             102,
             To_timestamp('2011-06-25
 00:00:00.0', 'DD-MON-RR HH.MI.SSXFF
 AM'),
             'W',
             55,
             13,
             To_timestamp('2011-06-25 00:00:00.0', 'DD-MON-RR
 HH.MI.SSXFF AM'),
             2,
             0,
             334,
             To_timestamp('2011-06-28
 00:00:00.0', 'DD-MON-RR HH.MI.SSXFF
 AM'),
             NULL,
             NULL,
             NULL,
             To_timestamp('2011-05-31 00:00:00.0', 'DD-MON-RR
 HH.MI.SSXFF
 AM'),
             NULL,
             NULL,
             'N',
             '3489554',
             'Y',
             5,
             102,
             To_timestamp('2011-06-25
 00:00:00.0', 'DD-MON-RR HH.MI.SSXFF AM'),
             'A'); 
  1. 在SQLDeveloper 3(Oracle 11g)上执行此查询时,它要求&naseeha的替换值。如何防止这种情况?

  2. 它也给了我一个错误

    Error report:
    SQL Error: ORA-01843: not a valid month
    01843. 00000 -  "not a valid month"
    
  3. 上面给出的查询是我使用SQL Developer从我之前安装的Oracle 11g导入的SQL文件的一部分(我们在安装Oracle 11g时得到的,我认为这是版本1)。

    所有插入查询都给出了相同的错误(编号2)。

1 个答案:

答案 0 :(得分:2)

  1. 参考How to insert a string which contains an "&",这应该有效:

    SET DEFINE OFF
    
  2. 尝试替换所有出现的

    'DD-MON-RR HH.MI.SSXFF AM'
    

    'yyyy-mm-dd hh24:mi:ss.ff3'