Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problems whith package dbms_crypto_toolkit

Status
Not open for further replies.

silvia23

Technical User
May 22, 2003
26
0
0
ES
Hello!!!
I've executed the follow scripts as sys user to install the package cbms_crypto_toolkit:

1. utlraw.sql
2. prvtrawb.plb
3. dbmsoctk.sql
4. prvtoctk.plb
5. dbmsrand.sql

and without problems.

Now, I want to insert some values at a table and when the id value was null I've created a trigger and an auxiliar function to assign a random value, the code of both of then is:

create sequence IdCodeSeq;

create or replace function GeneraCodigo
return integer as
code INTEGER;
num INTEGER;
seed BINARY_INTEGER;
begin
SELECT IdCodeSeq.NextVal INTO seed FROM Dual;
dbms_random.initialize(seed*1000);
code := dbms_random.random;
SELECT Count(*) into num FROM Tabla WHERE ID=code;
while num=0 LOOP
code := dbms_random.random;
select count(*) into num from Tabla where ID =code;
end loop;
dbms_random.terminate;
RETURN code;
end;

/

create or replace trigger BITabla
before insert on Tabla for each row
begin
if :new.Id is null then
:new.Id := GeneraCodigo;
end if;
end;
/

And the error message is as follow:
SQL> insert into tabla values(null);
insert into tabla values(null)
*
ERROR en línea 1:
ORA-06521: PL/SQL: Error al crear la correspondencia de la función
ORA-06512: en "USERP.DBMS_CRYPTO_TOOLKIT", línea 23
ORA-06512: en "USERP.DBMS_CRYPTO_TOOLKIT", línea 962
ORA-06512: en "USERP.DBMS_RANDOM", línea 15
ORA-06512: en "USERP.GENERACODIGO", línea 9
ORA-06512: en "USERP.BITABLA", línea 4
ORA-04088: error durante la ejecución del disparador 'USERP.BITABLA'

where UserP is an user with dba role assigned.

What am I doing in a bad way?¿
Thanks a lot of for your cooperation and sorry about my english,
Silvia
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top