Professional Documents
Culture Documents
Image File Store Outside of Oracle Database and Show Image Into Apex Application
Image File Store Outside of Oracle Database and Show Image Into Apex Application
Image File Store Outside of Oracle Database and Show Image Into Apex Application
-- Read chunks of the BLOB and write them to the file until complete.
WHILE l_pos = l_blob_len LOOP
DBMS_LOB.read(p_blob, l_amount, l_pos, l_buffer);
UTL_FILE.put_raw(l_file, l_buffer, TRUE);
l_pos := l_pos + l_amount;
END LOOP;
EXCEPTION
WHEN OTHERS THEN
-- Close the file if something goes wrong.
IF UTL_FILE.is_open(l_file) THEN
UTL_FILE.fclose(l_file);
END IF;
RAISE;
END blob_to_file;
DECLARE
l_blob BLOB;
VID NUMBER;
BEGIN
SELECT NVL(MAX(NVL(EMPLOYEE_ID,0)),0)+ 1 INTO VID FROM EMPLOYEE_INFORMATION_IMAGE
;
select
BLOB_CONTENT INTO l_blob
FROM apex_application_temp_files
where NAME= :P7_IMAGE ;
blob_to_file(p_blob = l_blob,
p_dir = 'STOCK_DIRECTORY',
p_filename =VID||'.png');
INSERT INTO
EMPLOYEE_INFORMATION_IMAGE(EMPLOYEE_ID,EMPLOYEE_NAME,DESIGNATION,JOINING_DATE,FATHE
RS_NAME)
VALUES(VID,:P7_EMPLOYEE_NAME,:P7_DESIGNATION,:P7_JOINING_DATE,:P7_FATHER_NAME);
END;