0
votes

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.

1

1 Answers

0
votes

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.