Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Help writing SQL query
"Tony Cantara" <tonycantara123_at_hotmail.com> wrote
> Mike, I think you have solved the approach. I couldn't fathom how to
> get around the 'loop' problem with the CONNECT BY PRIOR clause until
> seeing your code. All I have to do now is code the routines in a
> generic sense (another table with shape connectivities that may want
> to search for) so that I can, arbitrarly, count the number of
> triangles, rectangles, pentagons, shapes with triangles and rectangles
> in them, shapes with rectangles and only one triangles but no
> pentagons ...
If you want to count the exact number of triangles in a given shape, you are
facing the problem of counting the same triangle twice (actually three or
six times). The triangle 1231 can be "discovered" as:
1231
2312
3123,
and if you add both of the touples also as:
1321
3213
2132
So, you'll have to divide the number of "discovered" triangles by either 3 (if you find the correct way of representing shapes like the one in my previous post) or by 6 (if you are inserting both touples).
Regards & happy coding,
Damjan
Received on Wed Nov 20 2002 - 14:22:20 CST