Sample Header Ad - 728x90

Check if encrpytion key is valid in DB2

2 votes
1 answer
242 views
I have a DB2 table where one of the columns is encrypted using the two parameter variant of [ENCRYPT](https://www-01.ibm.com/support/knowledgecenter/SSEPGG_9.7.0/com.ibm.db2.luw.sql.ref.doc/doc/r0004211.html?cp=SSEPGG_9.7.0%2F2-10-3-2-51) (so the password is supplied in the SQL itself). Unfortunately due to an ETL issue the column got populated by data with two different encryption keys. I want to fix this, by running some kind of script, but unfortunately I cannot do a mass update as DECRYPT_CHAR will throw an exception on the first row where it couldn't use my encryption key. Is there a way to write a SQL script that would go through all of the rows and re-encode the rows which use the wrong encryption keys without throwing an exception? I'd prefer plain SQL if possible.
Asked by SztupY (121 rep)
Jul 1, 2015, 12:39 PM
Last activity: Jul 20, 2019, 09:03 AM