Re: Hotsos Symposium, Day 1

Thomas

I believe, the point here is as follows the view like this:

CREATE VIEW pivot
AS
   SELECT ROWNUM rn FROM dual CONNECT BY 1 = 1
/

OR

WITH pivot AS (
   SELECT ROWNUM rn FROM dual CONNECT BY 1 = 1
)
SELECT * FROM pivot
/

Would be an "*endless*" row source. You can put any condition
that is true-evaluated -- there should be just something,
otherwise it won't be possible to run hierarchical query.

LEVEL there is used to limit the number of returned rows,
in case one would like to limit he/she can use LEVEL w/o
extra 'true' condition 1 = 1 or dummy = dummy or whatever = whatever.
-- 
Vladimir Begun
The statements and opinions expressed here are my own
and do not necessarily represent those of Oracle.


Thomas Day wrote:
> I guess that what I don't understand is why the 1=1 is in there at
> all.  The following produces 365 rows of output for me.  Does the 1=1
> 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 = 1)
>  CONNECT BY
> --1 = 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

Other related posts: