添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
相关文章推荐
玩手机的啄木鸟  ·  Number of labels is ...·  2 月前    · 
考研的丝瓜  ·  istio proxy ...·  3 月前    · 
悲伤的拐杖  ·  python ...·  10 月前    · 

Timestamp with Timezone conversion -- not a valid month error

sgudipudi Aug 31 2017 — edited Sep 1 2017

DB version:

Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production

PL/SQL Release 11.2.0.4.0 - Production

"CORE 11.2.0.4.0 Production"

TNS for Linux: Version 11.2.0.4.0 - Production

NLSRTL Version 11.2.0.4.0 - Production

SQL:

create table test1(col1 timestamp with time zone);

create or replace trigger test1_biu

BEFORE INSERT OR UPDATE

ON test1

FOR EACH ROW

BEGIN

:new.col1      := FROM_TZ(TO_TIMESTAMP(:new.col1, 'YYYY-MM-DD"T"HH24:MI:SS"Z"'),'UTC');

END;

/

insert into test1 values('2009-10-14T00:00:00Z');

Error report -

SQL Error: ORA-01843: not a valid month

01843. 00000 -  "not a valid month"

*Cause:   

*Action:

I am getting the above error when i try to insert the row to the table. However below SQL working exactly as expected. Tried in both TOAD and SQL Developer tools. Getting same error. My observation is trigger is not even firing.

select FROM_TZ(TO_TIMESTAMP('2009-10-14T00:00:00Z', 'YYYY-MM-DD"T"HH24:MI:SS"Z"'),'UTC') col1 from dual;

create or replace trigger test1_biu

BEFORE INSERT OR UPDATE

ON test1

FOR EACH ROW

BEGIN

raise_application_error(-20001,'Trigger Fired');

END;

/

insert into test1 values('2009-10-14T00:00:00Z');

Error report -

SQL Error: ORA-01843: not a valid month

01843. 00000 -  "not a valid month"

*Cause:   

*Action:

Failing server validation for data type conversion errors?Can some one throw some light?

Thanks!

Jump to Answer