Oracle Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesOracle Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
1200+ fellow developers rate and compare features of the top IDEs, like Visual Studio, Eclipse, RAD, Delphi and others, across 13 categories. Enjoy this FREE Download of the IDE User Satisfaction Study by Evans Data Corporation. Download Now!
  #1  
Old April 29th, 2004, 01:12 AM
macuser55 macuser55 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Posts: 19 macuser55 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Wink Simple question - Dates in Oracle

Hello All,

A quick one about dates in Oracle. How do you get an Oracle DBMS to produce a date object when a tuple is created, and place this date in the tuple?

Thanks

Chris

Reply With Quote
  #2  
Old April 29th, 2004, 01:41 PM
shafique shafique is offline
Senior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Location: Canada
Posts: 305 shafique User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 45 m 20 sec
Reputation Power: 5
The date function SYSDATE returns the current system date and time, You can use it in any DML or DDL operation, some examples are given below:

CREATE TABLE myemp
(EMPNO number(5),
ENAME varchar2(25),
HIREDATE date DEFAULT SYSDATE NOT NULL,
SAL number(5))
/

INSERT INTO myemp (empno,ename,sal) VALUES (10908,'Smith',2300)
/

System date will be automatically inserted into the above tuple because hiredate has default value SYSDATE.

DECLARE
p_hiredate date:=SYSDATE; //assigning System date to a variable.
........
........
........
BEGIN

DBMS_OUTPUT.PUT_LINE(p_hiredate);

........
........

END:
/

Regards,

Reply With Quote
  #3  
Old April 30th, 2004, 08:37 PM
macuser55 macuser55 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Posts: 19 macuser55 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Cheers

Thanks for that!

Chris

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesOracle Development > Simple question - Dates in Oracle


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway