1 Reply Latest reply on Sep 11, 2016 11:04 PM by Jon Dixon

    ORDS.DEFINE_HANDLER post doesn't records body

    user1343407

      The following works fine, but when trying to insert in a clob the body of the url; it doensn't works

      how can i save the json generated

       

      BEGIN

      ORDS.DEFINE_MODULE(

      p_module_name  =>  'JIRA',

      p_base_path     => '/JIRA/');

      END;

      /

       

      BEGIN

      ords.define_template(p_module_name => 'JIRA',

      p_pattern         =>  'ISSUENUMBER/:ISSUENUM');

      END;

      /

       

      BEGIN

      ORDS.DEFINE_HANDLER( 

         p_module_name => 'JIRA' ,

      p_pattern     => 'ISSUENUMBER/:ISSUENUM',

      p_method     => 'POST',

      p_source_type =>  ords.source_type_plsql,

      p_source => 'begin insert into PCTIN_JIRA_ISSUES_TBL (JIRA_NUMBER) values  (:ISSUENUM); end;');

      commit;

      END;

       

      tried like this

      BEGIN

         ORDS.DEFINE_HANDLER( 

         p_module_name => 'JIRA' ,

         p_pattern     => 'ISSUENUMBER/:ISSUENUM',

         p_method     => 'POST',

         p_source_type =>  ords.source_type_plsql,

         p_source => 'begin insert into PCTIN_JIRA_ISSUES_TBL (JIRA_NUMBER,cuerpo) values  (:ISSUENUM,:body); end;');

         commit;

      END;

       

      any help

      thanks

      sonia

        • 1. Re: ORDS.DEFINE_HANDLER post doesn't records body
          Jon Dixon

          Hi,

           

          Not exactly sure what your issue is. is it that you can't use a CLOB variable to define the source code for the p_source parameter? If so, you can use the Quote Operator to assign your source to a clob, then use that clob in the define handler. It also means you don't have to deal with handling single quotes etc.

           

          The text in bold below is the source code being assigned to the clob variable:

          DECLARE

            l_source_clob  CLOB := q'#

          DECLARE

            l_x   VARCHAR2(100);

          BEGIN

            htp.p('Hello');

                  l_x := 'AAAA';

          END;

          #'; 

           

          BEGIN

            ORDS.DEFINE_HANDLER(

             p_module_name => 'AAA',

             p_pattern     => 'AAA',

             p_method      => 'POST',

             p_source_type => 'source_type_plsql',

             p_source      => l_source_clob,

             p_comments    => 'Get Handler for XXX');

          END;