5 Replies Latest reply: May 16, 2013 12:40 PM by KarenH RSS

    can apex collections be updated via database package

    KarenH
      I am trying to simplify the logic in my apex 4.2 application. I have multiple collections being used in many places over several applications. Currently, each application updates the collection in slightly different ways. To make things more centralized, I would like to update my collections via a database package.

      I have not seen this documented anywhere, so was wondering what you thought? Does this make sense and would it be a good way to move forward?

      thanks for your input.

      Karen
        • 1. Re: can apex collections be updated via database package
          InoL
          You can use the API's of APEX_COLLECTION in your database procedures:
          http://docs.oracle.com/cd/E37097_01/doc/doc.42/e35127/apex_collection.htm#CACFAICJ
          • 2. Re: can apex collections be updated via database package
            VC
            KarenH wrote:
            I am trying to simplify the logic in my apex 4.2 application. I have multiple collections being used in many places over several applications. Currently, each application updates the collection in slightly different ways. To make things more centralized, I would like to update my collections via a database package.

            I have not seen this documented anywhere, so was wondering what you thought? Does this make sense and would it be a good way to move forward?
            APEX_COLLECTION is an plsql API and is similar to any other database packages. But can only be used within an apex application session.

            So yes you can use them within any database package as far as your package.subprogram is executed within an apex application session, and this means you won't be able to execute this package.subprogram outside apex.
            • 3. Re: can apex collections be updated via database package
              KarenH
              thanks!

              I am familiar with the collection API, but just wondering if I could do something like this in a db package:
              procedure update_disposition(v_seq in number, 
                                           v_disposition_code in varcahr2(3))
              is
              
              begin
                 apex_collection.update_member_attribute (p_collection_name=> 'SPECIES_COLLECTION',
                                   p_seq => v_seq,                     
                                   p_attr_number => 8,
                                   p_attr_value  => v_disposition_code); 
                
              end;
              and then when I update the collection in the application, call package:
               ELECTRONIC_DEALER_REPORT.UPDATE_DISPOSITION(:seq,:disposition)
              thanks for your help.

              Karen
              • 4. Re: can apex collections be updated via database package
                InoL
                Of course you can. You are now nicely hiding the fact that attribute number 8 is in fact disposition_code. Apex programmers don't need to know that it's number 8, they just use the logical name "update_disposition".
                • 5. Re: can apex collections be updated via database package
                  KarenH
                  perfect. thanks.


                  I am certain I will have many more questions, but this gets me going. thanks again!!

                  Karen