Upload Blob (Image) in database table manually in Oracle APEX
This blog demonstrate the steps to insert or store image into database table using manual process in Oracle APEX.
Step1: We Need a table which have a blog column. So we have created a table DEMO_PRODUCT_INFO.
CREATE TABLE "DEMO_PRODUCT_INFO" (
"PRODUCT_ID" NUMBER NOT NULL ENABLE, "PRODUCT_NAME" VARCHAR2(50), "PRODUCT_DESCRIPTION" VARCHAR2(2000), "CATEGORY" VARCHAR2(30), "PRODUCT_AVAIL" VARCHAR2(1), "LIST_PRICE" NUMBER(8,2), "PRODUCT_IMAGE" BLOB)
Step2: Now Create a Blank Page in Oracle APEX and Add Items on the Page as shown below.
Step3: Now select P23_PRODUCT_IMAGE and select type as File Browse and Storage Type as Table APEX_APPLICATION..
Step4: Now create a process and add following code in it and execute it on the click event of a button.
declare
Image BLOB;
begin
select blob_content into Image
from apex_application_temp_files
where name =:P23_PRODUCT_IMAGE;
insert into DEMO_PRODUCT_INFO(PRODUCT_ID,
PRODUCT_NAME,
PRODUCT_DESCRIPTION,
CATEGORY,
PRODUCT_AVAIL,
LIST_PRICE,
PRODUCT_IMAGE)
values(PRODUCT_SEQ.NEXTVAL ,
:P23_PRODUCT_NAME,
:P23_PRODUCT_DESCRIPTION,
:P23_CATEGORY,
:P23_PRODUCT_AVAIL,
:P23_LIST_PRICE,
Image);
end;
Now you can see the image will save successfully in your database.
Watch Video for Details:
No comments:
Post a Comment