14.7.3 Keeping PL/SQL Handlers Maintainable
Keep ORDS PL/SQL handlers small by delegating REST logic to package procedures.
To simplify maintenance, organize your REST API code in PL/SQL packages. This lets
each PL/SQL handler make a one-line call to a package procedure. The figure below shows the
PUT handler for the template /actionitems/:id
template, which updates a specific action item by
ID:begin
action_items_api_rest.update_object(:id,:body_text,:debug);
end;Notice the one-line PL/SQL block references three parameters:
:id– from the URL pattern parameter in the/actionitems/:idtemplate:body_text– implicit parameter to pass the JSON document CLOB the client sends:debug– explicitly defined parameter for the HTTP header namedapp$debug
The figure shows the v1 ORDS module's actionsitems/:id
template's PUT handler PL/SQL block explained above in context in the SQL
Developer Web REST Designer. Notice the :debug listed in the Handler
Parameters section and :body_text in the Implicit Parameters
sections on the right.
Figure 14-20 An ORDS Template Handler Can Use PL/SQL for Complete Control
Parent topic: Controlling REST API Behavior Completely
