SELECT CASE WHEN DBMS_LOB.GETLENGTH(A.EMPLOYEE_PHOTO) > 1455 THEN UTL_RAW.CAST_TO_VARCHAR2(UTL_ENCODE.BASE64_ENCODE(DBMS_LOB.SUBSTR(A.EMPLOYEE_PHOTO, 1455, 1))) WHEN DBMS_LOB.GETLENGTH(A.EMPLOYEE_PHOTO) <= 1455 THEN UTL_RAW.CAST_TO_VARCHAR2(UTL_ENCODE.BASE64_ENCODE (A.EMPLOYEE_PHOTO)) END AS C1,
CASE WHEN DBMS_LOB.GETLENGTH(A.EMPLOYEE_PHOTO) > 2910 THEN UTL_RAW.CAST_TO_VARCHAR2(UTL_ENCODE.BASE64_ENCODE(DBMS_LOB.SUBSTR(A.EMPLOYEE_PHOTO, 1455, 1456))) WHEN DBMS_LOB.GETLENGTH(A.EMPLOYEE_PHOTO) <= 2910 AND DBMS_LOB.GETLENGTH(A.EMPLOYEE_PHOTO) > 1455 THEN UTL_RAW.CAST_TO_VARCHAR2(UTL_ENCODE.BASE64_ENCODE(DBMS_LOB.SUBSTR(A.EMPLOYEE_PHOTO, DBMS_LOB.GETLENGTH(A.EMPLOYEE_PHOTO) – 1455, 1456))) END AS C2,
CASE WHEN DBMS_LOB.GETLENGTH(A.EMPLOYEE_PHOTO) > 4365 THEN UTL_RAW.CAST_TO_VARCHAR2(UTL_ENCODE.BASE64_ENCODE(DBMS_LOB.SUBSTR(A.EMPLOYEE_PHOTO, 1455, 2911))) WHEN DBMS_LOB.GETLENGTH(A.EMPLOYEE_PHOTO) <= 4365 AND DBMS_LOB.GETLENGTH(A.EMPLOYEE_PHOTO) > 2910 THEN UTL_RAW.CAST_TO_VARCHAR2(UTL_ENCODE.BASE64_ENCODE(DBMS_LOB.SUBSTR(A.EMPLOYEE_PHOTO, DBMS_LOB.GETLENGTH(A.EMPLOYEE_PHOTO) – 2910, 2911))) END AS C3,
CASE WHEN DBMS_LOB.GETLENGTH(A.EMPLOYEE_PHOTO) > 5820 THEN UTL_RAW.CAST_TO_VARCHAR2(UTL_ENCODE.BASE64_ENCODE (DBMS_LOB.SUBSTR(A.EMPLOYEE_PHOTO, 1455, 4366))) WHEN DBMS_LOB.GETLENGTH(A.EMPLOYEE_PHOTO) <= 5820 AND DBMS_LOB.GETLENGTH(A.EMPLOYEE_PHOTO) > 4365
THEN UTL_RAW.CAST_TO_VARCHAR2(UTL_ENCODE.BASE64_ENCODE (DBMS_LOB.SUBSTR(A.EMPLOYEE_PHOTO, DBMS_LOB.GETLENGTH(A.EMPLOYEE_PHOTO) – 4365, 4366))) END AS C4,
CASE WHEN DBMS_LOB.GETLENGTH(A.EMPLOYEE_PHOTO) > 7275
THEN UTL_RAW.CAST_TO_VARCHAR2(UTL_ENCODE.BASE64_ENCODE (DBMS_LOB.SUBSTR(A.EMPLOYEE_PHOTO, 1455, 5821)))
WHEN DBMS_LOB.GETLENGTH(A.EMPLOYEE_PHOTO) <= 7275 AND DBMS_LOB.GETLENGTH(A.EMPLOYEE_PHOTO) > 5820
THEN UTL_RAW.CAST_TO_VARCHAR2(UTL_ENCODE.BASE64_ENCODE(DBMS_LOB.SUBSTR(A.EMPLOYEE_PHOTO, DBMS_LOB.GETLENGTH(A.EMPLOYEE_PHOTO) – 5820, 5821))) END AS C5
FROM PS_EMPL_PHOTO A
No comments:
Post a Comment