Forum Stats

  • 3,750,221 Users
  • 2,250,134 Discussions
  • 7,866,837 Comments

Discussions

how to display a blob image stored in another table in a form

user635675
user635675 Member Posts: 4 Blue Ribbon
edited Jul 5, 2021 7:11AM in Forms

I use Oracle Forms 12.2.12.0 and my database is 12c. I made a table to store all photos (in a blob field) I use in my application. And then I made a browser form to display data in that table. So far, so good. Then, I made an independent form to add or update/delete records to that table. While I don't have problem to read a photo from client pc and show it in form, I cannot save it to table. The opposite problem is when I want to edit a record. I cannot read the photo (blob) field and show it in form.

Can you provide me info how to execute the above tasks?

Thanks in advance.

Tagged:

Answers

  • Michael Ferrante-Oracle
    Michael Ferrante-Oracle Senior Principal Product Manager USMember Posts: 6,802 Employee

    If you want to use native Forms functionality to work with images, you need to use an IMAGE_ITEM and it must be associated with a Data Block. You will use the READ_IMAGE_FILE built-in to load images into the image item from the file system. Once in the DB, you will retrieve them just like retrieving other records, however you will need the record to have a column that can be used to identify the record that has the desired image. So the table might look something like this:

    Currently Forms does not support using a bind reference to populate an image item. So you won't be able to do something like:

    SELECT BLOB_IMAGE INTO :MYIMAGE_ITEM FROM MYTABLE WHERE IMAGE_ID=1002

    The above SELECT won't work.

    user635675
  • user635675
    user635675 Member Posts: 4 Blue Ribbon
    edited Jul 7, 2021 4:08AM


    Thank you for your answer. I know this so I solved it by making a tmp table with all the fields I want to edit, including the blob field and associated it with the form I use to add/edit a record. When I want to add a new record, I add a record to the tmp table and I let user fill the fields and load the image he wants. When he presses the "Save" button I insert the record to the main table and delete it from the tmp table. When I want to edit a record, I copy it to the tmp table and after finish editing I replace in the original table/record fields that have been changed.

    I hope this will help others too.