472,351 Members | 1,538 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,351 software developers and data experts.

Time datatype in Oracle Database

Hi Guys,

I have a table where I where I can enter date in HH:MM format.

I have already created the table as:

Expand|Select|Wrap|Line Numbers
  1. CREATE TABLE "test"."SLA"
  2.   (
  3.     "SLAID"    NUMBER(10,0) NOT NULL ENABLE,
  4.     "SLALEVEL" VARCHAR2(200 BYTE) NOT NULL ENABLE,
  5.     "WEEKDAY_START_TIME" TIMESTAMP (6),
  6.     "WEEKDAY_END_TIME" TIMESTAMP (6),
  7.     "WEEKEND_START_TIME" TIMESTAMP (6),
  8.     "WEEKEND_END_TIME" TIMESTAMP (6),
  9.   )
  10.  

How can I format the TIMESTAMP datatype so I can enter values like 23:45 or 11:55 etc?

Currently if I try to do so I get the error:

Row 1: ORA-01847: day of month must be between 1 and last day of month
ORA-06512: at line 1



I have tried declaring them as:

Expand|Select|Wrap|Line Numbers
  1. "WEEKDAY_START_TIME" TIMESTAMP 'HH24:MM'
  2.  
with no luck. Any help will be appreciated.

Thanks.
Nov 21 '11 #1

✓ answered by rski

Well I think Oracle has not any datatype for storing only hours and minutes. When you use timestamp date also will be stored.

3 2879
rski
700 Expert 512MB
What do you mean
How can I format the TIMESTAMP datatype so I can enter values like 23:45 or 11:55 etc?
What do you mean format?

Timestamp is used for storing date with time.
So you can insert value in the following way
Expand|Select|Wrap|Line Numbers
  1. insert into table values(to_timestamp('23:40','HH24:Mi'))
  2.  
Nov 21 '11 #2
Well I was using Oracle SQL developer to enter values (not using the INSERT query) manually in a data entry table just like in a spreadsheet.

And I get the error why I try to commit the changes:

Row 1: ORA-01847: day of month must be between 1 and last day of month
ORA-06512: at line 1


By formatting I meant tweaking the TIMESTAMP datatype in ALTER TABLE statement in such a way so I can enter the values without the above error.

Something like this (just as example, I know this is wrong)

Expand|Select|Wrap|Line Numbers
  1. ALTER TABLE
  2. MODIFY column_1 TIMESTAMP='HH24:MM'
  3.  
Something like that or any other Datatype that can solve this problem.


Many thanks. But I guess INSERT statement is one way around it.
Nov 21 '11 #3
rski
700 Expert 512MB
Well I think Oracle has not any datatype for storing only hours and minutes. When you use timestamp date also will be stored.
Nov 21 '11 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: f | last post by:
Anyone has an idea how much oracle database costs for academic? Thanks, ff
0
by: antonyliu2002 | last post by:
I am having a hard time connecting to an oracle database from within Visual Web Developer (VWD) 2005 Express Edition. Check out the screen snap...
4
by: =?Utf-8?B?U3RlcGhhbmllIERvaGVydHk=?= | last post by:
I am trying to connect to an Oracle 10.2 database with vb.net and am getting the error: ORA-1215: TNS:could not resolve service name My...
10
by: Reedsp | last post by:
Version: MSAccess 2003 SP2 Explination: I have a database that connects to an oracle database. I have setup an ODBC connection under the System...
1
by: ananth | last post by:
Hi All, I have a java code that retrievies values from a table in a oracle database. There are more than 100 columns and 100000 records...
3
by: vikas000000a | last post by:
Hi All, I am new to this forum as far as posting a question is concerned, although I have quite frequently visiting this site as a guest. My...
1
by: rohitsingh0000 | last post by:
hi, i want to import the tables of a oracle database into the sql database.but i am getting errors importing some tables with certain coulms.so far...
0
by: Jack | last post by:
Training Classes for Oracle10g, 9i, 8i Certification training in Oracle10g and 9i: DBA, Developer, Discoverer. training conducted at your location...
0
by: Winder | last post by:
Training Classes for Oracle10g, 9i, 8i Certification training in Oracle10g and 9i: DBA, Developer, Discoverer. training conducted at your location...
23
by: Gloops | last post by:
Hello everybody, Is anyone able to give me some indications about how to develop an Access interface for an Oracle database ? I dispose of...
0
better678
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
0
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
1
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
0
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.