Select ... in (select ....) retrieves all rows

Hi guys,
I have the following situation:
Table_A
ID NUMBER
NAME VARCHAR2(10)
TABLE_B
ID_B
NAME_B VARCHAR2(10)
By mistake I did the following query:
Select *
from table_a
where id in (select ID from table_b);
My question is: Why the query return all rows from TABLE_A if in the inner select (select ID...) I'm didn't write any of the columns that exist on TABLE_B.?
Hope this is clear.!.
thanks in advance.

select *
from table_a
where id in (select ID from table_b);The subquery will attempt to resolve the column named "ID" first within the subquery itself, then (if it doesn't find it) in the parent query. Since there is no ID column in table_b, the query actually becomes something like
select *
from table_a a
where a.id in (select a.id from table_b);
in other words
select *
from table_a
where id = id
which is equivalent to
select *
from table_a
where id IS NOT NULL
HTH

Similar Messages

  • Query Results: Retrieve All Rows?

    I was looking for a feature that will allow me to choose to return "all records" to the Query Results window. The current behavior is to fetch 50 records at a time (e.g. fetch 50 records as you scroll through the results = s-l-o-w). What I'd like to do is "Retrieve All Rows" then use to the scroll bar to "smoothly" scroll to the last record. For example, the 8.0.6 version of Query Builder had this functionality and in SQL Developer 3.0, if I right-click on the results. I can choose to "Count Rows...", seems like this would be a perfect place to put a "Retrieve All Rows" option.

    Hi,
    My advice: do something only if there is a business case for it; satisfying your curiosity can get surprisingly expensive.
    You have already read about using Run Statement to execute a SQL statement, then Ctrl-End to auto-scroll to the end. You can try the same for Run Script, but first you will probably need to increase the value of Tools|Preferences|Database|Worksheet|Max rows to print in a script. Of course, taking either of these approaches slows things down due to displaying output and scrolling. Same with SQL*Plus. And, as mentioned previously, Java memory management in SQL Developer can cause slow downs and hangs if the result set is large enough.
    Here is a way to minimize that delay, avoid hangs, and get a more repeatable result:
    1) Save some query to, say, C:\Temp\AllCustomers.sql. For example, "select * from customers;" or "select id from customers;".
    2) Run it from a SQL Developer worksheet using Run Script (F5), or from the SQL*Plus command line, with a script like this:
    set timing on
    set termout off
    spool C:\Temp\AllCustomers.lst
    @C:\Temp\AllCustomers.sql
    spool offEven then you will see that the timing results will vary. Maybe "select *" runs much slower than "select id" because the logical output lines are long and get wrapped into multiple physical output lines in the file. Minimize that by setting linesize to a longer value (but only in SQL*Plus -- it isn't supported in SQL Developer) and repeat the test to see. Maybe SQL*Plus runs it much faster than SQL Developer because one is a command line environment and the other a GUI tool with more overhead. Or maybe the SQL Developer JVM is near its size limit and lots of Java garbage collection is slowing it down. Simple question, complicated answer.
    Regards,
    Gary
    SQL Developer Team
    P.S.: And if by chance you are using a version of SQL Developer so old it does not include the output time in the query result tab's toolbar, using Run Script with set timing on is your only recourse.
    Edited by: gggraham on Oct 27, 2011 4:54 PM

  • Retrieve All Rows in Disocverer Plus

    Hi,
    Can we set the 'Retrieve All Rows' option in Discoverer Plus ?
    I can go to Tools > Retrieve All Rows. But is there any way (like a checkbox) we can set it permanantly so that every user need not to look into it ?
    Thanks!
    Yogini

    Hi,
    As a workaround, I changed the value for :
    Tools > options > Query Governor >
    Retrieve Data incrementally in groups of = 10000 (This is the max value ).
    But it didnt work.
    It retrieves first 250 rows (by default) and then it says 'Click to retrieve next 10000 rows'..its not what I want.
    Any Suggestions?
    Yogini

  • How can I retrieve all row information from a database table.

    I have a jsp file which calls info from columns in a table. My question, is how can I edit it so that it retrieves all the rows?
    I tried using resultset SalesInfo.next() which only retrieves the last row value and resultset SalesInfo.first() which only retrieves the first row value.
    Here is my code
    public ResultSet SalesInfo;
    public void getSalesInfo()
              try
                   Statement stmt = db.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
                   SalesInfo = stmt.executeQuery("SELECT sales_id,cust_id,product_id, quantity from sales;");
                   SalesInfo.first();
                   setCartsales_id (SalesInfo.getString("sales_id"));
                   setCartcust_id (SalesInfo.getString("cust_id"));
                   setCartProduct_id(SalesInfo.getString("product_id"));
                   setCartquantity (SalesInfo.getString("quantity"));
              catch(SQLException e )
                   setCartsales_id(e.toString());
                   e.printStackTrace();
    Also I apologise for not having the proper code format as I had a problem with my keyboard.

         public class SalesDB{
        public static synchronized Vector getSalesDetail(Connection connection) throws SQLException{
            String query = "SELECT * from Sales;"
           Statement statement = connection.createStatement();
            ResultSet results = statement.executeQuery(query);
            Vector sale_details = new Vector();
            while(results.next() == true){
         SaleInfo saleInfo = new    SaleInfo(results.getString("sales_id"),results.getDouble("cust_id"),results.getString("product_id"));
                sale_details.add(saleInfo);
            results.close();
            statement.close();
            return sale_details;
    }

  • Resultset - retrieves all rows or only one at a time

    Hey guys,
    I am using oracle DB. Lets say the query i run has about 1000 records
    when i call:
    prepareStmt(cstmt);
    Rsultset rs = cstmt.executeQuery();
    Do I get all the records, or do i get them one by one
    when i call
    rs.next
    is this DB specific??
    This is simple q, but i been working with oracle and java for a while, and for some reason this never came up.
    thank you.

    The driver implementation is free to retrieve as many or as few rows at a time from the database as it wants. You can suggest to the driver how many rows at a time it should retrieve with setFetchSize(); the driver is free to ignore your suggestion (but many drivers honor it). The fetch size default varies wildly from driver to driver, from 1 row at a time to all rows at a once. For the Oracle thin driver, the default is 10, which is usually too small to give the best performance (I use between 100 and 1,000, usually 250).
    Note that when you're working with a very large ResultSet, a driver that does "all rows at once" can cause you to run out of memory. Also, some drivers will cache every single row when using a scrollable ResultSet (and again run you out of memory) but not do so with a forward-only ResultSet (Oracle has this issue).

  • Improving a simple select query, which uses all rows.

    Hi All,
    Please excuse me if the question is too silly. Below is my code
    SQL> select * from v$version;
    BANNER
    Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod
    PL/SQL Release 10.2.0.1.0 - Production
    CORE    10.2.0.1.0      Production
    TNS for 32-bit Windows: Version 10.2.0.1.0 - Production
    NLSRTL Version 10.2.0.1.0 - Production
    Elapsed: 00:00:00.07
    SQL> show parameter optim
    NAME                                 TYPE        VALUE
    object_cache_optimal_size            integer     102400
    optimizer_dynamic_sampling           integer     2
    optimizer_features_enable            string      10.2.0.1
    optimizer_index_caching              integer     0
    optimizer_index_cost_adj             integer     100
    optimizer_mode                       string      ALL_ROWS
    optimizer_secure_view_merging        boolean     TRUE
    plsql_optimize_level                 integer     2
    SQL> explain plan for select SUM(decode(transaction_type,'D',txn_amount,0)) payments_reversals,
      2          SUM(decode(transaction_type,'C',txn_amount,0)) payments,primary_card_no,statement_date
      3             from credit_card_pymt_dtls  group by primary_card_no,statement_date;
    Explained.
    SQL> select * from table(dbms_xplan.display);
    PLAN_TABLE_OUTPUT
    Plan hash value: 2801218574
    | Id  | Operation          | Name                  | Rows  | Bytes |TempSpc| Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT   |                       |  1912K|    56M|       | 21466   (3)| 00:04:18 |
    |   1 |  SORT GROUP BY     |                       |  1912K|    56M|   161M| 21466   (3)| 00:04:18 |
    |   2 |   TABLE ACCESS FULL| CREDIT_CARD_PYMT_DTLS |  1912K|    56M|       |  4863   (3)| 00:00:59 |
    9 rows selected.
    SQL> select index_name,index_type
      2  from all_indexes
      3  where table_name = 'CREDIT_CARD_PYMT_DTLS';
    INDEX_NAME                     INDEX_TYPE
    INDX_TRANTYPE                  BITMAP
    INDX_PCARD                     NORMAL
    INDX_PSTATEMENT_DATE           NORMALThe query is using all the records in the CREDIT_CARD_PYMT_DTLS table. Transaction type will be either 'C' or 'D'.
    CREDIT_CARD_PYMT_DTLS has 2 million rows and the qury will output 1.5 million rows. Table statisticas are upto date.
    The query now is taking almost 5 minutes. Is thaere any way to reduce the time ?
    Our DB server has 8 CPUs and 8 GB memory. Is the timing genuine ?
    Thanks in Advance.
    Edited by: user11115924 on Apr 29, 2009 2:43 AM
    All the columns used in the query are already indexed. ( Ofcourse, not only for this query.)

    Hi All,
    Thanks for the helps provided. Expecting it once more..
    My actual query is as below
    select     primary_card_no,base_segment_number,atab.previous_balance,current_balance,intrest_amt_due_this_cycle,total_min_amt_due,total_credit_limit,
              total_purchase_this_cycle,total_cash_trns_this_cycle,available_credit_limit,payments,utilization,payment_ratio,payments_reversals,cash_limit,
              available_cash_limit, description
    from
           select primary_card_no,DECODE(base_segment_number,NULL,primary_card_no,base_segment_number) base_segment_number,
                   SUM(previous_balance) previous_balance,SUM(current_balance) current_balance ,SUM(intrest_amt_due_this_cycle) intrest_amt_due_this_cycle,
                   SUM(total_min_amt_due) total_min_amt_due,SUM(total_credit_limit_all) total_credit_limit,
                   SUM(total_purchase_this_cycle) total_purchase_this_cycle,SUM(total_cash_trns_this_cycle) total_cash_trns_this_cycle,
                   SUM(available_credit_limit) available_credit_limit,SUM(payments) payments,
                   (SUM(NVL(current_balance,0)) / SUM(total_credit_limit_all)) * 100 utilization,
                   (SUM(NVL(payments,0)) / DECODE(SUM(previous_balance),0,NULL,SUM(previous_balance))) * 100 payment_ratio,
                   SUM(payments_reversals) payments_reversals,SUM(cash_limit) cash_limit,SUM(available_cash_limit) available_cash_limit
          from
            ( select a.*,NVL(payments_reversals,0)payments_reversals ,NVL(payments,0) payments
              from
                    (  select primary_card_no,previous_balance,current_balance,intrest_amt_due_this_cycle,total_min_amt_due,total_purchase_this_cycle,
                              total_cash_trns_this_cycle,statement_date,available_credit_limit,cash_limit,available_cash_limit,
                           (case when statement_date <= TO_DATE('301108','ddmmyy') then NULLIF(total_credit_limit,0)
                                      else NULLIF((select credit_limit
                                                from ccm_dbf_chtxn_v0 t1
                                                   where t1.batch_id = '011208'
                                                   and SUBSTR(t1.card_number,4) = a.primary_card_no),0)
                             end) total_credit_limit_all
                     from
                        ( select primary_card_no,previous_balance,current_balance,INTREST_AMT_DUE_THIS_CYCLE,
                                    TOTAL_MIN_AMT_DUE,TOTAL_PURCHASE_THIS_CYCLE,TOTAL_CASH_TRNS_THIS_CYCLE,statement_date,
                                   AVAILABLE_CREDIT_LIMIT,cash_limit,available_cash_limit,total_credit_limit
                          from credit_card_master_all@FGBAPPL_LINK
                        ) a
                     where statement_date between ADD_MONTHS(TRUNC(SYSDATE,'mm'),-6) and  TRUNC(SYSDATE,'mm')-1
                 ) a,
                 ( select SUM(decode(transaction_type,'D',txn_amount,0)) payments_reversals,
                               SUM(decode(transaction_type,'C',txn_amount,0)) payments,primary_card_no,TO_CHAR(statement_date,'MON-RRRR') sdate
                    from credit_card_pymt_dtls 
                    group by primary_card_no,TO_CHAR(statement_date,'MON-RRRR')
                 ) b
             where TO_CHAR(a.statement_date,'MON-RRRR')= b.sdate(+)
               and a.primary_card_no= b.primary_card_no(+)
            ) a,
            (  select SUBSTR(a.card_number,4) card_number,base_segment_number,TO_DATE(account_creation_date,'DDMMYYYY') account_creation_date,
                           a.batch_id, credit_limit credit_limit_current
                from
                       (  select *
                           from ccm_dbf_phtxn_v0
                           where batch_id=  (SELECT to_char(MAX(TO_DATE(SUBSTR(BATCH_ID,1,6),'DDMMRR')),'DDMMRR') FROM CCM_MST_V0)
                        ) a,
                        ( select *
                          from ccm_dbf_chtxn_v0
                          where batch_id=(SELECT to_char(MAX(TO_DATE(SUBSTR(BATCH_ID,1,6),'DDMMRR')),'DDMMRR') FROM CCM_MST_V0)
                        ) b
                where a.card_number=b.card_number
                and TO_NUMBER(ROUND(MONTHS_BETWEEN(SYSDATE,TO_DATE(account_creation_date,'DDMMYYYY')),2)) >=6
                and a.company ='BNK'
            ) b
       where a.primary_card_no = b.card_number
       group by primary_card_no,base_segment_number) atab, card_summary_param btab
    where utilization between utilization_low and utilization_high
    and payment_ratio between  payment_ratio_low and payment_ratio_high
    and SIGN(atab.previous_balance) =btab.previous_balanceWhere I have to put the PARALLEL hint for maximum performance?
    Sorry for asking blindly without doing any R&D. Time is not permitting that...
    Edited by: user11115924 on Apr 29, 2009 5:09 AM
    Sorry for the kiddy aliases.. Query is not written by me..

  • How can we retrieve all rows following a particular records in a table.

    Hi all,
    i've to fetch all records following a particular rcord in a table..
    for ex. we have 4 rows :
    col1 col2 col3
    A A1 A2
    B B1 B2
    C C1 C2
    D D1 D2
    How can i retrieve rows following B record. plz. help me
    Thx.

    It depends what you mean by "following". Tables don't have an innate ordering. If you selected all the rows from this table they wouldn't necessarily turn up in that order.
    All you can do is create a query ordering by one or more of the columns (in this case you appear to want lexical order) and then select on the basis that the column values exceed a set of values.
    For example, with your data this happens to work:
    select * from yourtable where col1 > 'B' order by co1;But I very much doubt that this is what you actually need to do, and it is VERY important that you grasp that tables do not have any innate ordering.

  • Retrieve all rows when condition is met

    hi all, consider the following data.
    WITH table1 AS
      SELECT 1 amt, 'dummy' txt, 'R' txt2 , '1X' pid FROM dual UNION ALL
      SELECT 123 amt, 'CATS' txt, 'P' txt2, '1X' pid FROM dual UNION all
      SELECT 145 amt, 'CAR' txt, 'PR' txt2, '1X' pid FROM dual UNION all
      SELECT 165 amt, 'NAME' txt, 'P' txt2, '1X' pid FROM dual UNION ALL
      SELECT 166 amt, 'NAME' txt, 'PK' txt2, '1X' pid FROM dual UNION all
      SELECT 100 amt, 'dummy' txt, 'R' txt2, '2X' pid FROM dual UNION ALL
      SELECT 13 amt, 'CATS2' txt, 'P' txt2, '2X' pid FROM dual UNION all
      SELECT 15 amt, 'CAR2' txt, 'PR' txt2, '2X' pid FROM dual UNION all
      SELECT 15 amt, 'NAME2' txt, 'P' txt2, '2X' pid FROM dual
    )i want to display the following output
    AMT  TXT    TXT2  PID
    ========================
    1    DUMMY  R     1X
    123  CATS   NO    1X
    145  CAR    NO    1X
    165  NAME   NO    1X
    166  NAME   PK    1X
    100 DUMMY   R     2X
    13  CATS2   P     2X
    15  CAR2    PR    2X
    15  NAME2   P     2Xthe logic behind this output is as follow:
    when i find a row where amount is 1 or -1 and txt=dummy, i want to take the pid value of that row and find all the rows with that pid where txt2 in (P,PR) and set the value of txt2 to NO.
    if txt2 is not in P OR PR, then set the column to current Value
    eg. the first row in data above has amt=1 and txt=dummy. i will take the pid of this row which is 1X and find all other rows with that pid value and txt2 in P,PR.
    in this case i found row with amt=123,145,165. i display those rows in output but txt2 change TO NO.
    if you notice , row with amt=166 was not change because txt2 = PK. in the second set of data, i display the data as is since i could not find a row with amt in(1,-1) and txt=dummy
    can someone help me write a query to display the above output?

    WITH table1 AS
      SELECT 1 amt, 'dummy' txt, 'R' txt2 , '1X' pid FROM dual UNION ALL
      SELECT 123 amt, 'CATS' txt, 'P' txt2, '1X' pid FROM dual UNION all
      SELECT 145 amt, 'CAR' txt, 'PR' txt2, '1X' pid FROM dual UNION all
      SELECT 165 amt, 'NAME' txt, 'P' txt2, '1X' pid FROM dual UNION ALL
      SELECT 166 amt, 'NAME' txt, 'PK' txt2, '1X' pid FROM dual UNION all
      SELECT 100 amt, 'dummy' txt, 'R' txt2, '2X' pid FROM dual UNION ALL
      SELECT 13 amt, 'CATS2' txt, 'P' txt2, '2X' pid FROM dual UNION all
      SELECT 15 amt, 'CAR2' txt, 'PR' txt2, '2X' pid FROM dual UNION all
      SELECT 15 amt, 'NAME2' txt, 'P' txt2, '2X' pid FROM dual
    SELECT  amt,
            txt,
            case
              when txt2 in ('P','PR')
                then case max(case when txt = 'dummy' and amt in (1,-1) then 1 end) over(partition by pid)
                       when 1
                         then 'NO'
                       else txt2
                     end
              else txt2
            end txt2,
            pid
      FROM  table1
           AMT TXT   TX PI
             1 dummy R  1X
           123 CATS  NO 1X
           145 CAR   NO 1X
           165 NAME  NO 1X
           166 NAME  PK 1X
           100 dummy R  2X
            13 CATS2 P  2X
            15 CAR2  PR 2X
            15 NAME2 P  2X
    9 rows selected.
    SQL>  SY.
    Edited by: Solomon Yakobson on May 4, 2011 5:35 PM

  • I am unabel to select all rows in advance table using Select All option

    Hi all ,
    I am unable to select all the rows in advance table . Select All option in advance table selects all rows present in working page but doesnt select the rows which we get by clicking next button ... i am having a requirement to select all the rows with a single click on select all , is it possible ..
    Plz help
    Thanking you all

    Hi,
    I'm using an adf table but i don't want to have the "Select All" and "Select None" options above the table. Does someone know how i have to remove those links?
    Or is there indeed a solution to override the methodes of those links?
    Message was edited by:
    Alexander

  • Select ALL rows in ALV by an ACTION

    Hi All -
    Is possible to have a button with an Action "select all" and when the user trigger that action all the records in the ALV are selected?
    i.e ALV has 10 records (lines or rows) and user click on a button with text "SELECT ALL" and once they click that button all the rows/lines are selected.
    Thanks!
    Jason P-V

    Hi ,
    yes it can be done....
    here is the procedure to do it.....
    first we need to make the context node "selection" property equals to "0..n"  you can find this property at your component controller level.....where you set your "cardinality" as well...
    than create a button in your view layout where the alv is being displayed and write the following code for button action:
    DATA lo_nd_alv_table TYPE REF TO if_wd_context_node.
    navigate from <CONTEXT> to <alv_table> via lead selection
       lo_nd_alv_table = wd_context->get_child_node( name = wd_this->wdctx_alv_table ).
    DATA counter TYPE i.
      counter =   lo_nd_alv_table->get_element_count( ).
      DO counter TIMES.
          lo_nd_alv_table->set_selected(
        EXPORTING
        index = sy-index ).
      ENDDO.
    I just tested this...and it worked for me....
    Thanks...
    AS...
    Just forgot to mention....if you want to de-select them all...you can use the method:
    lo_nd_alv_table->CLEAR_SELECTION(
    the above code can be put in in the btn action method.....say you have two btns one to select all rows and one to de-select all....
    this code can go under de-select all btn action method.....
    Edited by: J Are on Dec 11, 2009 8:53 PM

  • Selecting all rows in ALV on a button click

    Hi Experts
    Hi,
    I have a dynamic ALV table. I also have a button 'Select All Rows'. On clicking the button I want all the rows in the ALV table selected which is done by using set_selected method at the context node.
    All the rows in the alv is selected after clicking select_all except for the first row.
    Need your inpts to solve the same.
    Regards
    Karthick

    Use the folowing code
    *... get model
      data:
        lr_model type ref to cl_salv_wd_config_table.
      lr_model ?= me->r_model.
    *... get columns
      data:
        ls_column type salv_wd_s_column_ref,
        lt_column type salv_wd_t_column_ref.
      lt_column = lr_model->if_salv_wd_column_settings~get_columns( ).
      data:
        l_selected type abap_bool.
      loop at lt_column into ls_column.
        l_selected = abap_false.
        read table value transporting no fields with key column = ls_column-id.
        if sy-subrc eq 0.
          l_selected = abap_true.
        endif.
        try.
            me->if_salv_bs_model_column~set_selected(
              column = ls_column-id
              value = l_selected ).
          catch cx_salv_bs_sc_object_not_found.             "#EC NO_HANDLER
        endtry.
      endloop.

  • Select All rows  in WebDybpro Tables

    Hi All ,
    I am working on NWCE 7.1 . i have table in my UI. and want to give slect all rows functionality in table. in NWCE is there
    any way to give select all rows in table with out using , button and writing action to iterate node bound to table.
    also i want to know about RowCreator ui element for table.(when we right click on table we get insert -> rowcreator). How this works
    Thanks in advance
    Regards
    Kavita

    Hi Kavita,
    The row creator Ui element is not visible in table itself you can see it only in outline window.
    and in its on create event you have to write the code which i have provided above. it will not be visible in table at design time but at run time when you will click on the last rows lead selection it will call the associated event and one row will be added to the table.
    Regards
    Jeetendra

  • Select all rows in af:table

    Hi,
    I need to select all rows in af:table, not only on current page.
    I have following code on custom select all action:
    getTable2().getSelectionState().addAll()and on button that needs to perform some action on selected rows I have this code
            Set selectedRowSet = getTable2().getSelectionState().getKeySet();
            if (!selectedRowSet.isEmpty()) {
                Iterator it = selectedRowSet.iterator();
                while(it.hasNext()) {
                    Key key = (Key)it.next();
           }selectedRowSet.iterator() method throws java.lang.ClassCastException: oracle.jbo.Key.
    When I select rows with af:tableSelectMany, which is inside selection facet and selects only rows on current page, this works fine.
    Any ideas?
    Thanks

    Hi,
    you can only access those data that is queried and part of the CollectionModel to the time you select all
       RichTable _table = employeesBackingBean.getEmployeeTable1();
       RowKeySet rks = new RowKeySetImpl();
      CollectionModel model = (CollectionModel)_table.getValue();
      int rowCount = model.getRowCount();
          for (int i = 0; i < rowCount; i++) {
               model.setRowIndex(i);
               //note that in the simple POJO case, the row key is the same
               //as the index. However, it would be wrong to just rely on this
               //because other models or custom table models my return a more
               //comples key. Therefore we iterate over the available rows to
               //obtain the keys.
               Object key = model.getRowKey();
               //add the row keys to the RowKeySet to mark selected
               rks.add(key);
       _table.setSelectedRowKeys(rks);
       AdfFacesContext.getCurrentInstance().addPartialTarget(_table);Frank
    Frank

  • HOW TO SELECT ALL ROWS IN A MULTI SELECT TABLE!!!!!

    Hello
    I have a table with tableSelectMany component. how can I set the page to initially select all rows when first opened?????

    efffffttttttt? are you saying you will do an electronic funds funds funds funds funds transfer transfer transfer transfer transfer transfer to anyone who answers?
    What version of JDeveloper are you using - that is quite important in order to be able to give you an answer.
    What also might be useful is "please" and "thank you" instead of SHOUTING IN ALL CAPS THAT YOUR QUESTION IS IMPORTANT. Realizing that you asked this question over a weekend when most people dont sit and read the forum...
    You have a habit of saying all your questions are URGENT!!!!!! which is generally considered, um...., impolite.

  • How to set selected all rows in h:dataTable

    hello, I want to selected all rows in a dataTable.
    I use JS to got it:
    the selectBooleanCheckbox in the header of row:
    <t:selectBooleanCheckbox id="aa" value="#{list.checkbox}" />the JS code :
    <script type="text/javascript" language="JavaScript1.2">
        function selectAll(obj, first, size) {
            for (var i = 0; i < size; i++) {
                var current = eval(first - 1 + i);
                var objs = document.getElementById("form:listbody:listtable:" + current + ":aa");
                obj.checked ? objs.checked = true : objs.checked = false;
    </script>and the "selectall" code:
    <h:selectBooleanCheckbox id="selectAll"
                                  onclick="javascript:selectAll(this,#{firstRow},#{displayedRowsCount})"/>It run good in IE,but not it does not work in firefox.
    Are there some method to do?
    Or is there a method to select all rows just use JSF?
    Needs you help!

    Yes, the paging for <h:dataTable> works pretty good, it manages the task through four methods created in the java code -- DataTable1_firstPageAction(), DataTable1_previousPageAction(), DataTable1_nextPageAction(), DataTable1_lastPageAction() -- without adding any javascript in the jsp page.
    Maybe I could test if a java script similar to the <ui:table>'s one fit also the dataTable...
    thanks

Maybe you are looking for