Unix Technical Forum

Inserting Milliseconds into table

This is a discussion on Inserting Milliseconds into table within the Oracle Miscellaneous forums, part of the Oracle Database category; --> Hi How do use insert statements to insert millisecs into an oracle table? CREATE TABLE [dbo].[script] ( [scriptid] numeric(20,0) ...


Go Back   Unix Technical Forum > Database Server Software > Oracle Database > Oracle Miscellaneous

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-08-2008, 09:04 AM
paulspratley@yahoo.co.uk
 
Posts: n/a
Default Inserting Milliseconds into table

Hi

How do use insert statements to insert millisecs into an oracle table?

CREATE TABLE [dbo].[script] (
[scriptid] numeric(20,0) NOT NULL,
[creationdate] datetime NOT NULL,
CONSTRAINT [PK_script] PRIMARY KEY([scriptid])
)
GO

I have tried:
INSERT INTO script(scriptid, creationdate)
VALUES(0, to_date('20060321 12:00:01.001','YYYYMMDD HH:mi:ss.ms'))

but get the error
>[Error] Script lines: 1-2 --------------------------

ORA-01821: date format not recognized 

and

INSERT INTO script(scriptid, creationdate)
VALUES(0, to_date('20060321 12:00:01.001','YYYYMMDD HH:mi:ss'))
but get the error
>[Error] Script lines: 1-2 --------------------------

ORA-01830: date format picture ends before converting entire input
string 

Thanks for the help!

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-08-2008, 09:04 AM
paulspratley@yahoo.co.uk
 
Posts: n/a
Default Re: Inserting Milliseconds into table

I have now released that datetime does not hold milliseconds and I need
to use timestamp instead.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-08-2008, 09:04 AM
Vladimir M. Zakharychev
 
Posts: n/a
Default Re: Inserting Milliseconds into table



>How do use insert statements to insert millisecs into an oracle table?
>
>CREATE TABLE [dbo].[script] (
> [scriptid] numeric(20,0) NOT NULL,
> [creationdate] datetime NOT NULL,
> CONSTRAINT [PK_script] PRIMARY KEY([scriptid])
>)
>GO


Doesn't seem like Oracle syntax to me. It's MS SQL Server or am
I drinking too much coffee lately?

Anyway, you need to use TIMESTAMP datatype if you want
milliseconds (available in 9i and later.) And format specifier for
milliseconds is FF[precision], so correct format string would be

TO_TIMESTAMP('....','YYYYMMDD HH24:MI:SS.FF3')

Hth,
Vladimir M. Zakharychev
N-Networks, makers of Dynamic PSP(tm)
http://www.dynamicpsp.com
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 03:06 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com