Friday, January 12, 2024

How to Insert BLOB content using FORM And Display Image Interactive Report using Oracle APEX | Form | Interactive Report | BLOB | Oracle APEX

 

Step-1: 

     Create table with blob.

            CREATE TABLE "PRODUCT_INFORMATION" (

                                              "PRODUCT_ID"                       NUMBER,

                                              "PRODUCT_NAME"                VARCHAR2(20),

                                              "FILENAME"                            VARCHAR2(20),

                                              "MIMETYPE"                           VARCHAR2(20),

                                             "IMAGE_LAST_UPDATE"        DATE,

                                            "PRODUCT_IMAGE"                BLOB,

                                             "LIST_PRICE"                           NUMBER,

                                             "PRODUCT_AVAILABILITY"   NUMBER

);

Step-2:

       Create form page

               To create a form page, use the table name PRODUCT_INFORMATION.

 


         To follow the below steps for P17_PRODUCT_IMAGE page item:

 

 
 

Identification: 

                          Name: P17_PRODUCT_IMAGE

                          Type: File Upload

 

Storage:  

          Type: 

                 BLOB column specified in item source attribute.

                 Mime type column: MIMETYPE

                 Filename column: FILENAME

 


 

Step-3: 

        Create one region in the body section and go to the properties select the type –Interactive Report.

 


 

SQL Query:

SELECT

    product_id,

    product_name,

    filename,

    mimetype,

    image_last_update,

    DECODE(nvl(dbms_lob.getlength(product_image), 0), 0, NULL, '<img alt="Altr text" src="'

                                                               || apex_util.get_blob_file_src('P17_PRODUCT_IMAGE', product_id)

                                                               || ' "width= "150"/>') "PRODUCT_IMAGE"

FROM

    product_information;


 

To select the "Percent Graph" type for the "Product_image" column.


Step-4: 

        Save and run the page:

Output:


 

No comments:

Post a Comment