Bobak, Mark wrote: > Here it is: [...] > This concludes this public service announcement. We now return > you to our regularly scheduled programming.
Interesting. PL/SQL recursive solutions are expensive, though. :) Did not check it, maybe something alike was posted already...
SET VERIFY OFF PAGES 200 DEFINE disks=7 REM Please do not use all_objects :) DEFINE big_table=all_objects COLUMN "Implementation Plan" FORMAT A20 SPOOL hanoi_solution.txt SELECT 'Move it from ' || TO_CHAR(MOD(BITAND(ROWNUM, ROWNUM - 1), 3) + 1) || ' to ' || TO_CHAR(MOD(-BITAND(-ROWNUM - 1, -ROWNUM), 3) + 1) AS "Implementation Plan" FROM &&big_table WHERE ROWNUM < POWER(2, &&disks) AND &&disks < 8 / SPOOL OFF
Should work correctly.
Regards, -- Vladimir Begun The statements and opinions expressed here are my own and do not necessarily represent those of Oracle Corporation.
-- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Vladimir Begun INET: [EMAIL PROTECTED]
Fat City Network Services -- 858-538-5051 http://www.fatcity.com San Diego, California -- Mailing list and web hosting services --------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).