2 Replies Latest reply: Nov 26, 2013 1:57 AM by Elad RSS

    Assignment to data-block with rowtype

    Elad

      Hi,

      I use oracle forms version 11g (11.1.2.1.0 on windows 64 bits).

      I have a data-block with many columns.

      I what to populate the data-block in WHEN-NEW-FORM-INSTANCE with query.

      My problem is, I what to populate the block with %rowtype (and not each item in separately), since I have a lot of items (=columns) in this data-block.

       

      here is my code (in WHEN-NEW-FORM-INSTANCE trigger):

       

      DECLARE

       

           CURSOR pop_blck_cur IS

                 select *

                 from  ALERTS.CRDX_ALERTS_PROCESS_TYPES

                 where (PROCESS_TYPE_ID , STATUS_DATE) in (    select    PROCESS_TYPE_ID , max(STATUS_DATE) "THE MOST UPDATED DATE"

                                                        from    ALERTS.CRDX_ALERTS_PROCESS_TYPES

                                                    group by    PROCESS_TYPE_ID)

                 order by PROCESS_TYPE_ID ;

       

        l_row   pop_blck_cur%ROWTYPE;

        

      l_first_rec   NUMBER;

      l_last_rec    NUMBER;

      cur_rec       NUMBER;

       

      BEGIN

       

      LAST_RECORD;

      l_last_rec  := :system.trigger_Record;

       

      FIRST_RECORD;

      l_first_rec := :system.trigger_Record;

       

      cur_rec := l_first_rec ;

      FOR rec IN pop_blck_cur

      LOOP

       

        GO_BLOCK('ALERTS_PROCESS_TYPES_BLOCK');

       

        cur_rec := GET_BLOCK_PROPERTY('ALERTS_PROCESS_TYPES_BLOCK', CURRENT_RECORD);

       

        GO_RECORD(cur_rec);

       

        ALERTS_PROCESS_TYPES_BLOCK%ROWTYPE := l_row ;        -- here I what to assignment from the cursor to my data block

       

        EXIT WHEN :SYSTEM.LAST_RECORD = 'TRUE';

       

        NEXT_RECORD;

       

      END LOOP;

       

      How do I accomplish this?

       

      Tanks in advanced,

      Elad

        • 1. Re: Assignment to data-block with rowtype
          Andreas Weiden

          That's not the way forms works.

           

          Base your block on your table CRDX_ALERTS_PROCESS_TYPES

          Put your WHERE-condition in the property default-where of the block.

          In the WHEN-NEW-FORM-INSTANCE, simply put an EXECUTE_QUERY;

           

          If you want to populate the block "by hand", then you have to assign each item separately.

          • 2. Re: Assignment to data-block with rowtype
            Elad

            Hi Andreas,

            Thank-you for your replay.

            You right ! for my particularly query I can use the where clause and the order by clause in the property palette.

            But if to tell the true, I'm very "disappointed" from oracle.

            I think that something like %ROWTYPE for data-block, will be very useful.

             

            Elad