Dynamic Query Row Count

Dear HTML Gurus,
I have a SQL Query Region that returns/executes a dynamic SQL Query. Based on the number of rows a particular query returns I want to hide or show a different HTML region. I have searched all over for this kind of functionality and have come up with absolutely nothing. I would think that this would be integrated into HTMLDB because Pagination shows the total number of rows returned. Any help or direction would be wonderful.
Thanks,
James

This is how I would do it:
1. create an (hidden) item,
2. create a computation for that item and run it after submit. This computation could be a function returning the rowcount value into your (hidden) item - rowcount of my dynamic sql.
If my dynamic query is to big to be entered into the computation "container", which accepts only a limited number of characters, then I would slightly change my approach:
3. I would create a function in my schema and and call this function from the computation level - either through a simple sql query (select function(in parameter) from dual) or, again through a function returning a number.
I tested this and it worked.
Denes Kubicek

Similar Messages

  • Dynamic query, row to column

    Hi.
    Is any way to select one row as column for any table exists?
    I mean some script which have table name and condition as input parameters, and prints column_name || column value;
    I have tried to do it, but have some problems.
    e.g. have table
    create table my_table (column1 number, column2 number, column3 number);
    insert into my_table values (1,2,3);It should be something like:
    declare
    lv_table_name varchar2(40):='MY_TABLE'; /*these are input paremeters*/
    lv_condition varchar2(300):='column1=1;/*these are input paremeters*/
    begin
    /*body*/
    end;and output should be like (may use dbms_output)
    column1    1
    column2    2
    column3    3    Script should work for any table.
    Does anybody solves task similar to this?

    http://asktom.oracle.com/pls/apex/f?p=100:11:0::::P11_QUESTION_ID:1035431863958
    Search for procedure print_table on that page.

  • Maximum Row Count - dynamically change

    Hi,
    How can I change dynamically (eg. from some item) value "Maximum Row Count" in "Report Attributes -> Layout and Pagination"?
    Is this possible?
    best regards,
    Jarek

    Thank you for your answer, but I want to do something else.
    I want to show all rows from my query in report with pagination.
    The number of rows increases.
    According to documentation, field "Number of Rows" sets the number of rows which I can see on one page and field "Maximum Row Count" sets the maximum number of rows which I can see on all pages (number of rows to query).
    I thougth, that when I set (before page is shown) a variable from eg. query "SELECT count(*) FROM table", I will be able to put this variable name in "Maximum Row Count" field, to see all rows from my query. However this field is the numeric field and I can't put any variable name there :(
    The only way to always show all records from my query is to set "Maximum Row Count" field to very high number? Is this natural way in apex? Is this only way?
    best regards,
    Jarek

  • What is the problem with native dynamic sql when counting rows in all table

    what is the problem with native dynamic sql when counting rows in all table?Giving an error "table or view does not exist". Thanks.
    DECLARE
    v_sql_string varchar2(1000);
    v_no_of_rows number;
    BEGIN
    for i in ( select table_name from all_tables )
    loop
    v_sql_string := ' select count(1) from ' || i.table_name;
    dbms_output.put_line( v_sql_string );
    --execute immediate v_sql_string into v_no_of_rows;
    end loop;
    END;

    Usually your problem can be described with 'Who cares'. I mean, for what reason do you do this? I doubt that there's a business need to get 100 % accurate answers for this. Normally such things are used to get a picture about the growth of data.
    Personally I would prefer to have up-to-date statistics for all tables and just query the number of rows from there. Sufficient for me in < 99 % of all cases.
    Just my $ .02...

  • Dynamically set maximum row count in Interactive Report

    Hi,
    Has anyone worked out a way of dynamically setting (e.g. via select list) the maximum row count value for an Interactive Report, taking into account issues with order by when the report is filtered. I'm aware of solutions like this: http://www.talkapex.com/2010/10/apex-reports-no-limit-downloads.html but as far as I can tell this doesn't work when the report is filtered and the IR is rewritten in the background. Data sets then become unreliable because they are reordered.
    Thanks,
    Mike

    Hi Mike,
    You can do that with javascript
    gReport.search('SEARCH',100)the 100 you can replace for any number you like.I have a report with filter,sorting and groups and it is gives no problem there.
    any number means any number but not higher than the number you set at Maximum Rows Per Page.
    You probably can mix the solution from Martin and the above code.
    Regards,
    Kees Vlek
    <tt>Company: http://www.orcado.nl
    Blog: http://www.orcado.nl/blog/blogger/listings/69-kvlek
    Twitter: http://www.twitter.com/skier66</tt>
    If the question is answered please change it to answered and mark the appropriate post as correct/helpfull.
    Edited by: kvlek on 24-apr-2013 12:29
    Edited by: kvlek on 24-apr-2013 12:35

  • Finding minimum value in each row using dynamic query

    need to find the minimum and maximum value from each row using dynamic query
    [from curr] will be given as input
    Tuky

    DECLARE @t TABLE(a INT,b INT,c INT);
    INSERT @t VALUES(1,2,3),(9,8,7),(4,6,5);
    SELECT *
    ,      (   SELECT  MAX(val) 
               FROM    (VALUES (a)
                           ,   (b)
                           ,   (c)
                       ) AS value(val)
           ) AS MaxVal 
    ,      (   SELECT  MIN(val) 
               FROM    (VALUES (a)
                           ,   (b)
                           ,   (c)
                       ) AS value(val)
           ) AS MinVal 
    FROM @t;
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • Converting rows to columns using dynamic query.

    I am trying to use the below code that I founnd on the web to conver rows to columns. the reason that I want to use dynamic query is that the number of rows are not know and changes.
    declare
        lv_sql varchar2(32767) := null ;
    begin
        lv_sql := 'SELECT Iplineno ';
        for lv_rec in (SELECT distinct vendor from bidtabs  where letting = '10021200' and call ='021')
        loop
            lv_sql :=   lv_sql
                        || CHR(10)
                        || ', MAX( DECODE( vendor, '
                        || chr(39)
                        || lv_rec.vendor
                        || CHR(39)
                        || ', bidprice, NULL ) ) as "'
                        || lv_rec.vendor
                        || '" ' ;
        end loop;
        lv_sql :=   lv_sql
                    || CHR(10)
                    || 'FROM bidtabs  where letting =  ''10021200''  and call =  ''021''  and lineflag = ''L''  '
                    || CHR(10)
                    || 'GROUP BY iplineno ;' ;
    here is the result
    BIDPRICE     CALL     IPLINENO     LETTING     VENDOR
    9,585     021     0010     10021200     C0104        
    1,000     021     0020     10021200     C0104        
    1,000     021     0030     10021200     C0104        
    17     021     0040     10021200     C0104        
    5     021     0050     10021200     C0104        
    11,420     021     0010     10021200     K0054        
    1,100     021     0020     10021200     K0054        
    1,100     021     0030     10021200     K0054        
    5     021     0040     10021200     K0054        
    3     021     0050     10021200     K0054        
    8,010     021     0010     10021200     V070         
    900     021     0020     10021200     V070         
    1,320     021     0030     10021200     V070         
    11     021     0040     10021200     V070         
    3     021     0050     10021200     V070         
    and here is the desired output
    CALL     IPLINENO     LETTING      C0104              K0054              V070         
    021     0010     10021200      9,585                     11,420                                   8,010
    021     0020     10021200      1,000       1,100     900
    021     0030     10021200      1,000     1,100     1,320
    021     0040     10021200       17     5     11
    021     0050     10021200      5     3     3

    Here is the error message I am getting:
    RA-06550: line 22, column 43:
    PLS-00103: Encountered the symbol "end-of-file" when expecting one of the following:
    begin case declare end exception exit for goto if loop mod
    null pragma raise return select update while with
    <an identifier> <a double-quoted delimited-identifier>
    <a bind variable> << close current delete fetch lock insert
    open rollback savepoint set sql execute commit forall merge
    pipe

  • How to fetch indivdual rows from a dynamic query.

    Hi,
    I wish to fetch the individual rows returned from a dynamic query.
    if my dynamic query is:
    dyn_stmt := select col1, col2, col3
    from tab1;
    The query returns multiple rows.
    Then how to fetch individual rows of this query ?
    Please explain.

    declare
      cur_test sys_refcursor;
      c1 varchar2(30);
      c2 number;
      c3 date;
    begin
      dyn_stmt := select col1, col2, col3 from tab1;
      OPEN cur_test FOR dyn_stmt;
      LOOP
        FETCH cur_test INTO c1, c2, c3;
        IF cur_test%NOTFOUND THEN
          EXIT;
        END IF;
        -- Process this row
      END LOOP;
      CLOSE cur_test;
    END;

  • Column count of dynamic query

    how can ı find column count of dynamic query
    is there a simple way
    thanks

    You can use DBMS_SQL to facilitate this:
    CREATE OR REPLACE FUNCTION count_sql( p_sql IN CLOB )
    RETURN INTEGER
    AS
            lv_cursor_id    INTEGER;
            lv_columns      DBMS_SQL.DESC_TAB;
            lv_column_count INTEGER;
    BEGIN
            -- Open Cursor
            lv_cursor_id := DBMS_SQL.OPEN_CURSOR;
            -- Parse Cursor
            DBMS_SQL.PARSE
            ( c             => lv_cursor_id
            , statement     => p_sql
            , language_flag => DBMS_SQL.NATIVE
            -- Describe Columns
            DBMS_SQL.DESCRIBE_COLUMNS
            ( c       => lv_cursor_id   
            , col_cnt => lv_column_count
            , desc_t  => lv_columns
            -- Close Cursor
            DBMS_SQL.CLOSE_CURSOR(lv_cursor_id);
            RETURN lv_column_count;
    END count_sql;
    /Example:
    SQL > SELECT * FROM V$VERSION;
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
    PL/SQL Release 11.2.0.1.0 - Production
    CORE    11.2.0.1.0      Production
    TNS for 32-bit Windows: Version 11.2.0.1.0 - Production
    NLSRTL Version 11.2.0.1.0 - Production
    SQL > SELECT count_sql('SELECT dummy, dummy, CASE WHEN dummy = ''X'' THEN 1 ELSE 0 END AS col FROM DUAL') FROM DUAL;
    COUNT_SQL('SELECTDUMMY,DUMMY,CASEWHENDUMMY=''X''THEN1ELSE0ENDASCOLFROMDUAL')
                                                                               3
    SQL > SELECT count_sql('SELECT dummy, dummy, dummy, ''Y'' FROM DUAL') FROM DUAL;
    COUNT_SQL('SELECTDUMMY,DUMMY,DUMMY,''Y''FROMDUAL')
                                                     4Hope this helps!

  • Dynamically Add Report Parameters & Get Row Count

    In out Portal reports, we are inserting records into our own logging tables at the beginning of the report and updating the record at the end of the report. Currently, the sequential key has been added as a parameter so that we can access it through-out the report execution. Therefore, it displays on the parameter screen. We don't want the users to see this item. Is it possible to add it to the parameter list without having it display on the screen? Can this be done using a procedure in wwv_standard_util? Any other suggestions?
    Also, we need to get the total row count of the query. Where can we get this value?
    null

    In out Portal reports, we are inserting records into our own logging tables at the beginning of the report and updating the record at the end of the report. Currently, the sequential key has been added as a parameter so that we can access it through-out the report execution. Therefore, it displays on the parameter screen. We don't want the users to see this item. Is it possible to add it to the parameter list without having it display on the screen? Can this be done using a procedure in wwv_standard_util? Any other suggestions?
    Also, we need to get the total row count of the query. Where can we get this value?
    null

  • Dynamic row counter column in Adobe Forms

    Hi Guys,
    My table in Adobe Forms is dynamically created with Conditional Breaks. I want to display 1st column as Sr.No. displaying row counter for tables on each page.
    Anyone have idea how to achieve the same.
    Sr.No
    Name
    Address
    1 (generated in adobe forms dynamically)
    xyz
    awsaxa sadsad
    2 (generated in adobe forms dynamically)
    abc
    asds  sad ads
    so on......
    Regards,
    Naveen

    Hi Guys,
    Not able to find any counter variable for table. So what I did is inserted the counter logically before calling Adobe forms driver program.
    FYI.
    Regards,
    Naveen

  • Different row count for select versus insert in XML query

    Hi,
    I encounter a situation where a SELECT * returns a different rows count than an INSERT INTO... (SELECT *) by xmltable join. This makes no sense at all!!!
    In breif, I tried to convert xml data into traditional relational tables. I wrote an xml query to select data from xmltable... I checked row count. When I used "create table as select" that was the same query above, I got correct row count. However when I used "insert into select" that was the same query above, I got the wrong info in the table I just inserted.
    Does any one have any idea what caused this issue? Thanks for your help.

    DUPLICATE post
    count of rows in a schema tables

  • Method for finding row count after executing query

    Is there a method for finding the row count from the resultset after executing a query on a database ?

    The best way: read the data from the result set. If you read it into e.g. a LinkedList, size() will tell you how many rows you got. Or you could increment a counter.
    There are other ways, such as variants of ResultSet that do the read loop for you. But since you'll be doing the fetch loop anyway, those just add unnecessary work and moving parts.

  • Need to set the Vissible row count Dynamically

    Hi,
       I have requirement where i am supposed to set the Vissible row count for a table dynmaically, depending upon the number of rows in a table.

    Or use a calculated attribute.
    Create an attribute in the context called calcVisibleRowCount of type integer and make it read only and calculated. Then bind that attribute to the visibleRowCount attribute of your table.
    The method for the attribute looks something like this:
    (this displays 10 rows per page if more than 10 records in the node, otherwise it displays the same number of rows in the table as in the context)
      public int getCalcVisibleRowCount(IPrivateStartsida.ILayoutElement element)
        //@@begin getCalcVisibleRowCount(IPrivateStartsida.ILayoutElement)
              if (wdContext.nodeXXXX().size() > 10) {
                   return 10;
              } else {
                   return wdContext.nodeXXXX().size();
        //@@end
    Note that this attribute is not created in the node that you want to count number of elements in.
    Edited by: Richard Linnander on Apr 1, 2011 3:41 PM

  • How to set visible row count dynamically

    i  need to place input field so that user enters value for visible row count in ALV WEBDYNPRO

    Hi Prabhu,
    As Suggested use set_visible_row_count. First count your table entries. based on count display records.
    count = LINES( lt_n_contract ).
      IF count > 5.
        lt_table_settings->set_visible_row_count( value  = 10 ).
      ELSE.
        lt_table_settings->set_visible_row_count( value  = 3 ).
      ENDIF.
    Cheers,
    Kris.

Maybe you are looking for

  • Development Environment for Portal development with mini was?

    Hello! is there a mini web-as java version which can be used for local portal development?

  • ALV table in edit mode

    hi all,    have a requirement where I have to create a webdynpro for ABAP table for new row/rows entry, delete row/rows and update row/rows data. This is something like table control in normal ABAP. how can I achieve this? Is there any such feature i

  • Iphone 5 screen suddenly goes black

    Has anyone ever had their iPhone screen suddenly go black?

  • Bind output of a strored procudure

    Hi All, I am trying to call a stored procedure from sql editor using the below syntax. call "sys_bic"."store_proc"("test") store_proc takes a scalar input parameter and returns a table type as out put parameter. Can anyone please let me know how to b

  • Aggregates Transport

    Hello forum. I have created a aggregate for a Infocube in BI-7.0 environment. I have a transport request for this aggregate,but when I import it to my integration It does not reflect in integration system. Currently the transport request contains onl