Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: SQL Serious Challenge # 1 - Probably Not Much Fun
"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