Can someone help me, why I am getting ORA-01465: invalid hex number when the following trigger being executed?
salt and password fields in MART_USER table are in RAW data type . Do I need to change this to Varchar?
The hash function(mart_hash) used below is taking two parameters in varchar2 and returning RAW
I am creating a new user through apex form and entering a temporary password in the password field , That is where the trigger execute. My purpose is to insert and salt and hashed password when inserting a new user
I am on Oracle Database 12c Standard Edition Release 12.1.0.2.0 - 64bit Production. Apex version - application express 5.1.2.00.09
*****************************************************************************************************************************************************************
Create or replace TRIGGER "BI_MART_USERS"
before insert on "MART_USERS"
for each row
declare
l_salt varchar2(1000);
l_password varchar2(1000);
begin
if :NEW."USER_ID" is null then
select "MART_USERS_SEQ".nextval into :NEW."USER_ID" from sys.dual;
end if;
:new.salt := DBMS_CRYPTO.RANDOMBYTES (14);
l_salt := utl_raw.cast_to_varchar2(:new.salt);
l_password := utl_raw.cast_to_varchar2(:new.password);
:new.password := mart_hash(l_salt,l_password);
Exception
end;
*******************************************************************************************************************************