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: dbms_crypto_toolkit error

Re: dbms_crypto_toolkit error

From: Yass Khogaly <ykhogaly_at_us.oracle.com>
Date: Fri, 10 Sep 1999 14:57:51 -0700
Message-ID: <7rbr5g$p3v$1@inet16.us.oracle.com>


Please follow those steps "TO GENERATE RANDOM NUMBERS"

  1. 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 - 16:57:51 CDT

Original text of this message

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