Re: Self documenting program in SQL
From: Nis Jorgensen <nis_at_superlativ.dk>
Date: Sat, 21 May 2005 12:40:36 +0200
Message-ID: <9i3u81lbh7edq5cu6d8tssjcfkng197j7v_at_4ax.com>
Date: Sat, 21 May 2005 12:40:36 +0200
Message-ID: <9i3u81lbh7edq5cu6d8tssjcfkng197j7v_at_4ax.com>
On 20 May 2005 11:42:34 -0700, "Vadim Tropashko" <vadimtro_invalid_at_yahoo.com> 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.
In Postgres:
SELECT substr(source,1,93) || chr(39) || source || chr(39) || substr(source,94) FROM (SELECT 'SELECT substr(source,1,93) || chr(39) || source || chr(39) || substr(source,94) FROM (SELECT ::text as source) q;'::text as source) q;
This should work with slight modifications in other systems.
/Nis
-- Nis Jorgensen Midlertidigt uden ae oe og aa. Jeg beklager.Received on Sat May 21 2005 - 12:40:36 CEST