oracle - Encrypted / Decrypting null using DBMS_crypto -


i have search on internet happened when encrypt null value , decrypt it.

so far in experiment. in table have column timestamp. have few rows of data, in these few rows, have proper timestamp , null value mixed in.

i attempted this:

select count(*) mytable key = 'currlogintime' ,   to_timestamp(clob_substr(decrypt(value,?), 19, 1), 'yyyy-mm-dd hh24:mi:ss') > ? 

the first parameter private key, , second parameter date comparing with.

i keep getting following exception:

ora-01841: (full) year must between -4713 , +9999, , not 0; nested exception java.sql.sqldataexception: ora-01841: (full) year must between -4713 , +9999, , not 0 

i guessing original null value getting decrypted 0. can confirm or shed light this? stumped.

encrypting or decrypting null results in null. wouldn't make sense work other way. demonstrate:

var typ number; var key varchar2(32); begin   :typ := dbms_crypto.encrypt_aes256      + dbms_crypto.chain_cbc      + dbms_crypto.pad_pkcs5;   :key := dbms_crypto.randombytes(32); end; /  set null '(null)'  select dbms_crypto.encrypt(src=>utl_i18n.string_to_raw(null, 'al32utf8'),   typ=>:typ, key=>:key) encrypted dual;  encrypted                     ------------------------------ (null)                           select utl_i18n.raw_to_char(dbms_crypto.decrypt(src=>null,   typ=>:typ, key=>:key)) plain dual;  plain                         ------------------------------ (null)                          

the error getting not because of null values. @ least 1 of non-null values seems invalid - original plain-text value encrypted not in format to_timestamp() call expecting.


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

How to get multiresult with multicondition in Sql Server -