Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Generating characters with SQL
"Vitalo Pedrotti" <vitalisREMOVETHAT_at_numericable.fr> a écrit dans le message de
news:pan.2003.12.08.13.06.36.887251.321_at_numericable.fr...
> Do you know a simple way to generate long strings in SQL? Something like
> the x operator of Perl ('go' x 1000 is 'gogogogogo....')
>
> And even better: how to generate a long *random* string?
>
> TIA
v817> select lpad('GO',10,'GO') from dual;
LPAD('GO',
v817> set serveroutput on
v817> exec dbms_output.put_line(dbms_random.string('X',10));
?=21NJJ;64
Procédure PL/SQL terminée avec succès.
FUNCTION string (opt char, len NUMBER)
/* "opt" specifies that the returned string may contain: 'u','U' : upper case alpha characters only 'l','L' : lower case alpha characters only 'a','A' : alpha characters only (mixed case) 'x','X' : any alpha-numeric characters (upper) 'p','P' : any printable characters */ RETURN VARCHAR2; -- string of <len> characters (max 60)
Hope this helps
Michel Cadot
Received on Mon Dec 08 2003 - 13:20:04 CST