|
|
|
Re: what is the size of date datatype? [message #267382 is a reply to message #267378] |
Thu, 13 September 2007 02:29   |
Frank
Messages: 7901 Registered: March 2000
|
Senior Member |
|
|
SQL> select vsize(hiredate) from emp;
VSIZE(HIREDATE)
---------------
7
There was a post about 1 week ago regarding the difference in size between sysdate and a date column.
Remember sysdate is NOT a date column stored in a table.
|
|
|
|
Re: what is the size of date datatype? [message #267385 is a reply to message #267383] |
Thu, 13 September 2007 02:52   |
Frank
Messages: 7901 Registered: March 2000
|
Senior Member |
|
|
And that is not a column-size in a table either.
Like I said, there was a discussion about this difference a while ago. If you had taken the trouble of searching for it, you would have found it, like I did.
|
|
|
|
Re: what is the size of date datatype? [message #267396 is a reply to message #267386] |
Thu, 13 September 2007 03:27   |
JRowbottom
Messages: 5933 Registered: June 2006 Location: Sunny North Yorkshire, ho...
|
Senior Member |
|
|
If you do a bit of digging, you;ll find that the entries with a length of 8 are columns in system views. These columns are all TO_DATE functions on other values, so I they aren't DATE columns in the database either.
|
|
|
Re: what is the size of date datatype? [message #267549 is a reply to message #267383] |
Thu, 13 September 2007 12:36   |
joy_division
Messages: 4963 Registered: February 2005 Location: East Coast USA
|
Senior Member |
|
|
muzahidul islam wrote on Thu, 13 September 2007 03:36 |
select vsize(to_date('01-jan-2007')) from dual
This also return 8.
|
You still haven't learned about DATEs yet? What is so hard to understand? Your query is invalid. Please read up on the TO_DATE function.
FOO SCOTT>select vsize(to_date('01-jan-2007')) from dual;
select vsize(to_date('01-jan-2007')) from dual
*
ERROR at line 1:
ORA-01858: a non-numeric character was found where a numeric was expected
|
|
|
Re: what is the size of date datatype? [message #267679 is a reply to message #267369] |
Fri, 14 September 2007 04:08   |
scorpio_biker
Messages: 154 Registered: November 2005 Location: Kent, England
|
Senior Member |
|
|
joy_division -
Forgive me for being a bit thick - but I went away and read about the to_date function and most sites I found just mention the standard functionality of to_date(string,format).
Do you have a link to explain why your go at that to_date didn't work - or a search term I can use?
Thanks
|
|
|
|
|
Re: what is the size of date datatype? [message #267685 is a reply to message #267378] |
Fri, 14 September 2007 04:40   |
JRowbottom
Messages: 5933 Registered: June 2006 Location: Sunny North Yorkshire, ho...
|
Senior Member |
|
|
muzahidul islam wrote on Thu, 13 September 2007 03:36 Quote: | select vsize(to_date('01-jan-2007')) from dual
This also return 8.
|
Actually, I think you're wrong about that and about the size of sysdate:
1* select vsize(to_date('01-jan-2007','dd-mon-yyyy')) from dual
SQL> /
VSIZE(TO_DATE('01-JAN-2007','DD-MON-YYYY'))
-------------------------------------------
7
SQL> ed
Wrote file afiedt.buf
1* select vsize(sysdate) from dual
SQL> /
VSIZE(SYSDATE)
--------------
7
|
|
|
|
|
|
Re: what is the size of date datatype? [message #267782 is a reply to message #267549] |
Fri, 14 September 2007 21:52   |
muzahid
Messages: 281 Registered: September 2004 Location: Dhaka, Bangladesh
|
Senior Member |
|
|
joy_division wrote on Thu, 13 September 2007 12:36 | muzahidul islam wrote on Thu, 13 September 2007 03:36 |
select vsize(to_date('01-jan-2007')) from dual
This also return 8.
|
You still haven't learned about DATEs yet? What is so hard to understand? Your query is invalid. Please read up on the TO_DATE function.
FOO SCOTT>select vsize(to_date('01-jan-2007')) from dual;
select vsize(to_date('01-jan-2007')) from dual
*
ERROR at line 1:
ORA-01858: a non-numeric character was found where a numeric was expected
|
But i get result by executing that query
Connected to:
Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.1.0 - Production
SQL> select to_date('01-jan-2007') from dual;
TO_DATE('
---------
01-JAN-07
SQL> select vsize(to_date('01-jan-2007')) from dual;
VSIZE(TO_DATE('01-JAN-2007'))
-----------------------------
8
If we follow the link
http://download.oracle.com/docs/cd/B10501_01/server.920/a96540/functions137a.htm
Then we can find the following sentence from that document.
Quote: |
TO_DATE converts char of CHAR, VARCHAR2, NCHAR, or NVARCHAR2 datatype to a value of DATE datatype.
The fmt is a date format specifying the format of char. If you omit fmt, then char must be in the default date format.
|
|
|
|
Re: what is the size of date datatype? [message #267785 is a reply to message #267782] |
Sat, 15 September 2007 00:21   |
pablolee
Messages: 2882 Registered: May 2007 Location: Scotland
|
Senior Member |
|
|
You certainly can ignore the advice of pretty much every single expert on this forum if you want to. You can also cross a motorway whilst blindfolded. Neither seems like a good idea to me. Picture the scene. You write all of your code, ignoring the simple and oft repeated expert advice to use to_date and the appropriate format model for the string. This amounts to several hundred packages, procedures, functions, statements embedded within your application code, text files holding useful scripts et al. For some reason, the business decides to change the default format of the system (say, to match up to the format of the company that has just bought you over) Now every single piece of code that you wrote that involved these strings (the ones that you seem to think are dates) no longer works. Have fun explaining to your new bosses why this is, when all you had to do was follow a simple piece of advice.
|
|
|
|
|
|
|
Re: what is the size of date datatype? [message #267792 is a reply to message #267790] |
Sat, 15 September 2007 00:50   |
Frank
Messages: 7901 Registered: March 2000
|
Senior Member |
|
|
These types of jewels should be stores somewhere central, so everyone should come across it sooner or later.
I bet you that once you read this, you will be bound to remember.
This explanation/warning falls in the same 'remembrance'-league as the 'pick the first from a bag of balls' Ana came up with. (and I borrowed when appropriate).
|
|
|
|
|
|