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

Home -> Community -> Usenet -> c.d.o.server -> Re: SQL Serious Challenge # 1 - Probably Not Much Fun

Re: SQL Serious Challenge # 1 - Probably Not Much Fun

From: Anurag Varma <avdbi_at_hotmail.com>
Date: Sun, 14 Mar 2004 19:30:10 GMT
Message-ID: <6p25c.5280$1g2.2792@nwrdny02.gnilink.net>

"Michel Cadot" <micadot{at}altern{dot}org> wrote in message news:40545c28$0$277$626a14ce_at_news.free.fr... --snip--
> Thanks to Nuno "dirty" reverse way, here my "definitive" solution;
> only in SQL, works from 8i:
>
> SQL> select /*+ NO_MERGE(v) */ name,
> 2 dbms_random.string('U',bef)||
> 3 decode(round(dbms_random.value),0,name,
> 4 substr(name,8,1)||substr(name,7,1)||substr(name,6,1)||
> 5 substr(name,5,1)||substr(name,4,1)||substr(name,3,1)||
> 6 substr(name,2,1)||substr(name,1,1))||
> 7 dbms_random.string('U',15/*line_lg*/-bef-lg) res
> 8 from ( select id, name, length(name) lg,
> 9 round(dbms_random.value*(15/*line_lg*/-length(name))) bef
> 10 from ( select round(dbms_random.value(1,213/*words_nb*/)) nb
> 11 from (Select 1 from dual group by cube(1,2,3,4))
> 12 where rownum <= 15 /*lines_nb*/ ),
> 13 name
> 14 where id = nb ) v
> 15 order by dbms_random.value
> 16 /
>
> NAME RES
> -------------------- --------------------
> DANIELLE MZDBELLEINADBBZ
> ANAIS EQMANAISYKIFZCS
> SYLVIA EKXPZAIVLYSDTAF
> ALEXIS YKDYALEXISLAKEB
> YANIS AFCAZMTRDSINAYM
> AMBRE LAMBREEWECPCNNN
> MARLEY YYZLGYELRAMKBFE
> MAEL LXEAXLLEAMBQCRE
> THEO TZNNKVPHSFTHEON
> MAITENA NEMZMAITENAIHBZ
> LEYNA TRLEYNASCGLIDRD
> MELISSA ALZQMELISSABDKI
> FRANCE MLXSMIECNARFDRV
> MARGAUX ACQCCREXUAGRAMF
> BERKANT CLUXBERKANTJEZU
>
> 15 ligne(s) sélectionnée(s).
>
> Next step up/down... :-)
>
> Regards
> Michel Cadot
>
>

Why not use the simple function "reverse". I'm not sure .. but I think thats what oracle uses to build the reverse key indexes...

select reverse('ABCD') from dual;

Anurag Received on Sun Mar 14 2004 - 13:30:10 CST

Original text of this message

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