This content has been marked as final. Show 4 replies
Obviously, you can't simply store the unencrypted value, which is what is being displayed on the page back into the encrypted field. You need to create a computation On Submit to perform the pop operation prior to saving.
What might be smoother for you is to consider adding a BEFORE INSERT trigger on the table that contains the encrypted value and perform the pop operation there. That should make it more seamless from the front end as no special processing would then be required.
Edited by: Joe Upshaw on Feb 4, 2013 5:20 PM
Joe, you are right that I can't simply store the unencrypted value. What I need to do is like this --
Some of records have SSN, which are encrypted in the table. On APEX page, they are displayed as unencrypted value, which I used Source value or expression -
select pinfo.pop(SSN) from table_A where seqno = :P2_seqno; but now, user allows to UPDATE SSN. You are right that I need to create a computation On Submit to
perform the PUSH operation (encrypt data) prior to saving SSN in the table. How?
Adding a BEFORE INSERT trigger on the table is an option. However, is there a way I can do on the APEX level? Please specify it.
Option 1: The Trigger....this really is better because your data will work no matter how the table is updated, i.e. via APEX or SQL*Plus or whatever...
Option 2: APEX
CREATE OR REPLACE TRIGGER BRIU_MYSSN BEFORE INSERT OR UPDATE ON MYSSN REFERENCING NEW AS new OLD AS old FOR EACH ROW DECLARE lc_EncryptedSSN CHAR(32); BEGIN lc_EncryptedSSN := pinfo.pop(:new.SSN); :new.SSN := lc_EncryptedSSN; EXCEPTION WHEN OTHERS THEN -- Consider logging the error and then re-raise RAISE; END;
On you page, under Page Processing, right-click on Computations. Pick Item on this Page. Pick the page item corresponding to the SSN. Pick After Submit for you Computation Point. Pick PL/SQL for the function body.
BEGIN RETURN info.pop(:P8_SSN); END;
I chose option 2 and it works now. Thank you for your help!