1,105,534 Community Members

Data type time in oracle sql

Member Avatar
rugged1529
Newbie Poster
10 posts since Oct 2011
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

I'm trying to create a table in oracle here's the code

drop table class;

create table class
	(schedule_num		integer primary key not null, 
	 semester		varchar(10), 
	 course_name		varchar(14),
	 credit			int,
	 department		varchar(15),
	/* meeting_time		time,*/
	 meeting_place 		varchar(20),
	 enrollment_limit	int);

I don't how to initiate the 'time' data-type, can someone help. The time is as in what time something starts. Example: the meeting starts at 9:00. I need to keyword and syntax.

Member Avatar
Jx_Man
Senior Poster
3,543 posts since Nov 2007
Reputation Points: 987 [?]
Q&As Helped to Solve: 542 [?]
Skill Endorsements: 74 [?]
Featured
 
0
 

Still use 'DATE', Date also save the time.

create table class
	(schedule_num		integer primary key not null, 
	 semester		varchar(10), 
	 course_name		varchar(14),
	 credit			int,
	 department		varchar(15),
	 meeting_time		DATE,
	 meeting_place 		varchar(20),
	 enrollment_limit	int);

Example :

select to_char(meeting_time,'HH24:MI:SS') from class
Member Avatar
hfx642
Posting Pro
515 posts since Nov 2009
Reputation Points: 164 [?]
Q&As Helped to Solve: 105 [?]
Skill Endorsements: 1 [?]
 
0
 

Also... Stick with the basic datatypes; VarChar2, Number, and Date.
It just makes things easier.

You
This article has been dead for over three months: Start a new discussion instead
Post:
Start New Discussion
View similar articles that have also been tagged: