insert statement using current date column value

I'm getting the following error while running this statement. I need to insert date functions in the columns. Any idea on this will be really helpful.

Error message:

Error - ORA-20000: ORA-01843: not a valid month at pos 504 : TO_CHAR((LAST_DAY(ADD_MONTHS(sysdate, -1))),'DD/MM/YYYY')

Data Type: data type for ATT3 is DATE(7), ATT1 and ATT2 is VARCHAR2(400)

Query:

insert into ABC (X, Y, Z, ATT1, ATT2, ATT3)
VALUES ('G', 'H', 'I',
        TO_CHAR(LAST_DAY(ADD_MONTHS(sysdate, -1)),'Mon DD YYYY HH:MI AM'),
        TO_CHAR(sysdate, 'Mon D YYYY HH:MI AM'),
        TO_CHAR((LAST_DAY(ADD_MONTHS(sysdate, -1))),'DD/MM/YYYY'));

TO_CHAR(sysdate, 'Mon D YYYY HH:MI AM') will give incorrect result. You need to change it to TO_CHAR(sysdate, 'Mon DD YYYY HH:MI AM') .

Please paste the structure of the table with the data types.

链接地址: http://www.djcxy.com/p/36960.html

上一篇: 在oracle 10g sql plus中插入日期和时间到时间戳中

下一篇: 使用当前日期列值插入语句