2 Replies Latest reply: Dec 9, 2012 1:29 AM by MOJIBUL HOQUE RSS

    PL/SQL code for a search button

    978480
      i'm using oracle DB 10g

      i'm trying to write a PL/SQL code for a search button , the search parameter is Department id

      when searching for a department id , it retrieves the values of certain attributes with the same department id

      like this picture

      http://uppix.net/f/7/1/484994cbbb235d7041484588c2463.jpg


      what's the code for this kind of search buttons ?
        • 1. Re: PL/SQL code for a search button
          MLBrown
          In the Search button's WHEN-BUTTON-PRESSED trigger you would probably want to build a where clause for the block below and execute it.
          declare
            v_where     varchar2(240);
          begin
            v_where := 'dep_id = ' || :control.dep_id;
            set_block_property('BLOCK_NAME', default_where, v_where);
            go_block('BLOCK_NAME');
            execute_query;
          end;
          Something like that. BLOCK_NAME would be the name of your actual block that you are querying. Also, instead of "default_where" in the set_block_property, you could use the ONETIME_WHERE statement, but it just depends on how you want to use it. You can always do a help on form builder and lookup SET_BLOCK_PROPERTY to read the differences.
          • 2. Re: PL/SQL code for a search button
            MOJIBUL HOQUE
            You can try this,

            declare
            v_where varchar2(240);
            begin
            v_where := 'dep_id = ' || :control.dep_id;
            set_block_property('BLOCK_NAME', default_where, v_where);
            go_block('BLOCK_NAME');
            :System.Message_Level := '20';
            execute_query;
            :System.Message_Level := '0';
            end;

            thanks
            MH