In a previous episode, I showed how quickly you can REST enable your Oracle Database tables and views.

And I took a second or 3 to show how to create a module in SQL Developer’s REST Development panel, which allows you to have a RESTful endpoint served by a SQL statement which will bring your data back as JSON.

Today I want to take another 30 seconds to show how to add a :BIND to your query, and how to make that work with your RESTful service.

note the highlighted bits, that's IMPORTANT
note the highlighted bits, that’s IMPORTANT

This example isn’t the best, as I could just REST enable the table, and use the built-in support for FilterObjects, e.g.

https://http://localhost:8080/ords/demo/thirsty/untappd/q=(‘RATING’:3}

But, I want to show :BIND stuff, so let’s go there.

The important thing is not overthink this, like I was initially. You simply need to know what your :BIND is going to be in the query when you to define your URI for your service.

{bind} in REST = :bind in SQL
{bind} in REST = :bind in SQL

When you go to define your Template under your Module, you have to define your URI pattern.

And then when you go to define your query, you use that pattern to help write your query. You can always go back to the Template and change up the URI to match your query bind parameter name. I had forgotten that step and was getting 404 pages.

And that’s it. Nothing else to define really. Just upload your module, and make the call.

EZ-PZ!
EZ-PZ!

I think I’ll go into more detail and show some examples with the FilterObject Grammar stuff next, this stuff is whiz-bang cool, and really speaks volumes, at least to me, why this REST stuff is taking over the InnerWebs.

Author

I'm a Distinguished Product Manager at Oracle. My mission is to help you and your company be more efficient with our database tools.

2 Comments

  1. Cor van Zalk Reply

    I used this with ords 3.0.1.177.18.02 and sqld 4.1.1.19.59, and it only worked for me to have the uri pattern as example/:binding.

    It gave 404’s on the curly brackets. Is this a bug?

Write A Comment