0

I have a table IMAGE_TABLE with two columns ID - NUMBER and IMAGE - BLOB. I have an APEX page with page item P1_ID as hidden and P1_IMAGE with type as "Diaplay Image" and "Based On" as "BLOB Column returned by SQL Statement".

SQL is as follows: SELECT IMAGE FROM IMAGE_TABLE WHERE ID = :P1_ID;

On page load, I set P1_ID as 1.

I have two buttons, "Previous" & "Next". When Next button is pressed, I want to get the next image with a dynamic action with true action as "Execute PL/SQL Code" and code as follows.

:P1_ID := :P1_ID + 1; ( :P1_ID := :P1_ID - 1; for PREV button )
SELECT IMAGE INTO :P1_IMAGE FROM IMAGE_TABLE WHERE ID = :P1_ID;

Items to Submit: :P1_ID

Items to Return: :P1_ID, :P1_IMAGE

When I save this PL/SQL Code, I am getting an error "ORA-06550: line 23, column 8: PL/SQL: ORA-00932: inconsistent datatypes: expected NUMBER got BLOB".

The idea is that I don't want to submit the page again with the next or prev button clicks but do a region refresh (as the second true action to this dynamic action) to load the new image.

Any clue on what my mistake is and how to achieve this ?

My APEX version is "18.1" and Oracle version is "11g Express Edition Release 11.2.0.2.0 - 64bit Production"

Thank you in advance.

2 Answers 2

0

All you should need to do is

  1. refresh the region with a dynamic action
  2. ensure the new P1_ID is set in 'page items to submit' for the region displaying the image

You shouldn't need a P1_IMAGE page item to store the image blob - that's where the error is coming from.

Sign up to request clarification or add additional context in comments.

6 Comments

Thanks Scott for the reply. I removed problematic SQL statement from dynamic action. I tried both item refresh and region refresh. Unfortunately, my image is not getting refreshed. Old image stays. From session variables, I see that P1_ID is getting incremented. Any further suggessions.
So numerous clicks do not change the image, while session state continues to change? Is other data on the report changing? Perhaps build an example on apex.oracle.com
Tried creating my application in apex.oracle.com. When I try to upload a file, I get the error "Ajax call returned server error ORA-01403: no data found for" at the sql staement "select blob_content into var_blob from APEX_APPLICATION_TEMP_FILES where name = :P1_FILE_BROWSE;". Its my first application in this environment. Can you please help correcting this as the first step. Thank you. WorkSpace: Sri, User: guest, Pass: a1b2c3d4
File upload is designed to be processed on submit. I've modified to make the process work.
And the sample provided appears to be more about uploading the file, than iterating through records?
|
0

To display image, try to use this sql:

Select image_id, sys.dbms_lob.getlength("BLOB COLUMN NAME") "IMAGE" From Images

KR, Strahinja

1 Comment

As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.