Forum Stats

  • 3,767,858 Users
  • 2,252,726 Discussions
  • 7,874,366 Comments

Discussions

Using a "Media Resource" to return BLOB in ORDS - What if the row doesn't exist?

Adam vonNieda
Adam vonNieda Member Posts: 115 Bronze Badge

Is there a way to handle this, and instead send a BLOB that contains a "Not found" message? Otherwise we get a HTTP 404.

Here's my simple media resource query for the GET

Select mime_type as mimetype, report_blob from schema.reports where report_name = :filename

If the row is not found, I would want the report_blob to contain the row with the "Not Found" BLOB.

As in: Select report_blob into v_missing_pdf from schema.reports where report_name = 'ReportNotFound.pdf';

Edit: ORDS 3.0.9 - Database 12.2 - APEX 5.1.1

Thanks!

Tagged:

Answers

  • Adam vonNieda
    Adam vonNieda Member Posts: 115 Bronze Badge


    Thanks for the response Jeff, I'm a big fan! That's what I said too, a 404 is exactly that. In this case, they wanted me to return a PDF that had some friendly text in it instead, and we did figure out how to do that.

    Thanks and best regards!