Skip to Main Content
  • Questions
  • dbms_obfuscation_toolkit.DESEncrypt - ORA-06508: PL/SQL: could not find program unit being called

Breadcrumb

Question and Answer

Tom Kyte

Thanks for the question, Prashanth.

Asked: May 25, 2001 - 2:52 am UTC

Last updated: August 14, 2006 - 11:20 am UTC

Version: 8.1.6.0.0

Viewed 1000+ times

You Asked

Hi,

i want to encrypt a few fields in a table. so i am trying to use dbms_obfuscation_toolkit.DESEncrypt in Oracle 8.1.6.0.0
i have writen a small test package to test out the dbms_obfuscation_toolkit.DESEncrypt

i have managed to complie my pacakage successfully. but when i try to exceute my package the excution aborts while trying to call dbms_obfuscation_toolkit.DESEncrypt.

I have excute grant on the dbms_obfuscation_toolkit package and also the public synonym is created.

I even tried executing my test package using the 'SYS' ID of oracle but the same result.

Can any one help me out as to why i am not able to access the dbms_obfuscation_toolkit.DESEncrypt procedure.

i get the error ORA-06508: PL/SQL: could not find program unit being called.

i have attached the out put below.
in my PL/SQL code i have added hint lines "just before calling dbms_obfuscation_toolkit.DESEncrypt" and "just after calling dbms_obfuscation_toolkit.DESEncrypt". when the exception is raised it shows the hint as "just before calling dbms_obfuscation_toolkit.DESEncrypt". This means that the program is aborting at the call to dbms_obfuscation_toolkit.DESEncrypt.

i am able to do "desc dbms_obfuscation_toolkit" as well as
select * from all_objects where object name = 'DBMS_OBFUSCATION_TOOLKIT' using my userid (as well as sys id).


SQL> @test.sql
Package created.
No errors.
Package body created.
No errors.

SQL> set serveroutput on
SQL> exec pcpf_test_enc.pcpf_enc
> ====== BEGIN TEST =======
> Input String prashanth
BEGIN pcpf_test_enc.pcpf_enc; END;
*
ERROR at line 1:
ORA-20001: pcpf_test_enc ORA-06508: PL/SQL: could not find program unit being
called hint = before opening the dbms_obfuscation_toolkit.DESEncrypt
ORA-06512: at "SYS.PCPF_TEST_ENC", line 46
ORA-06512: at line 1

SQL> show user
USER is "SYS"


The PL/SQL procedure is as follows.:

--start of test.sql
--=================

set define off;
set serveroutput on;
CREATE OR REPLACE PACKAGE pcpf_test_enc AS
PROCEDURE pcpf_enc;
END pcpf_test_enc;
/
show errors;

CREATE OR REPLACE PACKAGE BODY pcpf_test_enc AS

PROCEDURE pcpf_enc IS
input_string VARCHAR2(16) := 'prashanth';
key_string VARCHAR2(8) := 'kumar';
encrypted_String VARCHAR2(2048);
decrypted_String VARCHAR2(2048);
raw_key VARCHAR2(100);
hint VARCHAR2(100);

error_in_input_buffer_length EXCEPTION;

BEGIN
null;
dbms_output.put_line('> ====== BEGIN TEST =======');
dbms_output.put_line('> Input String '|| input_string);
hint := 'before opening the dbms_obfuscation_toolkit.DESEncrypt';
dbms_obfuscation_toolkit.DESENCRYPT(input_String => input_string,
key_string => key_string,
encrypted_string => encrypted_string);
hint := 'after opening the dbms_obfuscation_toolkit.DESEncrypt';

dbms_output.put_line('> encrypted_string '|| encrypted_string);

hint := 'before opening the dbms_obfuscation_toolkit.DESDecrypt';
dbms_obfuscation_toolkit.DESDECRYPT(input_string => encrypted_string,
key_string => raw_key,
decrypted_string => decrypted_string);
hint := 'after opening the dbms_obfuscation_toolkit.DESDecrypt';
dbms_output.put_line('> decrypted_string '|| decrypted_string);
dbms_output.put_line('> ');
IF input_string = decrypted_string THEN
dbms_output.put_line('> DES Encryption and Decryption successful');
END IF;
EXCEPTION
WHEN OTHERS THEN
RAISE_APPLICATION_ERROR(-20001,'pcpf_test_enc '||sqlerrm||' hint = '||hint);
END pcpf_enc;
END pcpf_test_enc;
/
show errors

--================
--End of test.sql
--================

Here is the output of the select query.

SQL> desc dbms_obfuscation_toolkit
PROCEDURE DESDECRYPT
Argument Name Type In/Out Default?
------------------------------ ----------------------- ------ --------
INPUT RAW IN
KEY RAW IN
DECRYPTED_DATA RAW OUT
PROCEDURE DESDECRYPT
Argument Name Type In/Out Default?
------------------------------ ----------------------- ------ --------
INPUT_STRING VARCHAR2 IN
KEY_STRING VARCHAR2 IN
DECRYPTED_STRING VARCHAR2 OUT
PROCEDURE DESENCRYPT
Argument Name Type In/Out Default?
------------------------------ ----------------------- ------ --------
INPUT RAW IN
KEY RAW IN
ENCRYPTED_DATA RAW OUT
PROCEDURE DESENCRYPT
Argument Name Type In/Out Default?
------------------------------ ----------------------- ------ --------
INPUT_STRING VARCHAR2 IN
KEY_STRING VARCHAR2 IN
ENCRYPTED_STRING VARCHAR2 OUT

SQL>
SQL>
SQL>
SQL> select * from all_objects where object_name = 'DBMS_OBFUSCATION_TOOLKIT';

OWNER OBJECT_NAME
------------------------------ ------------------------------
SUBOBJECT_NAME OBJECT_ID DATA_OBJECT_ID OBJECT_TYPE
------------------------------ ---------- -------------- ------------------
CREATED LAST_DDL_ TIMESTAMP STATUS T G S
--------- --------- ------------------- ------- - - -
SYS DBMS_OBFUSCATION_TOOLKIT
18495 PACKAGE
22-MAY-01 22-MAY-01 2001-05-22:17:49:44 VALID N N N

PUBLIC DBMS_OBFUSCATION_TOOLKIT
18476 SYNONYM
22-MAY-01 22-MAY-01 2001-05-22:17:49:44 VALID N N N

OWNER OBJECT_NAME
------------------------------ ------------------------------
SUBOBJECT_NAME OBJECT_ID DATA_OBJECT_ID OBJECT_TYPE
------------------------------ ---------- -------------- ------------------
CREATED LAST_DDL_ TIMESTAMP STATUS T G S
--------- --------- ------------------- ------- - - -

SYSTEM DBMS_OBFUSCATION_TOOLKIT
18493 PACKAGE
22-MAY-01 22-MAY-01 2001-05-22:15:56:14 VALID N N N
SQL>
SQL>


Thanx in advance
Prashanth


and Tom said...

somebody installed the package into SYSTEM. It belongs only in SYS.

Log in as system and drop that package.

also, someone has only installed the SPEC of dbms_obfuscation_toolkit -- the package body is missing.

see
</code> http://asktom.oracle.com/pls/asktom/f?p=100:11:::::P11_QUESTION_ID:899028482141 <code>
for the proper method to install this tool

Rating

  (18 ratings)

Is this answer out of date? If it is, please let us know via a Comment

Comments

SYS.DBMS_OBFUSCATION_TOOLKIT is working - thanx asktom

Prashanth Kumar, June 01, 2001 - 4:11 am UTC

Thank you very much. I managed to get the package working.
i reinstalled using catobtk.sql and it started to work.
Thanx again.

Getting same error from trigger

Unknown, August 10, 2004 - 10:34 am UTC

We have a trigger that calls the packgae. Here is the code.


CREATE OR REPLACE TRIGGER tr_trans_sub_detail_ccp2_alert
AFTER INSERT
ON transaction_subscriber_detail
REFERENCING NEW AS NEW OLD AS OLD
FOR EACH ROW
begin
ENROLL.PKG_WE_ALERT_TO_CCP2.PRC_WE_ALERT_TO_CCP2('W',:NEW.CUST_ID,:NEW.TRANS_ID,:NEW.PERS_KEY,'',NULL,NULL);
Exception
when OTHERS THEN
DEBUG.RECORD('SUB_DETAIL_TRIGGER',sysdate,sqlerrm,'I');
end;


But when this trigger fires it gives error

ORA-06508: PL/SQL: could not find program unit being called

When i see the package, it is complied and in valid state and is being executed successfully from PL/SQL.

So this is working but not from trigger


BEGIN
enroll.pkg_we_alert_to_ccp2.prc_we_alert_to_ccp2('W',442,6575090,1847486,'',NULL,NULL);

COMMIT;
EXCEPTION
WHEN OTHERS THEN
dbms_output.put_line('Error '||TO_CHAR(SQLCODE)||': '||SQLERRM);
RAISE;
END;

This is the package secification for procedure

Procedure PRC_WE_ALERT_TO_CCP2(p_process_fl In VarChar2, p_custId In Number, p_transId In Number,
p_persKey In Number, p_changePerfmBy In VarChar2,
p_startTime In Date, p_endTime In Date);


Tom Kyte
August 10, 2004 - 3:26 pm UTC

when others not followed by RAISE = YOU HAVE A SERIOUS HEINOUS bug in your code that needs to be fixed.


The package body is not available is what this is saying. the spec might be well and fine, but the BODY is not.

Just go into sqlplus an on the command line:

begin
enroll.pkg_we_alert_to_ccp2.prc_we_alert_to_ccp2
('W',442,6575090,1847486,'',NULL,NULL);
end;
/


the next "error" you'll get is "cannot commit in a trigger" -- this isn't sqlserver! it would be the second worst thing you could try to do -- committing in a trigger (breaks all semblance of transactional integrity). The first worst is that "when others" that just "hides the error"



ORA-6508 "PL/SQL: could not find program unit being called"

Unknown, August 10, 2004 - 10:48 pm UTC

Actaully we are using sql navigator. May be i was not clear enough in my questions earlier. This is what is happening.

When I execute this code in either sql plus or sql navigator i dont get any error.

begin
enroll.pkg_we_alert_to_ccp2.prc_we_alert_to_ccp2
('W',442,6575090,1847486,'',NULL,NULL);
end;

But, if i execute this from trigger i get an error
ORA-6508 "PL/SQL: could not find program unit being called"

Here is trigger code

CREATE OR REPLACE TRIGGER tr_trans_sub_detail_ccp2_alert
AFTER INSERT
ON transaction_subscriber_detail
REFERENCING NEW AS NEW OLD AS OLD
FOR EACH ROW
begin
ENROLL.PKG_WE_ALERT_TO_CCP2.PRC_WE_ALERT_TO_CCP2('W',:NEW.CUST_ID,:NEW.TRANS_ID,:
NEW.PERS_KEY,'',NULL,NULL);
end;

There was no error when i compiled the package.

One more thing. We have also got some info from metalink.
-------------------------------------------------------
The information in this article applies to:
PL/SQL - Version: 9.2.0.4
This problem can occur on any platform.
none
Errors
ORA-6508 "PL/SQL: could not find program unit being called"

Symptoms
ora-6508 in PL/SQL code. Including triggers


Cause
This is a product feature
Fix
A fix is expected

Work around

In the EXCEPTION block execute the dbms_session.reset_package call when a 6508 is caught.

This does nothing for the current execution but allows
-------------------------------------------------------

I dont know how this will be useful and how do i use it?
What if some other package or procedure is running in the same session?
Before using this i wanted your inputs.

I will appreciate your response Tom. We are trying to resolve this for last three days.

Tom Kyte
August 11, 2004 - 7:44 am UTC

use sqlplus and do this for me:

SQL> exec <that package.procedure>
SQL> drop table ttt;
SQL> create table ttt ( x int );
SQL> create trigger ttt_trigger before insert on ttt begin <that package.proc> end;
/

SQL> insert into ttt values ( 1 );


do that, cut and paste the results. 

ORA-6508 "PL/SQL: could not find program unit being called"

Nisheeth Mitharwal, August 11, 2004 - 9:45 am UTC

This is the output

SQL*Plus: Release 9.2.0.1.0 - Production on Wed Aug 11 09:26:51 2004

Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.


Connected to:
Oracle9i Enterprise Edition Release 9.2.0.5.0 - 64bit Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.5.0 - Production

SQL> exec enroll.pkg_we_alert_to_ccp2.prc_we_alert_to_ccp2('W',26699  ,9384333,3020203,'',NULL,NULL);

PL/SQL procedure successfully completed.

SQL> create table tt ( x int );

Table created.

SQL> create trigger ttt_trigger before insert on tt begin enroll.pkg_we_alert_to_ccp2.prc_we_alert_to_ccp2('W',26699  ,9384333,3020203,'',NULL,NULL);
  2  End;
  3  /

Warning: Trigger created with compilation errors.

SQL> show errors
Errors for TRIGGER TTT_TRIGGER:

LINE/COL ERROR
-------- -----------------------------------------------------------------
1/7      PLS-00201: identifier 'ENROLL.PKG_WE_ALERT_TO_CCP2' must be
         declared

1/7      PL/SQL: Statement ignored
SQL>  

Tom Kyte
August 11, 2004 - 11:48 am UTC

so.... tell me... how were you even creating a trigger to execute this in the first place?????!!?

</code> http://asktom.oracle.com/Misc/RolesAndProcedures.html <code>

ORA-6508 "PL/SQL: could not find program unit being called"

Nisheeth Mitharwal, August 11, 2004 - 1:33 pm UTC

When i created the trigger(using sql navigator)it did not give me any error. I still have that trigger in database and and sql navigator showing me that it is compiled without any errors. Is there any system table we can find out if trigger is not in error state or compiled without any error?

Tom Kyte
August 11, 2004 - 2:03 pm UTC

select * from user_triggers;



dbms_session.reset_package

Unknown, August 11, 2004 - 3:07 pm UTC

I have a question about dbms_session.reset_package.
How this can be used if suppose trigger fails to recognize procedure in its body. What it does internally.

Tom Kyte
August 12, 2004 - 7:46 am UTC

you would not be using this package.

the only reason to use it is if you were writing your own mod_plsql, and implementing a connection pool -- or if you are using a connection pool and would like to have the session state wiped out.

you would never use this because of a trigger failure.

ORA-6508 "PL/SQL: could not find program unit being called

Nisheeth Mitharwal, August 12, 2004 - 11:30 am UTC

Tom,
Our DBA has assigned all necessary roles or priviledges to trigger and package. Still, I am getting the same error

ORA-6508 "PL/SQL: could not find program unit being called"

We are stuck again at this error.

Tom Kyte
August 12, 2004 - 11:37 am UTC

you said "i cannot even create trigger"

do the test in sqlplus I asked -- get the trigger created and show me the error

I've a feeling you have this package in multiple schemas -- you are using different users all over the place and you are just getting confused.

If this package exists
And you can call it from sqlplus command line
And you can create a trigger that calls it
Then it'll not fail


so, get my test going, show me wrong. cut and paste the exact results.

ORA-6508 "PL/SQL: could not find program unit being called

A reader, August 16, 2004 - 4:46 pm UTC

OK here is the actual result

SQL> BEGIN
  2    enroll.pkg_we_alert_to_ccp2.prc_we_alert_to_ccp2('W',3704,9393623,1728216,'',NULL,NULL);
  3  
  4    COMMIT;
  5  EXCEPTION
  6  WHEN OTHERS THEN
  7    dbms_output.put_line('Error '||TO_CHAR(SQLCODE)||': '||SQLERRM);
  8  RAISE;
  9  END;
 10  /

PL/SQL procedure successfully completed.

SQL> edit
Wrote file afiedt.buf

  1*  select * from enroll.transaction_subscriber_detail where trans_id = 9393623 and pers_key = 1728216
SQL> /

  TRANS_ID   PERS_KEY    CUST_ID AUDIT_TIM AUDIT_PER
---------- ---------- ---------- --------- ---------
   9393623    1728216       3704 16-AUG-04 423806663

SQL> delete from enroll.transaction_subscriber_detail where trans_id = 9393623 and pers_key = 1728216
  2  /

1 row deleted.

SQL> commit
  2  /

Commit complete.

SQL> insert into enroll.transaction_subscriber_detail(trans_id,pers_key,cust_id,audit_timestamp,audit_perfm_by)
  2  values('9393623',1728216,3704,sysdate,'999900999')
  3  /

1 row created.

SQL> show errors
No errors.

It works fine. But when I do the same transaction through web i get this error 

ORA-06508: PL/SQL: could not find program unit being called

here is the trigger code.

CREATE OR REPLACE TRIGGER enroll.tr_trans_sub_detail_ccp2_alert
AFTER INSERT
ON transaction_subscriber_detail
REFERENCING NEW AS NEW OLD AS OLD
FOR EACH ROW
Declare
    v_user   transaction_subscriber_detail.audit_perfm_by%type;
begin
    v_user := trim(:NEW.AUDIT_PERFM_BY);
    If v_user is not null Then
        PKG_WE_ALERT_TO_CCP2.PRC_WE_ALERT_TO_CCP2('W',:NEW.CUST_ID,:NEW.TRANS_ID,:NEW.PERS_KEY,'',NULL,NULL);
    End if;
Exception
When Others then
    DEBUG.RECORD('SUB_DETAIL_TRIGGER',sysdate,sqlerrm,'I');
end;

Strange thing, i have seen for last few days,  is that, it(the trigger through web transaction) works intermittently. 

Tom Kyte
August 16, 2004 - 8:07 pm UTC

how do you know you are firing the trigger from sqlplus? I cannot tell from anything here that the code is at all the same.

also, any chance this is a case of "when I test it in sqlplus, I am obviously not compiling it" but from time to time someone IS compiling this code and on this live system -- your end users are seeing the obvious implication of developers compiling the code they are attempting to run??

sorry -- but I run *everything* via the web and have been doing so since 1995. the web makes *nothing* different or special here, it is just a client as anything else is.

is this a stable production environment or are in we test?

ORA-6508 "PL/SQL: could not find program unit being called

A reader, August 16, 2004 - 5:53 pm UTC

Tom,
I printed the error stack(sorry i was missing this information before) from trigger

ORA-04061: existing state of package "ENROLL.PKG_WE_ALERT_TO_CCP2" has been invalidated
ORA-04065: not executed, altered or dropped package "ENROLL.PKG_WE_ALERT_TO_CCP2"
ORA-06508: PL/SQL: could not find program unit being called

I looked for this error code ORA-04061 and found out this

"Attempt the action again. This action should cause the existing state of all packages to be reinitialized."

Since, this is a web application how can we do it.

Tom Kyte
August 16, 2004 - 8:12 pm UTC

yup, ok -- this is a development environment

You are compiling the code.

but -- the middle tier is keeping connections open.

this package MAINTAINS A STATE. anyone that executed it depends on this "state" being there.

You are nuking the state by compiling it - you are doing this to any open connection in your pool that had already executed this package.

This is to be expected -- it is as if you did a lobotomy on the application -- cut out part (not all, just part) its brain.

This is to be expected and is a normal artifact of you recompiling stuff. Tell you what -- try dropping in a new connection pool piece of software -- what happens to java? recompile the oracle binary -- see what happens to the database -- something -- brain dead, game over.


You should expect this in development (and you can either just ignore it or you could actually code a "retry")

if you don't maintain a state in this package (eg: no globals), this should not be an issue. It is pretty scary to maintain a state in plsql with connection pools anyway -- you are not assured of getting the same connection page after page so you are inheriting someone elses state there.

you might consider calling dbms_session.reset_package when you grab a connection (that is what mod_plsql does). it is as if you started the session "all over again" from a plsql perspective.

ORA-6508 "PL/SQL: could not find program unit being called

A reader, August 16, 2004 - 10:02 pm UTC

So should we call this reset_package first thing in ths pl/sql or should this be in trigger before calling the pl/sql.

Tom Kyte
August 17, 2004 - 7:26 am UTC

right after you grab a connection from the pool, before you do anything in the connection.

One might ask why you are using stateful packages in a connection pool environment -- you do understand the ramifications of calling reset package right? it'll change your current behaviour. It'll be as if each page is the "first session ever to use that connection"

ORA-06508

Ravindran B, September 27, 2005 - 11:14 am UTC

Hi Tom,

We are facing a very similar issue. We are calling a procedure from a trigger and it fails "intermittently" and NOT always with ORA-06508 error.

The trigger code is as below:

CREATE OR REPLACE TRIGGER Trig_Appl_NextStep
AFTER UPDATE OF ST_REQUEST ON Trn_Appl_Requests
FOR EACH ROW

when (Old.St_Request IN ('777') AND New.St_Request IN ('333'))
DECLARE

BEGIN

Pkg_Shell.Pr_Submit_Job(:New.Seq_Request,:New.st_request);

EXCEPTION WHEN OTHERS THEN
-- to log error in error log table
Pkg_Shell.Error_Log_Update(:New.Seq_Request,'TERR', SUBSTR(SQLERRM,1,250));
END;

I have checked for the validity of "Pkg_Shell.Pr_Submit_Job" and it is in VALID state only and i can execute the same procedure separately from SQL*plus without any error and I have only one user with this package.

Please help.



Tom Kyte
September 27, 2005 - 12:11 pm UTC

could it be that

a) you used this package in that session
b) it went invalid
c) you subsequently compiled it - by calling it - but that WIPED OUT the session state
d) it then appears valid, cause you compiled it


does this package maintain a session state.

ORA-06508

Ravindran B, September 28, 2005 - 12:27 am UTC

There is only one session and one user.
The insertion is done by a Java stored procedure and on insert the trigger fires.
It is working continously without any problem and intermittently the error appears causing the trigger to fail.

Does this help ?
Pls lemme know if you need any other info?

Tom Kyte
September 28, 2005 - 9:22 am UTC

please utilize support for this, they can set an event to capture more diagnostic information.

Just be sure 100% that what you say is correct - that there are no other possible sessions out there that you just were not aware of (that developer down the hall compiling code you didn't know about)

check the last_ddl_time of the procedure next time, see what it is.

Ravindran B, September 29, 2005 - 5:53 am UTC

Im 100% sure that no one else is logged onto the DB. Ours is a PILOT environment and only one of us is logged on.

I will check out the last_ddl_time next time the error happens and let you know.

Thanks much....Ravi

dbms_obfuscation_toolkit.md5

Parag J Patankar, January 10, 2006 - 1:52 am UTC

Hi Tom,

I am trying to use dbms_obfuscation_toolkit.md5 in select statement but it is giving me an error

FUNCTION MD5 RETURNS VARCHAR2(16)
 Argument Name                  Type                    In/Out Default?
 ------------------------------ ----------------------- ------ --------
 INPUT_STRING                   VARCHAR2                IN

11:42:07 SQL> select dbms_obfuscation_toolkit.md5(INPUT_STRING=>'PARAG') from dual;
select dbms_obfuscation_toolkit.md5(INPUT_STRING=>'PARAG') from dual
                                                *
ERROR at line 1:
ORA-00907: missing right parenthesis

Pl help me how can I do direct select on this

regards & thanks
pjp 

Tom Kyte
January 10, 2006 - 8:16 am UTC

you will have to wrap that function with your own unambigous function (eg: md5_string, md5_raw) to differentiate the datatypes. 


first, you cannot ever use plsql named notation in SQL, no "=>"

Second, RAW and VARCHAR2 are considered equivalent from an overloading perspective so the SQL engine is not able to differentiate between which md5 function to call.

So, you would have to either

a) not call it from sql
b) write your own wrapper that doesn't have this ambiguity.


Or, if you have 10g, use the dbms_crypto package:

ops$tkyte@ORA10GR2> select username, dbms_crypto.hash( utl_raw.cast_to_raw(username), 2 ) from all_users;
 
USERNAME                       DBMS_CRYPTO.HASH(UTL_RAW.CAST_TO_RAW(USERNAME),2)
------------------------------ ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
WAREHOUSE                      4B01351DA2EB8BBEFF411B56DA59D101
......

 

Encryption is Different from OS to OS

Sanjeev Vibuthi, March 21, 2006 - 10:16 am UTC

Initially My Database is on Windows (10g Rel2). I created some Users in Database by using dbms_obfuscation_toolkit.DESEncrypt
encryption logic (Generated encryption key with Hash value (dbms_utility.get_hash_value) + Password) and it was working fine.

After importing same Database on Solaris System (10g Rel2), the encrypted values are changed for some of the Users....

Whether this encryption logic works differently from OS to OS... How to avoid this problems..?

--On windows System

SECURE@ newapdb 21-MAR-06>/

USER_ID PASSWORD
--------------- ------------------------------
ABC ÕÛc—Lfç¨
VISGPS1 i» xf
CYBVCO1 Z.~óÈÃÓQ
PS2 “ÆäÓA‰
C2P ¶¨xqs
P2S R2\O¹V
A2CP Y>a²W(
V2SP1 Xí„øÃ” ’
A2K E‰g}
DADMIN rúbì]Nu

-- Solaris System
SECURE@ sadmin 21-MAR-06>\

USER_ID PASSWORD
--------------- ------------------------------
ABC ÕÛc¿Lfç¨ --Changed
VISGPS1 i» xf
CYBVCO1 Z.~óÈÃÓQ
PS2 ¿ÆäÓA¿ --Changed
C2P ¶¨xqs
P2S R2\O¹V
A2CP Y>a²W(
V2SP1 Xí¿øÃ¿ ¿ --Changed
A2K E¿g} --Changed
DADMIN rúbì]Nu


--For Generating Hash Value

return ltrim( to_char( dbms_utility.get_hash_value(
upper(p_username)||'/'||upper(p_password), 1000000000,
power(2,30) ), rpad( 'X',30,'X')) );

--Encryption

dbms_obfuscation_toolkit.DESEncrypt
( input_string => v_data,
key_string => p_hashkey,
encrypted_string=> p_str );

Thanks in Adv.

Sanjeev Vibuthi


Tom Kyte
March 22, 2006 - 2:21 pm UTC

you do not give the important information

what datatype is password, it sure better be RAW, but I've a feeling it is varchar2 - and that would be not a good type for storing encrypted data.

wish the API didn't even support strings.

You have character set conversions kicking in.

This is test data only

Sanjeev, March 23, 2006 - 1:41 am UTC

Hi Tom

I simulated my problem and posted here... actual logic is some what different from this...

yah ... i am using varchar2 datatype...I think this may be my problem..

thanx

sanjeev

Tom Kyte
March 23, 2006 - 10:39 am UTC

I know that is your problem.

We have here a case where binary data is stored in a string and character set conversion will *kill* you.

Would you be interested in a way to move this? It will require some work.

You will create a table with the password column as a "raw"

You will loop over the existing data with a plsql cursor loop. You will assign the varchar2 string to a raw variable using utl_raw.cast_to_raw and insert the raw into this new table.

You will move this table to the other site

You can now update the existing string by reading in plsql this table again and using utl_raw.cast_to_varchar2 to move the raw into a string without any conversion.


This will temporary "fix" your problem but you want to conver that to a raw as soon as you can.

Connection Pool ORA-06508

Jal, August 11, 2006 - 3:26 pm UTC

I AM USING CONNECTION POOL TO CALL PROCEDURES BUT WHEN I COMPILE PROCEDURE I NEED TO TAKE A RESTART OF APPLICATION SERVER AS PACKAGE CALLING THE COMPILED PACKAGE GIVES ERROR ORA-06508 COULD NOT FIND PROGRAM UNIT BEING CALLED !!
.. help i am wasting all of time in this

Tom Kyte
August 11, 2006 - 3:36 pm UTC

RERUN PACKAGED PROCEDURE AND IT'LL WORK

or - remove the *state* from your package, this happens when you code a plsql package that has global variables

and then you blow them all away.

we are simply telling you "hey, you just gave me a lobotomy - is that OK with you"?


You have package globals
you set them to some value
in another session, you recompiled and wiped out the state

we sort of need to let you know about this.

no global variables

jal, August 14, 2006 - 6:56 am UTC

tom ,
as mentioned by you we are not using global variables nor and even after re-running packages procedure it does not work from the web based call out .. but works from sqlplus

Tom Kyte
August 14, 2006 - 11:20 am UTC

show me. make a really small package - reproduce it.

You are using state, the reason it works in sqlplus - you didn't have a session open with the plsql before. In the middle tier, you have cached connections. They are using state. (it says "existing state of packages discarded" right.

More to Explore

PL/SQL demos

Check out more PL/SQL tutorials on our LiveSQL tool.

PL/SQL docs

PL/SQL reference manual from the Oracle documentation library