Oracle杂文:base64加密解密

  • 加密函数:base64_encode
  • 解密函数:base64_decode
  • 13位时间戳:(SYSDATE - TO_DATE(‘1970-1-1 8’, ‘YYYY-MM-DD HH24’)) * 86400000 + TO_NUMBER(TO_CHAR(SYSTIMESTAMP(3), ‘FF’))
SELECT utl_raw.cast_to_varchar2(utl_encode.base64_encode(utl_raw.cast_to_raw('abc'||to_char(ts)))),
       utl_raw.cast_to_varchar2(utl_encode.base64_decode(utl_raw.cast_to_raw(utl_raw.cast_to_varchar2(utl_encode.base64_encode(utl_raw.cast_to_raw('abc'||to_char(ts))))))),
       to_char(ts), 
       to_char(SYSDATE,'yyyy-mm-dd HH24:MI:SS') 
  FROM (SELECT (SYSDATE - TO_DATE('1970-1-1 8', 'YYYY-MM-DD HH24')) * 86400000 + TO_NUMBER(TO_CHAR(SYSTIMESTAMP(3), 'FF')) AS ts FROM dual)

你可能感兴趣的:(ORACLE)