Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: Hotsos Symposium, Day 1
Tom,
Agreed. Strictly speaking it isn't necessary, this works as well:
with x as (
SELECT TRUNC(SYSDATE,'YEAR') + LEVEL - 1
FROM DUAL
CONNECT BY LEVEL < TRUNC(SYSDATE+366,'YEAR') - TRUNC(SYSDATE,'YEAR') + 1
)
select * from x;
not sure why it's there...
-----Original Message-----
From: oracle-l-bounce_at_freelists.org
[mailto:oracle-l-bounce_at_freelists.org] On Behalf Of Thomas Day
Sent: Tuesday, March 08, 2005 12:31 PM
To: oracle-l_at_freelists.org
Subject: Re: Hotsos Symposium, Day 1
I guess that what I don't understand is why the 1=3D1 is in there at all. The following produces 365 rows of output for me. Does the 1=3D1 perform a useful function? I understand that it evaluates as true. I don't understand why you feel it's needed.
SELECT TRUNC(SYSDATE,'YEAR') + LEVEL - 1
FROM (SELECT 'X' FROM DUAL WHERE rownum =3D 1)
CONNECT BY
--1 =3D 1 AND
LEVEL < TRUNC(SYSDATE+366,'YEAR') - TRUNC(SYSDATE,'YEAR') + 1
/
--
http://www.freelists.org/webpage/oracle-l
--
http://www.freelists.org/webpage/oracle-l
Received on Tue Mar 08 2005 - 13:46:53 CST