The AskTOM team is taking a break over the holiday season, so we're not taking questions or responding to comments. Please have a happy and safe festive season and as always, thanks for being a member of the AskTOM community.
Thanks for the question, Bill.
Asked: March 07, 2018 - 10:29 pm UTC
Last updated: March 08, 2018 - 6:43 am UTC
Version: 11.2
Viewed 10K+ times! This question is
SQL> create table t ( 2 c1 varchar2(4000), 3 c2 varchar2(4000), 4 hash varchar2(4000) 5 ); Table created. SQL> SQL> CREATE or REPLACE FUNCTION HASH_MD5 ( 2 psINPUT IN VARCHAR2 3 ) RETURN VARCHAR2 AS 4 rHash RAW (16); 5 BEGIN 6 rHash := DBMS_CRYPTO.HASH (TO_CLOB (psINPUT), DBMS_CRYPTO.HASH_MD5); 7 RETURN (LOWER (RAWTOHEX (rHash))); 8 END HASH_MD5; 9 / Function created. SQL> SQL> create or replace 2 trigger trg 3 before insert on t 4 for each row 5 begin 6 :new.hash := HASH_MD5(:new.c1||:new.c2); 7 end; 8 / Trigger created. SQL> SQL> insert into t (c1,c2) values ( 2 rpad('x',4000,'x'), 3 rpad('x',4000,'x') 4 ); 1 row created. SQL> SQL> select hash from t; HASH -------------------------------------------------------------------------- d49d36f757d863f1f12fedf91a893e19
Need more information on Administration? Check out the Administrators guide for the Oracle Database