Search This Blog

About Me

My photo
Blog Written By Dr. Digvijaysinh D Virpura

Friday, November 27, 2020

Upload Blob (Image) in database table mannually in Oracle APEX

 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:


 

 

 

 

Wednesday, September 16, 2020

Customize Interactive Report in Oracle APEX. (Color Rows if row have Specific Values)

 This blog will demonstrate steps to display column value with different color based on calculations.

Following is output of what we want to achieve.



Step1: Create an Interactive Report based on SQL Query.I have used following query.You can use your own as per your requirement.

select
    EMPNO,
    ENAME,
    JOB,
    DEPTNO,
    SAL,
    case when SAL < 3000 then 'red'
        when SAL between 1000 and 2000 then 'blue'
        when SAL > 3000 then 'green'
    end text_color
from EMP EMP


    Step2: Now go to Columns under Report and select Text_Color.

  Step3: Now set Type = Hidden Column

 

 Step4:  Now you have to set following code in each column under Column Formatting (HTML Expression)

 

<span style="color:#TEXT_COLOR#;font-weight:bold;">#SAL#</span>

Add same code in all the columns and you're done with report.

 

Have a Happy Learning

Regards
Digvijaysinh Virpura