Title: RE: SQL Brain Teaser Challenge

Steve,
I did try it ...

oraclei@rhea-ACPT1> sys

SQL*Plus: Release 9.2.0.1.0 - Production on Tue Nov 5 14:18:02 2002
Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.
Connected.
SQL> conn system
Enter password:
Connected.
SQL> SELECT *
  FROM (SELECT * FROM treenode ORDER BY parentid, nodeorder)
START WITH parentid=0
CONNECT BY PRIOR ID = parentid
SQL> /

        ID   PARENTID  NODEORDER DESCRIPTION
---------- ---------- ---------- --------------------
         1          0          0 top folder
         9          1          0 1st subfolder
         2          1          1 2nd subfolder
         4          2          1 folder 2 item 1
         3          2          2 folder 2 item 2
         6          2          3 folder 2 item 3
         7          1          2 3rd subfolder
         5          7          0 folder 3 item 1
         8          7          1 folder 3 item 2

9 rows selected.


Raj
______________________________________________________
Rajendra Jamadagni              MIS, ESPN Inc.
Rajendra dot Jamadagni at ESPN dot com
Any opinion expressed here is personal and doesn't reflect that of ESPN Inc.
QOTD: Any clod can have facts, but having an opinion is an art!


-----Original Message-----
From: Orr, Steve [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, November 05, 2002 2:15 PM
To: Jamadagni, Rajendra; '[EMAIL PROTECTED]'
Subject: RE: SQL Brain Teaser Challenge


Nope...

SQL> l
  1  SELECT *
  2    FROM (SELECT * FROM treenode ORDER BY parentid, nodeorder)
  3  START WITH parentid=0
  4* CONNECT BY PRIOR ID = parentid
SQL> /
  FROM (SELECT * FROM treenode ORDER BY parentid, nodeorder)
                      *
ERROR at line 2:
ORA-01472: cannot use CONNECT BY on view with DISTINCT, GROUP BY, etc.


I supplied the DDL/DML so you could test on your own systems.



-----Original Message-----
From: Jamadagni, Rajendra [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, November 05, 2002 12:07 PM
To: '[EMAIL PROTECTED]'; Orr, Steve
Subject: RE: SQL Brain Teaser Challenge


SELECT *
  FROM (SELECT * FROM treenode ORDER BY parentid, nodeorder)
START WITH parentid=0
CONNECT BY PRIOR ID = parentid
Does this work?
Also see
http://asktom.oracle.com/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:921234804
9
Raj
______________________________________________________
Rajendra Jamadagni              MIS, ESPN Inc.
Rajendra dot Jamadagni at ESPN dot com
Any opinion expressed here is personal and doesn't reflect that of ESPN Inc.

QOTD: Any clod can have facts, but having an opinion is an art!

********************************************************************This e-mail 
message is confidential, intended only for the named recipient(s) above and may 
contain information that is privileged, attorney work product or exempt from 
disclosure under applicable law. If you have received this message in error, or are 
not the named recipient(s), please immediately notify corporate MIS at (860) 766-2000 
and delete this e-mail message from your computer, Thank 
you.*********************************************************************2


Reply via email to