Home » SQL & PL/SQL » SQL & PL/SQL » how to insert timestamp
how to insert timestamp [message #226336] Fri, 23 March 2007 05:01 Go to next message
ncst_sanjay
Messages: 2
Registered: February 2007
Junior Member
hello,

I am inserting timestamp in variable v
v := to_timestamp ( 2006 || '-' || 12 || '-01' , 'yyyy-mm-dd' ) ;
and when i am printing v it is showing following timestamp
01-DEC-06 12.00.00.000000 AM

now i want to insert this timestamp in another timestamp field
as
insert into ABC ( field_name)
values( v);

but it showing following error ORA-01843: not a valid month

Please help me in this that how can i insert this value.

Thanks
Amit
Re: how to insert timestamp [message #226338 is a reply to message #226336] Fri, 23 March 2007 05:06 Go to previous messageGo to next message
Michel Cadot
Messages: 64119
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
SQL> create table abc (field_name timestamp);

Table created.

SQL> declare
  2    v timestamp := to_timestamp ( 2006 || '-' || 12 || '-01' , 'yyyy-mm-dd' ) ;
  3  begin
  4    insert into ABC ( field_name)
  5    values( v);
  6  end;
  7  /

PL/SQL procedure successfully completed.

This works but of course you surely did something else you didn't tell us.

Regards
Michel
Re: how to insert timestamp [message #226344 is a reply to message #226338] Fri, 23 March 2007 05:35 Go to previous message
ncst_sanjay
Messages: 2
Registered: February 2007
Junior Member


Thanks Michel,


The error was in other timestamp field of same tbale.

Thanks again
Amit
Previous Topic: extract second (or earlier) value from dense_rank
Next Topic: First Row of a Sub Table
Goto Forum:
  


Current Time: Tue Dec 06 06:32:30 CST 2016

Total time taken to generate the page: 0.17569 seconds