Count rows returned in a subquery in pl/sql block

Hi,
I'm working on a trigger in Oracle 11 to check that a student has met prerequisites before enrolling in a class. I need to determine how many rows came back on the query in order to determine if I should raise an exception or not. The following is raising the exception if the prereqs are complete or not. I've haven't included the code in the where clause because I've tested is seperately and get good results. I know this is limiited info, but is there some obvious mistake I've made here?
CREATE OR REPLACE TRIGGER prereq
BEFORE INSERT ON enrollment
FOR EACH ROW
DECLARE
  howmany  number;
BEGIN
  select count(*)
  into howmany
  from dual
  where exists ((insert code here that returns 0 rows if prerequisites are not met);
  if howmany = 0 then
    raise_application_error(-20000, 'The prerequisites for this course are not complete');
  end if;
end;
/

As you are selecting from dual you might hit no_data_found if the exist caluse doesnot return any row.
Try this,
CREATE OR REPLACE TRIGGER prereq
   BEFORE INSERT
   ON enrollment
   FOR EACH ROW
DECLARE
   howmany        NUMBER;
BEGIN
   SELECT COUNT (*) INTO howmany FROM DUAL;
               WHERE EXISTS ((INSERT code here that returns 0 ROWS IF prerequisites are NOT met);
EXCEPTION
   WHEN NO_DATA_FOUND
   THEN
      raise_application_error (-20000
                              ,'The prerequisites for this course are not complete');
END;You dont need count(*) from dual you can simply use
SELECT 1 INTO howmany FROM DUAL;
               WHERE EXISTS ...G.

Similar Messages

  • Obtaining a collection as a return from an execute immediate pl/sql block

    version 10.2
    I need to obtain the collection back from the execute immediate of a pl/sql block:
    procedure block(owner varchar2) is
    stmt                   long;
    objecttab_coll         dbms_stats.objecttab;
    begin
    stmt := '
       begin
        dbms_stats.gather_schema_stats(''' || owner || '''
         ,options => ''LIST AUTO''
         ,objlist => :objecttab_coll
       end;'; 
    execute immediate stmt returning into objecttab_coll;
    -- do more stuff here
    end block;I have tried this + a few variations but with no luck. In looking through the docs I do not see an example. can this be done?
    Thanks
    Ox

    I dont find any need for an execute immediate here. This must be just enough.
    procedure block(owner varchar2)
    is
         objecttab_coll         dbms_stats.objecttab;
    begin
         dbms_stats.gather_schema_stats(ownname => owner, options => 'LIST AUTO', objlist => objecttab_coll);
         -- do more stuff here
    end block;Thanks,
    Karthick.

  • Problem with Top N Query when no rows returned (takes forever)

    I have a table with 100 Million rows and I want to get the latest N records using:
    SELECT * FROM
    (SELECT * FROM tablename WHERE columnA= 'ABC' ORDER BY TIME DESC)
    WHERE rownum <= N;
    This works fine and is very fast when there are rows with columnA= 'ABC' but when there are no rows with columnA= 'ABC' the query takes forever.
    The strange things is that the inner query returns immediately when run on it's own when no rows with columnA= 'ABC' exist e.g.
    SELECT * FROM tablename WHERE columnA= 'ABC' ORDER BY TIME DESC
    So why does it take for ever for to run:
    SELECT * FROM (no rows inner query) WHERE rownum <= N;
    I have also tried using:
    SELECT * FROM
    (SELECT columnA, rank() over(ORDER BY TIME DESC) time_rank
    FROM tablename WHERE columnA='ABC')
    WHERE time_rank <= N;
    which returns instantly when there are now rows but takes much longer than the first query when there are rows.

    I cannot see a real difference:With histogram we can see a difference on the elapse when no row returned and into explain plan.
    SQL> drop table tablename
      2  /
    Table dropped.
    Elapsed: 00:00:00.03
    SQL>
    SQL> create table tablename
      2  as
      3  select sysdate - l time
      4         , decode(trunc(dbms_random.value(1,10)),1,'ABC',2,'DEF',3,'GHI',4,'JKL','MNO') as columnA
      5    from (select level l from dual connect by level <= 1000000)
      6  /
    Table created.
    Elapsed: 00:01:19.08
    SQL>
    SQL> select columnA,count(*) from tablename group by columnA
      2  /
    COL   COUNT(*)
    ABC     110806
    DEF     111557
    GHI     111409
    JKL     111030
    MNO     555198
    Elapsed: 00:00:05.05
    SQL>
    SQL> create index i1 on tablename(time)
      2  /
    Index created.
    Elapsed: 00:00:34.08
    SQL>
    SQL> create index i2 on tablename(columna)
      2  /
    Index created.
    Elapsed: 00:00:30.08
    SQL>
    SQL> exec dbms_stats.gather_table_stats(user,'TABLENAME',cascade=>true)
    PL/SQL procedure successfully completed.
    Elapsed: 00:01:18.09
    SQL>
    SQL> set autotrace on explain
    SQL> SELECT * FROM
      2  (SELECT * FROM tablename WHERE columnA= 'ABC' ORDER BY TIME DESC)
      3  WHERE rownum <= 10
      4  /
    TIME     COL
    17/09/06 ABC
    12/09/06 ABC
    08/09/06 ABC
    07/09/06 ABC
    25/08/06 ABC
    22/08/06 ABC
    13/08/06 ABC
    08/07/06 ABC
    14/06/06 ABC
    01/05/06 ABC
    10 rows selected.
    Elapsed: 00:00:01.04
    Execution Plan
       0      SELECT STATEMENT Optimizer=CHOOSE (Cost=2364 Card=10 Bytes=120)
       1    0   COUNT (STOPKEY)
       2    1     VIEW (Cost=2364 Card=200000 Bytes=2400000)
       3    2       SORT (ORDER BY STOPKEY) (Cost=2364 Card=200000 Bytes=2400000)
       4    3         TABLE ACCESS (FULL) OF 'TABLENAME' (Cost=552 Card=200000 Bytes=2400000)
    SQL>
    SQL> SELECT * FROM
      2  (SELECT * FROM tablename WHERE columnA= 'MNO' ORDER BY TIME DESC)
      3  WHERE rownum <= 10
      4  /
    TIME     COL
    20/09/06 MNO
    19/09/06 MNO
    16/09/06 MNO
    14/09/06 MNO
    13/09/06 MNO
    10/09/06 MNO
    06/09/06 MNO
    05/09/06 MNO
    03/09/06 MNO
    02/09/06 MNO
    10 rows selected.
    Elapsed: 00:00:02.04
    Execution Plan
       0      SELECT STATEMENT Optimizer=CHOOSE (Cost=2364 Card=10 Bytes=120)
       1    0   COUNT (STOPKEY)
       2    1     VIEW (Cost=2364 Card=200000 Bytes=2400000)
       3    2       SORT (ORDER BY STOPKEY) (Cost=2364 Card=200000 Bytes=2400000)
       4    3         TABLE ACCESS (FULL) OF 'TABLENAME' (Cost=552 Card=200000 Bytes=2400000)
    SQL>
    SQL> SELECT * FROM
      2  (SELECT * FROM tablename WHERE columnA= 'PQR' ORDER BY TIME DESC)
      3  WHERE rownum <= 10
      4  /
    no rows selected
    Elapsed: 00:00:01.01
    Execution Plan
       0      SELECT STATEMENT Optimizer=CHOOSE (Cost=2364 Card=10 Bytes=120)
       1    0   COUNT (STOPKEY)
       2    1     VIEW (Cost=2364 Card=200000 Bytes=2400000)
       3    2       SORT (ORDER BY STOPKEY) (Cost=2364 Card=200000 Bytes=2400000)
       4    3         TABLE ACCESS (FULL) OF 'TABLENAME' (Cost=552 Card=200000 Bytes=2400000)
    SQL> set autot off
    SQL>
    SQL> EXECUTE DBMS_STATS.GATHER_TABLE_STATS(user,'TABLENAME',METHOD_OPT => 'FOR COLUMNS SIZE 250 columna')
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:09.08
    SQL>
    SQL> set autotrace on explain
    SQL> SELECT * FROM
      2  (SELECT * FROM tablename WHERE columnA= 'ABC' ORDER BY TIME DESC)
      3  WHERE rownum <= 10
      4  /
    TIME     COL
    17/09/06 ABC
    12/09/06 ABC
    08/09/06 ABC
    07/09/06 ABC
    25/08/06 ABC
    22/08/06 ABC
    13/08/06 ABC
    08/07/06 ABC
    14/06/06 ABC
    01/05/06 ABC
    10 rows selected.
    Elapsed: 00:00:01.03
    Execution Plan
       0      SELECT STATEMENT Optimizer=CHOOSE (Cost=1434 Card=10 Bytes=120)
       1    0   COUNT (STOPKEY)
       2    1     VIEW (Cost=1434 Card=110806 Bytes=1329672)
       3    2       SORT (ORDER BY STOPKEY) (Cost=1434 Card=110806 Bytes=1329672)
       4    3         TABLE ACCESS (FULL) OF 'TABLENAME' (Cost=552 Card=110806 Bytes=1329672)
    SQL>
    SQL> SELECT * FROM
      2  (SELECT * FROM tablename WHERE columnA= 'MNO' ORDER BY TIME DESC)
      3  WHERE rownum <= 10
      4  /
    TIME     COL
    20/09/06 MNO
    19/09/06 MNO
    16/09/06 MNO
    14/09/06 MNO
    13/09/06 MNO
    10/09/06 MNO
    06/09/06 MNO
    05/09/06 MNO
    03/09/06 MNO
    02/09/06 MNO
    10 rows selected.
    Elapsed: 00:00:02.05
    Execution Plan
       0      SELECT STATEMENT Optimizer=CHOOSE (Cost=6219 Card=10 Bytes=120)
       1    0   COUNT (STOPKEY)
       2    1     VIEW (Cost=6219 Card=555198 Bytes=6662376)
       3    2       SORT (ORDER BY STOPKEY) (Cost=6219 Card=555198 Bytes=6662376)
       4    3         TABLE ACCESS (FULL) OF 'TABLENAME' (Cost=552 Card=555198 Bytes=6662376)
    SQL>
    SQL> SELECT * FROM
      2  (SELECT * FROM tablename WHERE columnA= 'STU' ORDER BY TIME DESC)
      3  WHERE rownum <= 10
      4  /
    no rows selected
    Elapsed: 00:00:00.00
    Execution Plan
       0      SELECT STATEMENT Optimizer=CHOOSE (Cost=6 Card=1 Bytes=12)
       1    0   COUNT (STOPKEY)
       2    1     VIEW (Cost=6 Card=1 Bytes=12)
    3 2 SORT (ORDER BY STOPKEY) (Cost=6 Card=1 Bytes=12)
    4 3 TABLE ACCESS (BY INDEX ROWID) OF 'TABLENAME' (Cost=5 Card=1 Bytes=12)
    5 4 INDEX (RANGE SCAN) OF 'I2' (NON-UNIQUE) (Cost=4 Card=1)
    SQL> Nicolas.

  • Count rows from multiple tables using SQL only

    Hi, I know this has probably been answered before, but I couldn't find the answer anywhere. Please help.
    I'd like count(*) [rows] for all tables in database using SQL only - no PL/SQL
    The result should be something like:
    Table RowCount
    DBA_TABLES 1000
    DBA_USERS 50
    etc.
    Thanks!

    offcource write this script:
    create or replace procedure count_tables (ip_schema VARCHAR2)
    is
    lv_owner VARCHAR2(100);
    lv_table_name VARCHAR2(100);
    lv_sql_statement VARCHAR2(2000);
    lv_count_table NUMBER;
    CURSOR c1 IS
    SELECT owner, table_name
    FROM all_tables
    WHERE owner = ip_schema
    ORDER BY table_name;
    begin
    dbms_output.put_line ('+--------------------------------------------------------------------+');
    dbms_output.put_line ('¦ | | ¦');
    dbms_output.put_line ('¦ Schema Name | Table Name | Number of Rows ¦');
    dbms_output.put_line ('¦ | | ¦');
    dbms_output.put_line ('¦------------------------------------------------------------------¦');
    OPEN c1;
    LOOP
    FETCH c1 INTO lv_owner , lv_table_name;
    EXIT WHEN c1%NOTFOUND;
    lv_sql_statement := 'SELECT count(*) FROM ' || lv_owner || '.' || lv_table_name;
    EXECUTE IMMEDIATE lv_sql_statement INTO lv_count_table;
    IF lv_count_table > 0 THEN
    dbms_output.put_line ('| '||rpad(lv_owner, 14, ' ')||'| '|| rpad(lv_table_name, 32, ' ')||'| '|| rpad(lv_count_table, 16, ' ')||' |');
    -- dbms_output.put_line ('|---------------|---------------------------------|------------------|');
    END IF;
    END LOOP;
    CLOSE c1;
    dbms_output.put_line ('+--------------------------------------------------------------------+');
    exception
    WHEN OTHERS THEN
    dbms_output.put_line ('owner: '||lv_owner||' - table: '||lv_table_name||' - '||sqlerrm);
    end count_tables;
    set serveroutput on size 1000000
    exec count_tables
    drop procedure count_tables;

  • Is it possible to count the rows returned from a query?

    Hello,
    When using JDBC is there anyway of finding out the number of
    rows returned from a query before actually getting each row?
    In Forms 4.5 you can use the count_query function, does anyone
    know of an equivalent function or work around in JDBC and/or
    SQLJ?
    Thanks.
    null

    Pasi Hmlinen (guest) wrote:
    : Try
    : SELECT COUNT(*) FROM the_table WHERE <conditions>;
    : Hope this helps,
    : Pasi
    Thanks for the advice, I'm currently using SELECT COUNT(*) but
    I'm looking for a more efficient way of doing it. If I SELECT
    COUNT each time then I have to prepare and execute a SQL
    statement each time. What I want to do it execute a single SQL
    statement to return my results and somehow find out the number
    of rows in the resultset without having to go back to the
    database.
    Gethin.
    null

  • How to run a select count(*) with multiple rows returned

    Hi,
    I have to run a select count(*) for different reports.
    1) Select count(*) from table
    where state = 'CA'
    2) Select count(*) from table
    where state = 'NY'
    3) Select count(*) from table
    where state = 'NV'
    Instead of running this query again for 50 times, is there a way for me to just put it in one query and get multiple row returns? Thank you.

    Samantha wrote:
    Hi,
    I have to run a select count(*) for different reports.
    1) Select count(*) from table
    where state = 'CA'
    2) Select count(*) from table
    where state = 'NY'
    3) Select count(*) from table
    where state = 'NV'
    Instead of running this query again for 50 times, is there a way for me to just put it in one query and get multiple row returns? Thank you.select state, count(*) from table group by state order by 1;

  • DBMS_MVIEW.ESTIMATE_MVIEW_SIZE rows returned different that the count of..

    Hi,
    I have done the following...
    1.Gathered table stats...
    SQL> EXEC DBMS_STATS.GATHER_TABLE_STATS('SCOTT','STRDET');
    PL/SQL Procedure executed successfully
    SQL> EXEC DBMS_STATS.GATHER_TABLE_STATS('SCOTT','DETAILS_DET');
    PL/SQL Procedure executed successfully
    2. Executed the following anonymous PL/SQL block:
    SQL> set serveroutput on size 999999
    SQL> declare
      2     l_num_rows  number;
      3     l_num_bytes number;
      4     l_stmt      varchar2(2000);
      5  begin
      6     l_stmt := 'select  grp,
      7              sum(purchcontyear0) , sum(PURCHAPPRREQYEAR0)
      8        from  (
      9               select  connect_by_root s.costcenterms grp,
    10                       d.purchcontyear0 , PURCHAPPRREQYEAR0
    11                 from  strdet s,
    12                       details_det d
    13                      where s.costcenterdet=d.costcenterms(+)
    14                      connect by s.costcenterms = prior s.costcenterdet
    15             )
    16       group by grp';
    17     dbms_mview.estimate_mview_size
    18     (
    19        stmt_id       => 'Est1',
    20        select_clause => l_stmt,
    21        num_rows      => l_num_rows,
    22        num_bytes     => l_num_bytes
    23     );
    24     dbms_output.put_line('Number of rows = '||l_num_rows);
    25     dbms_output.put_line('Size (bytes) = '||l_num_bytes);
    26  end;
    27  /
    Number of rows = 12
    Size (bytes) = 1248
    3. Executed the sql script ...
    SQL> select count(*)
      2  from
      3  (
      4   select  grp,
      5              sum(purchcontyear0) , sum(PURCHAPPRREQYEAR0)
      6        from  (
      7               select  connect_by_root s.costcenterms grp,
      8                       d.purchcontyear0 , PURCHAPPRREQYEAR0
      9                 from  strdet s,
    10                       details_det d
    11                      where s.costcenterdet=d.costcenterms(+)
    12                      connect by s.costcenterms = prior s.costcenterdet
    13             )
    14       group by grp
    15  )
    16  /
      COUNT()*
             *6*According to the Oracle Doc...
    Oracle® Database PL/SQL Packages and Types Reference
    10g Release 2 (10.2)
    Part Number B14258-01
    ESTIMATE_MVIEW_SIZE Procedure
    This procedure estimates the size of a materialized view that you might create, in bytes and number of rows.Can anybody explain why is there so much difference in number of rows...even though i gathered freshed table stats regarding the source table....???? and how to , if possible , make the estimation more precise...????
    NOTE: The above is just a wonder.....
    Many thanks...
    Sim

    Hi,
    SQL> create table dup as select * from user_objects;
    Table created.
    SQL> insert into dup select * from dup;
    7 rows created.
    SQL> /
    14 rows created.
    SQL> /
    28 rows created.
    SQL> /
    56 rows created.
    SQL> /
    112 rows created.
    SQL> /
    224 rows created.
    SQL> /
    448 rows created.
    SQL> commit;
    Commit complete.
    SQL> desc dup
    Name                                      Null?    Type
    OBJECT_NAME                                        VARCHAR2(128)
    SUBOBJECT_NAME                                     VARCHAR2(30)
    OBJECT_ID                                          NUMBER
    DATA_OBJECT_ID                                     NUMBER
    OBJECT_TYPE                                        VARCHAR2(19)
    CREATED                                            DATE
    LAST_DDL_TIME                                      DATE
    TIMESTAMP                                          VARCHAR2(19)
    STATUS                                             VARCHAR2(7)
    TEMPORARY                                          VARCHAR2(1)
    GENERATED                                          VARCHAR2(1)
    SECONDARY                                          VARCHAR2(1)
    SQL> EXEC DBMS_STATS.GATHER_TABLE_STATS('SCOTT','DUP');
    PL/SQL procedure successfully completed.
    SQL> DECLARE
      2   out_rows   NUMBER;
      3   out_bytes  NUMBER;
      4  BEGIN
      5    dbms_mview.estimate_mview_size('abc',
      6    'SELECT * FROM DUP', out_rows, out_bytes);
      7
      8    dbms_output.put_line(out_rows);
      9    dbms_output.put_line(out_bytes);
    10  END;
    11  /
    896
    236544
    PL/SQL procedure successfully completed.
    SQL> select count(*) FROM DUP;
      COUNT(*)
           896
    1 row selected.
    SQL>Can you check your query once...
    - Pavan Kumar N

  • Count(1) returns null in group by

    hi gems..good afternoon..
    I read that the COUNT() function always returns 0 (zero) if there is no matching rows in the table.
    The following code returns the 0 as expected:
    SELECT COUNT(1) FROM book_table
                 WHERE client_id = 10009
                   AND book_id = 5465465
                   AND book_sub_id = 'gfdf'
                   AND amount = 78686But when I used the GROUP BY clause with the query, then it returned nothing:
    SELECT COUNT(1) FROM book_table
                 WHERE client_id = 10009
                   AND book_id = 5465465
                   AND book_sub_id = 'gfdf'
                   AND amount = 78686
    group by client_id,book_id,book_sub_id,amountWhy this is happening..please suggest...

    gogol wrote:
    But Ranit...
    Again I am thinking...the COUNT() is an aggregate function. Now a function should return something(as per my plsql knowledge) and in this case the return datatype is integer. So why isnt it returning zero..Don't think like that sandy.
    The Group By is actually done on an empty result set, so the result is neither 0 nor NULL
    It is an empty result set.
    Check this -- http://stackoverflow.com/questions/2552086/does-count-always-return-a-result
    >
    The "return value of the 'count' function" is ALWAYS a non-null integer, without exception. By mentioning "group by", you're referencing the containing query and changing the subject of "return value" from "count function" to "query's result set". A non-grouped count query produces a result set of a single record containing the return value of count. Alternatively, a grouped count query produces a result set where each record contains a count value. In that case, if there are no groups for count to run on, count is never run and the "query return value" is an empty set.
    >
    Hope this Helps.
    Ranit B.
    Edited by: ranit B on Nov 23, 2012 5:25 PM

  • How to get number of rows return in SELECT query

    i'm very new in java, i have a question:
    - How to get number of rows return in SELECT query?
    (i use SQL Server 2000 Driver for JDBC and everything are done, i only want to know problems above)
    Thanks.

    make the result set scroll insensitve, do rs.last(), get the row num, and call rs.beforeFirst(), then you can process the result set like you currently do.
             String sql = "select * from testing";
             PreparedStatement ps =
              con.prepareStatement(sql,ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
             ResultSet rs = ps.executeQuery();
             rs.last();
             System.out.println("Row count = " + rs.getRow());
             rs.beforeFirst();~Tim
    NOTE: Ugly, but does the trick.

  • How to get the number of rows returned by a report?

    Hi,
    I'm developing my first application in APEX and so far everything seems fine, except I can't figure out this very simple thing: I have a report based on a PL/SQL block returning an SQL string. I'd like to have a message (something like "X rows returned") just before the report. The closest thing I could find was "X to Y out of Z" in the pagination styles, but that's not what I want. Also I don't think running the same query to get COUNT() is wise.
    Any help would be appreciated.
    Thanks,
    Konstantin

    My guess is that it only shows the number of rows it has retrieved. I believe the defailt is for it to only retrieve 50 rows and as you page through your report it retrieves more. So this would just tell you how many rows was retireved, but probably not how many rows the report would contain if you pages to the end. Oracle doesn't really have a notion of total number of rows until the whole result set has been materialized.

  • How to get total number of rows return by query

    hi all
    i am using forms 6i with oracle 10G in windows environment....
    i have a tabular form now i want to know that how many rows return by the query...like when user click on enter query and then give any search criteria and then execute query..it displays the records but i want to count the records that how many rows are return.............
    hope you understant what i mean
    Thanks in advance
    Regards

    U can use
    "Select count(*) from <table> where <condition>"
    <condition> is the where clause being used during "Execute Query"
    this will give u the no of records in query.
    And second option is to take a summary column. whose function is set "COUNT" and
    "Summarized item" should contain a column that will never be blank. After execute query this column will give u no of records in block.
    Regards....

  • No rows returned in GC Reports

    Hi all,
    I created my own report with the body as the following:
    Table from SQL:
    select * from sys.aud$ where to_char(ntimestamp#, 'DD-MON-YYYY')='18-NOV-2008'
    I granted select on sys.aud$ to SYSMAN and MGMT_VIEW users in my TEST database.
    When I am trying to run the report, it returns the empty table saying: "No rows returned", while there a lot of records:
    17:13:17 db_manager@test> select count(*) from sys.aud$;
    COUNT(*)
    559859
    Elapsed: 00:00:00.10
    17:13:26 db_manager@test>
    Does anybody know what I am missing here?
    Thanks a lot in advance!
    M.

    Hi, DBMS Direct.
    thank you for writing to me.
    could you please suggest how to check and to make sure that it queries the correct DB?
    When I click on Edit button, In General tab in Targets I check the second radio button: Use the specified target and then i click on a flashlight and pick my DB. Whatever database I pick, the result is the same: no rows selected... Smells like it queries itself (repository)...
    Please, advise, Im fighting for about two weeks now..
    Thanks in advance,
    M.

  • Number of rows returned in a query

    Is there a way to get the number of rows returned from a query without itterating through the itterator?
    Thanks,
    Yon

    No.
    Because rows are not all returned until you start interating.
    Some times I have seen people do a count query before the normal query, this helps out if you need a count to set things up.

  • Number of rows returned for a report

    I want to create reports on serveral tables, the number of rows in these tables varies a lot (5, 5000, and the other one can have 10000+ rows).
    In the Reports Attributes page, is there a way to set the max number of rows return to the number of rows of the table? For example, for a table that has 10000 rows now, may grow to 20000 rows in the near future. If I specify the "Max Row Count" to 20000, the number may be outgrown yet again soon. If I can specify "Max Row Count" to "Current number of rows in the table" then this problem will not happen. Can it be done?

    that "Max Row Count" attribute is used to limit the number of rows returned by a htmldb report region. in your case it sounds as if you want to show all available rows all the time. in that case you'd be fine to just put a very large number into that field like 4million. that way you'd always show all your rows.
    hope this helps,
    raj

  • Need to know how to limit the number of rows returned on Oracle

    MS SQL Server has a command called 'set row count'.
    We are trying to find similar one on Oracle.
    What we are trying to do is that instead of using rownum in the query statement, we would like to find way to limit the number of rows returned. I understand that we can use JDBC resultSet object, but that's not what we want.
    I know Oracle has one called arraysize, but this would not limit the number of rows returned either.
    Pease help.
    Thanks

    I understand that we can use JDBC resultSet object, but that's not what we want.I'm not sure which feature of ResultSet you use and which not.
    But if this question has anything to do with JDBC (that's the forum where you put it), I'd recommend to use Statement.setMaxRows(). This will limit the count of rows which your statement will fetch into it's ResultSet.

Maybe you are looking for