This discussion is archived
2 Replies Latest reply: May 7, 2007 9:36 AM by zaibiman RSS

count_query

548780 Newbie
Currently Being Moderated
Hi,

i have to get the count of the records returned by a query on a block,
for example user may enter 'BR%' in a text field and press the 'F8' key , at this time i have to get the count of records also i have tried like below to get the count in when-new-record-instance and post-query

count_query;
cnt := to_number(Get_Block_Property( 'main_table', Query_Hits));
: main_table.total :=cnt;

when-new record-instance taking time depends on the number of records and post-query shows error frm - 40734.

could anybody tell me what exactly the solution ? Thanks Bcj
  • 1. Re: count_query
    Rosario Vigilante Journeyer
    Currently Being Moderated
    See
    [url http://forums.oracle.com/forums/thread.jspa?messageID=1788216&#1788216] How to get total count of records in Datablock

    Regards
  • 2. Re: count_query
    zaibiman Newbie
    Currently Being Moderated
    use this in only post-query trigger,

    begin

    --control and count are non database

    if :system.form_status='QUERY' then
    :control.count:=get_block_property('emp',query_hits);
    end if;

    end ;

    if u only one record is fetched the result is 0 , since the counter starts from 0... so u can add 1
    :control.count:=get_block_property('emp',query_hits)+1;