1 2 3 Previous Next 32 Replies Latest reply on May 12, 2010 10:01 AM by 749777

    Populate Form Field from Post-Query Trigger

    634176
      I have a form with some fields like "start_date", "company_id", "previous_start_date", "previous_company_id". Out of these, the "previous" fields are unbound and the others are bound to "my_companies" table. All are in the same block on the form. I have a post-query trigger which runs a cursor to select "previous" values based on the "start_date" and "company_id". More than one "previous" values is retrieved each time. My problem is that my cursor writes back only one value into my form field. I ran the cursor as a pl/sql block in TOAD to test and it fetches all the records that I need. I'm not sure what I'm doing wrong in writing the values into form items. The form items are of type "custom" and display type is "text" (I'm creating the form in Oracle Designer). My cursor code is something like this:
      declare
       cursor previous_data_cur is  
              select company_id,start_date
                 from my_companies
                 where company_id = :myblock.company_id
                 and start_date < :myblock.start_date;        
             
      BEGIN  
          open previous_data_cur;
          LOOP
          fetch previous_data_cur into :myblock.prev_company_id, :myblock.prev_start_date;
          EXIT WHEN previous_data_cur%NOTFOUND;
          END LOOP;
          close previous_data_cur;  
      END; 
      Can anyone provide any pointers on what I could be doing wrong or what I should do to make this work?

      Any help is greatly appreciated.
        1 2 3 Previous Next