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:
  #1  
Old March 6th, 2005, 10:22 AM
paulh1983 paulh1983 is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Dec 2004
Posts: 1,239 paulh1983 User rank is Sergeant (500 - 2000 Reputation Level)paulh1983 User rank is Sergeant (500 - 2000 Reputation Level)paulh1983 User rank is Sergeant (500 - 2000 Reputation Level)paulh1983 User rank is Sergeant (500 - 2000 Reputation Level)paulh1983 User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 1 Week 1 Day 12 h 25 m 28 sec
Reputation Power: 17
returns year as 4 instead of 2004! and phone number

This returns a single number 4, instead of 2004!
select to_number(to_char(to_date(enrolment_date, 'DD-MM-YYYY'), 'YYYY')) into Y from students;


and when i insert a phone number it is something like "020..." but the sql trims off the leading 0, how can i avoid it?

Last edited by paulh1983 : March 6th, 2005 at 10:26 AM.

Reply With Quote
  #2  
Old March 7th, 2005, 07:09 AM
suresh1977 suresh1977 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2005
Posts: 13 suresh1977 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 16 m 57 sec
Reputation Power: 0
Change the Query as
select to_number(to_char(to_date(enrolment_date, 'DD-MM-YY'), 'YYYY')) into Y from students;

This should work for you.
For inserting Phone no. Keep your data type for this column as either Char or varchar(2).

Reply With Quote
  #3  
Old March 8th, 2005, 02:05 PM
paulh1983 paulh1983 is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Dec 2004
Posts: 1,239 paulh1983 User rank is Sergeant (500 - 2000 Reputation Level)paulh1983 User rank is Sergeant (500 - 2000 Reputation Level)paulh1983 User rank is Sergeant (500 - 2000 Reputation Level)paulh1983 User rank is Sergeant (500 - 2000 Reputation Level)paulh1983 User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 1 Week 1 Day 12 h 25 m 28 sec
Reputation Power: 17
thanks

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesOracle Development > returns year as 4 instead of 2004! and phone number


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 5 hosted by Hostway