Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Re: A brief detour....;-)

Re: A brief detour....;-)

From: Vladimir Begun <Vladimir.Begun_at_oracle.com>
Date: Mon, 08 Dec 2003 17:19:25 -0800
Message-ID: <F001.005D9354.20031208171925@fatcity.com>


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: Vladimir.Begun_at_oracle.com

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: ListGuru_at_fatcity.com (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).
Received on Mon Dec 08 2003 - 19:19:25 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US