Re: dbms_crypto_toolkit error
Date: 1999/09/10
Message-ID: <7rbr5g$p3v$1_at_inet16.us.oracle.com>#1/1
Please follow those steps "TO GENERATE RANDOM NUMBERS"
- Initialize random number generator with seed. The seed should be at least 5 digits according to the package comments to ensure randomness.
Example:
SQL> exec dbms_random.initialize (12345);
PL/SQL procedure successfully completed.
2. Generate random number.
Example 1:
SQL> set serveroutput on
SQL> declare
2 random_number binary_integer;
3 begin
4 random_number := dbms_random.random;
5 dbms_output.put_line(to_char(random_number));
6 end;
7 /
2116177396
PL/SQL procedure successfully completed.
Example 2: (from Oracle Cryptographic Toolkit
Programmer's Guide Rel 2.0.4)
DECLARE
i BINARY_INTEGER;
BEGIN
dbms_random.initialize(19254);
i := dbms_random.random;
INSERT INTO some_table VALUES(i);
dbms_random.terminate;
END;
3. Terminate the random number generator to release memory.
Example:
SQL> exec dbms_random.terminate;
PL/SQL procedure successfully completed.
4. Change the random number generator seed after initial
initialization.
Example:
SQL> exec dbms_random.seed (12346);
PL/SQL procedure successfully completed.
5. Warnings
If dbms_random.terminate has been executed after
dbms_random.random was successful, then subsequent
executions of dbms_random.random may return neither
a result or an error. If dbms_random.random is run
before executing dbms_random.initialize then an
exception will be raise and "ORA-06510: PL/SQL:
unhandled user-defined exception results if the
exception is not handled in the pl/sql block. It is
not currently possible to use the return value of the
random function directly in a SQL statement.
Example:
SQL> exec dbms_random.initialize (12345);
PL/SQL procedure successfully completed.
SQL> insert into x values(dbms_random.random);
insert into x values(dbms_random.random)
*
ERROR at line 1:
ORA-06571: Function RANDOM does not guarantee
not to update the database.
Regards
"The Views expressed here are my own and not necessarily those of Oracle Corporation"
S Schaber <sschaber_at_yahoo.com> wrote in message
news:37D6A602.BD6E7A9_at_yahoo.com...
>
> Env: Oracle 8.0.5.1 on solaris
>
> I'm trying to use dbms_crypto_toolkit package
> to encrypt strings. It gives this error:
>
> declare
> *
> ERROR at line 1:
> ORA-06550: line 10, column 11:
> PLS-00307: too many declarations of 'ENCRYPT' match this call
> ORA-06550: line 10, column 3:
> PL/SQL: Statement ignored
>
> My code is:
>
> declare
> ps dbms_crypto_toolkit.Persona := null;
> i number;
> str1 varchar2(1000);
> begin
> dbms_crypto_toolkit.Initialize;
> dbms_crypto_toolkit.CreatePersona(dbms_crypto_toolkit.MD5,
> null, 'aaa', 'aaa', 'aaa', ps);
> str1 := 'aaa';
> str1 := dbms_crypto_toolkit.Encrypt(ps, str1);
> dbms_crypto_toolkit.Terminate;
>
> end;
> /
>
>
Received on Fri Sep 10 1999 - 00:00:00 CEST
