1

我试图将值插入 SURVEY.YSG 表(在插入查询中使用)

INSERT INTO SURVEY.YSG(YSG_ID,YSG_MSN_DTM,TAX_ID,TAX_NM,TYPE_CD,USER_ID,
                       FRST_NM,LAST_NM,SHL_TXT,NPR_DT, PHONE_NBR,FAX_NBR,
                       EMAIL_ADRS_TXT,YSG_IMD,MDFD_ID,YSG_VRFCTN_CD,
                       YSG_VRFCTN_DTM,LOG_KEY,PLS_DTM,LOAD_KEY,UPDTD_LOAD_KEY ) 
   VALUES ( '103','2011-08-11 13:34:36.000000','656002075',
           'STG HEALTH SYSTEM','null','OPLINKS4','UNK','UNK','UNK',
           '12/31/8888','UNK','UNK','UNK','X','UNK','Y','8888-12-31 00:00:00.000000',
           0,'2011-07-20 12:00:00.000000',0,0)

错误报告:SQL 错误:ORA-01843: not a valid month 01843. 00000 - “not a valid month” *原因:
*操作:

以下是表中使用日期和时间戳创建的 4 列SURVEY.YSG

YSG_MSN_DTM - TIMESTAMP(6)

NPR_DT - DATE

YSG_VRFCTN_DTM - TIMESTAMP(6)

PLS_DTM - TIMESTAMP(6)

尝试使用TO_DATE()功能:

TO_DATE('2011-08-11 13:34:36','YYYY-MM-DD HH24:MI:SS')  

得到如下输出:11-AUG-11 01.34.36.000000000 PM.

预期输出:

列:YSG_MSN_DTM->2011-08-11 13:34:36.000000 和列NPR_DT->12/31/8888在另一列中。

有没有其他方法可以在 Oracle 中实现这一目标?

感谢您的任何帮助。

谢谢

4

1 回答 1

1

尝试这个:

INSERT INTO
      SURVEY.YSG ( YSG_ID,
                YSG_MSN_DTM,
                TAX_ID,
                TAX_NM,
                TYPE_CD,
                USER_ID,
                FRST_NM,
                LAST_NM,
                SHL_TXT,
                NPR_DT,
                PHONE_NBR,
                FAX_NBR,
                EMAIL_ADRS_TXT,
                YSG_IMD,
                MDFD_ID,
                YSG_VRFCTN_CD,
                YSG_VRFCTN_DTM,
                LOG_KEY,
                PLS_DTM,
                LOAD_KEY,
                UPDTD_LOAD_KEY )
VALUES
      ( '103',
        TO_TIMESTAMP ( '2011-08-11 13:34:36.000000',
                    'YYYY-MM-DD HH24:MI:SS.FF' ),
        '656002075',
        'STG HEALTH SYSTEM',
        'null',
        'OPLINKS4',
        'UNK',
        'UNK',
        'UNK',
        TO_DATE ( '12/31/8888',
                'MM/DD/YYYY' ),
        'UNK',
        'UNK',
        'UNK',
        'X',
        'UNK',
        'Y',
        TO_TIMESTAMP ( '8888-12-31 00:00:00.000000',
                    'YYYY-MM-DD HH24:MI:SS.FF' ),
        0,
        TO_TIMESTAMP ( '2011-07-20 12:00:00.000000',
                    'YYYY-MM-DD HH24:MI:SS.FF' ),
        0,
        0 );
于 2013-09-17T12:35:30.697 回答