Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

wrong number of types of arguments in call of function

Ricky007Aug 3 2022

Dear Experts

Please suggest for the below scenario

create table reg_tb
(
sno number,
mob VARCHAR2(100 BYTE)
);

insert into reg_tb values(1,'+21596524874');
insert into reg_tb values(2,'+21596524967');

commit;

create or replace FUNCTION test_encrypt (pi_str_val VARCHAR2)
RETURN RAW
AS
v_key VARCHAR2(4000) := '2B4394CD46DCAE56D03BAF298978338C';
v_inst_id VARCHAR2(4000) := '965248';
v_mod NUMBER := dbms_crypto.ENCRYPT_AES256 + dbms_crypto.CHAIN_CBC + dbms_crypto.PAD_PKCS5;
v_enc_key RAW(4000);
v_enc_val RAW(4000);

BEGIN
v_enc_key := utl_raw.bit_xor (UTL_I18N.STRING_TO_RAW (v_key , 'AL32UTF8'), UTL_I18N.STRING_TO_RAW (v_inst_id, 'AL32UTF8'));
v_enc_val := dbms_crypto.encrypt (UTL_I18N.STRING_TO_RAW (pi_str_val, 'AL32UTF8'), v_mod, v_enc_key );
RETURN RAWTOHEX(v_enc_val);
END;
/

select * from reg_tb where mob=test_encrypt('+21596524874');

This is working fine

select * from reg_tb where mob=test_encrypt('+21596524874','+21596524967');

Error due to UDF accept only one parameter here

ORA-06553: PLS-306: wrong number or types of arguments in call to 'TEST_ENCRYPT'
06553. 00000 - "PLS-%s: %s"
*Cause:
*Action:
Error at Line: 18 Column: 55

Please help to provide any suggestion to handle this.

Comments
Post Details
Added on Aug 3 2022
9 comments
1,147 views