| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> comp.databases.theory -> Re: Self documenting program in SQL
Vadim Tropashko wrote:
> Did anybody write a query that duplicates itself as an output in SQL
> yet? In the list of languages at
>
> http://www.nyx.net/~gthompso/quine.htm
>
> SQL is absent. No cheating, please, like the one below exploring
> implementation quirks of specific database client program (SQL*Plus):
>
> SQL> SP2-0734: unknown command beginning "SP2-0734: ..." - rest of
line
> ignored.
> SP2-0734: unknown command beginning "SP2-0734: ..." - rest of line
> ignored.
Following steps in the cookbook (well, cookarticle) http://www.cgl.uwaterloo.ca/~csk/washington//paper/toc.html here is some approximation:
select a from (
select sys_connect_by_path('select a from ( select
sys_connect_by_path(', '/')||
sys_connect_by_path('a, level l dual connect by level < 3) where l = 2', '/')
a, level l from dual
connect by level < 3
) where l = 2
;
output
I suspect recursive SQL solution should be cleaner. Received on Fri May 20 2005 - 14:21:54 CDT
![]() |
![]() |