Move rows within a table using buttons

Hello Guys,
I am trying to create a dynamic table and I have been trying to figure out how best to do it. Here are my requirements
1) The table will have 12 rows, the number of rows will not change.
2) The table will have 2 columns.
3) The point of the table is for the user to reorder based on priority.
4) The data must persist when saved (this one i know how to do).
I have been creating a subform around a row and adding a up and down arrow buttons to each one. I was going to use a moveinstance command but I don't quite understand how the indexing will work.
If you guys have a better suggestion or an example, i would really appreciate it.
Thanks,
roger.

Hi,
Repeatable objects have a zero-based numbering system. So Row1 with 12 instances, would look like Row1[0], Row1[1], ... Row1[11].
So the following Javascript would move the row up:
if (Row1.index != 0)
     var nIndexFrom = Row1.index;
     var nIndexTo = Row1.index - 1;     
     _Row1.moveInstance(nIndexFrom, nIndexTo);     
else
     xfa.host.beep("3");
A similar script would move the row downwards. Note I have used Row1.index, you could also use this.parent.index if the button is in the row. If it is buried in subforms, you may need this.parent.parent.index, to get to the instance of the repeating object.
Hope that helps,
Niall

Similar Messages

  • Drag and drop row within same table.

    Version 12.1.2
    I am trying to implement drag and drop row within same table, and I am trying to follow this sample from Frank:
    http://www.oracle.com/technetwork/developer-tools/adf/learnmore/106-reorder-table-rows-1921121.pdf
    But, I am getting this cast exception. The code I have in my dropEvent bean is identical to whats on the sample.
    oracle.jbo.server.ViewRowImpl cannot be cast to oracle.jbo.uicli.binding.JUCtrlHierNodeBinding
    ADF_FACES-60097:For more information, please see the server's error log for an entry beginning with: ADF_FACES-60096:Server Exception during PPR, #1
    Not sure if anything has changed on 12c release, or if I am missing anything.
    Here is my complete code:
    public DnDAction doDnD(DropEvent dropEvent) {
    RichTable table = (RichTable) dropEvent.getDragComponent();
    List dropRowKey = (List) dropEvent.getDropSite();
    if (dropRowKey == null) {
    return DnDAction.NONE;
    Transferable t = dropEvent.getTransferable();
    DataFlavor<RowKeySet> df = DataFlavor.getDataFlavor(RowKeySet.class, "rowmove");
    RowKeySet rks = t.getData(df);
    Iterator iter = rks.iterator();
    List draggedRowKey = (List) iter.next();
    JUCtrlHierNodeBinding draggeRowNode = (JUCtrlHierNodeBinding) table.getRowData(draggedRowKey);
    Row dragRow = draggeRowNode.getRow();
    JUCtrlHierNodeBinding dropRowObject = (JUCtrlHierNodeBinding) table.getRowData(dropRowKey);
    Row dropRow = dropRowObject.getRow();
    //get the table's ADF JUCtrlHierBinding
    CollectionModel collectionModel = (CollectionModel) table.getValue();
    JUCtrlHierBinding treeBinding = (JUCtrlHierBinding) collectionModel.getWrappedData();
    DCIteratorBinding objectsIterator = treeBinding.getDCIteratorBinding();
    RowSetIterator rsi = objectsIterator.getRowSetIterator();
    int indexOfDropRow = rsi.getRangeIndexOf(dropRow);
    dragRow.removeAndRetain();
    rsi.insertRowAtRangeIndex(indexOfDropRow, dragRow);
    objectsIterator.setCurrentRowIndexInRange(indexOfDropRow);
    AdfFacesContext adfctx = AdfFacesContext.getCurrentInstance();
    adfctx.addPartialTarget(table.getParent());
    return DnDAction.MOVE;
    It does not seem to like this line of code:
    JUCtrlHierNodeBinding draggeRowNode = (JUCtrlHierNodeBinding) table.getRowData(draggedRowKey);
    I would greatly appreciate any help.
    Thanks.

    Well there has bee a changes somehow. using 12c
    table.getRowData(draggedRowKey);
    returns a ViewRowImpl and no longer anything which can be convertet to JUCtrlHierNodeBinding. Anyway, the fix is easy:
        public DnDAction onDepartmentsRowDrop(DropEvent dropEvent) {
            //get the table instance. This information is later used
            //to determine the tree binding and the iterator binding
            RichTable table = (RichTable) dropEvent.getDragComponent();
            List dropRowKey = (List) dropEvent.getDropSite();
            //if no dropsite then drop area was not a data area
            if (dropRowKey == null) {
                return DnDAction.NONE;
            //The transferable is the payload that contains the dragged row's
            //row key that we use to access the dragged row handle in the ADF
            //iterator binding
            Transferable t = dropEvent.getTransferable();
            //get the row key set of the dragged row. The "rowmove" string is the
            //discriminant defined on the drag source and the collectionDrop target.
            DataFlavor<RowKeySet> df = DataFlavor.getDataFlavor(RowKeySet.class, "rowmove");
            RowKeySet rks = t.getData(df);
            Iterator iter = rks.iterator();
            //for this use case the re-order of rows is one-by-one, which means that the rowKeySet
            //should only contain a single entry. If it contains more then still we only look at a
            //singe (first) row key entry
            List draggedRowKey = (List) iter.next();
            //get access to the oracle.jbo.Row instance represneting this table row
            Object objdragg = table.getRowData(draggedRowKey);
            Row dragRow = (Row) objdragg;
            Object objdrop = table.getRowData(dropRowKey);
            Row dropRow = (Row) objdrop;
            //get the table's ADF JUCtrlHierBinding
            CollectionModel collectionModel = (CollectionModel) table.getValue();
            JUCtrlHierBinding treeBinding = (JUCtrlHierBinding) collectionModel.getWrappedData();
            //get access to the ADF iterator binding used by the table and the underlying RowSetIterator.
            //The RowSetIterator allows us to remove and re-instert the dragged row
            DCIteratorBinding departmentsIterator = treeBinding.getDCIteratorBinding();
            RowSetIterator rsi = departmentsIterator.getRowSetIterator();
            int indexOfDropRow = rsi.getRangeIndexOf(dropRow);
            //remove dragged row from collection so it can be added back
            dragRow.removeAndRetain();
            rsi.insertRowAtRangeIndex(indexOfDropRow, dragRow);
            //make row current in ADF iterator.
            departmentsIterator.setCurrentRowIndexInRange(indexOfDropRow);
            //ppr the table
            AdfFacesContext adfctx = AdfFacesContext.getCurrentInstance();
            //note that the refresh of the table didn't work when refreshing the table
            //so I needed to refresh the container component (af:panelStretchLayout).
            adfctx.addPartialTarget(table.getParent());
            return DnDAction.MOVE;
    does the trick. I changed the line to
    //get access to the oracle.jbo.Row instance represneting this table row
            Object objdragg = table.getRowData(draggedRowKey);
            Row dragRow = (Row) objdragg;
    so you don't need the detour through the JUCtrlHierNodeBinding any longer.
    Timo

  • Best practice for deleting multiple rows from a table , using creator

    Hi
    Thank you for reading my post.
    what is best practive for deleting multiple rows from a table using rowSet ?
    for example how i can execute something like
    delete from table1 where field1= ? and field2 =?
    Thank you

    Hi,
    Please go through the AppModel application which is available at: http://developers.sun.com/prodtech/javatools/jscreator/reference/codesamples/sampleapps.html
    The OnePage Table Based example shows exactly how to use deleting multiple rows from a datatable...
    Hope this helps.
    Thanks,
    RK.

  • Updating a row of a table using rowid

    Hi folks,
    I am trying to update some rows in a table using rowid of the corresponding rows.Sometimes this updates wrong rows. This is because ORACLE by itself makes some statistics on the particular table using "Analyze table..." statement and it changes the order of the rowids. But if I delete the statistics,the updation works fine. Is there any way to update the correct rows and also to keep the statistics created by ORACLE? P.s: I am using ORACLE thin Driver to connect to Oracle 8.1.6
    Thanks,
    Karthi.

    First make it clear: analyze table command never changes ROWIDs. Actually, the ROWID of a row never changes untill it's deleted from its table. So make sure if you are using the correct ROWID.
    Thnx

  • Inserting multiples rows into a table using function or procedure..

    How do i insert multiples rows into a table using function or procedure?
    Please provide me query..

    Use FORALL bulk insert statement...
    eg:
    procedure generate_test_data as
    type cl_itab is table of integer index by pls_integer;
    v_cl_itab cl_itab;
    type cl_vtab is table of varchar2(25) index by pls_integer;
    v_cl_vtab cl_vtab;
    type cl_dtab is table of date index by pls_integer;
    v_cl_dtab cl_dtab;
    begin
    for i in 1.. 100 loop
              v_cl_itab(i):= dbms_random.value(1,1000);
              v_cl_vtab (i):=dbms_random.string('a',20);
              v_cl_dtab (i):=to_date(trunc(dbms_random.value(2453737, 2454101)),'j');          
         end loop;
         forall i in v_cl_itab.first .. v_cl_itab.last
              execute immediate 'insert into test_order values( :n, :str , :dt ) ' using v_cl_itab(i), v_cl_vtab (i), v_cl_dtab (i);          
         commit;
    end;

  • Delimited String To A Single Row Within A Table

    I'll try to make a simple example of what I am trying to accomplish...
    Let's say that I have a table (Blah) which has the following Fields:
    User, DateTime, Q1, Q2.... all the way to Q50.  The Questions are radios with a value of 1,0, or null.
    Since I didn't want to manually make 50 different items for the Radio questions, I am creating them from Javascript within a Region Source; as well as giving them id's and names.  This worked fine.
    When I hit a submit button, I have Javascript create a delimited string for the questions, which I pass to a Shared Item.  (1,0,1,1,null,0,etc...)  I then have the Javascript run a Shared Procedure for the Insert into my Table.
    Here is where I am stuck.  I am confused on how to merge the delimited string into my Insert statement, from PL/SQL.
    Here is a dummied down sample of what I am trying to write.  (Shared Item is :ITEM_ARRAY, with a delimiter of ~:~ )
    DECLARE
        array APEX_APPLICATION_GLOBAL.VC_ARR2
    BEGIN
        array := APEX_UTIL.STRING_TO_TABLE(:ITEM_ARRAY, ':~:' );
        INSERT INTO tbl_blah (
            :APP_USER
            ,SYSDATE
             FOR z IN 1..array.count LOOP
                 array(z);
             END LOOP;
    END;
    Every which way I tried, I always get Not Enough Values Error.
    I tried to make everything in a delimited string as well:
    Insert Into tbl_blah (SELECT * FROM array)
    Can someone please enlighten me on the correct way to do this.  All of the examples I have seen are to write to multiple rows, via the loop.  I want to just have 1 record, horizontally.
    Thanks !!!

    Hi,
    Why can't you insert a row into table with first two columns and do update for that row???
    Just for simple work around, I have created a table with below columns,
    USER_NAME VARCHAR2 
    EXAM_DATE DATE
    M1 NUMBER
    M2 NUMBER
    M3 NUMBER
    M4 NUMBER
    M5 NUMBER
    M6 NUMBER
    M7 NUMBER
    M8 NUMBER
    M9 NUMBER
    M10 NUMBER
    I wrote a below code to insert a row into that table,
    declare
    v_arr APEX_APPLICATION_GLOBAL.VC_ARR2;
    v_stmt varchar2(1000);
    begin
    v_arr:= APEX_UTIL.STRING_TO_TABLE(:p_all_items,'~');
    insert into test_group(user_name,exam_date) values (:APP_USER,sysdate);
    dbms_output.put_line('row inserted');
    FOR i IN 1..v_arr.COUNT LOOP
    dbms_output.put_line('i='||i||' value='||v_arr(i));
    if v_arr(i) is null then
    v_stmt:='update test_group set m'||i||'=NULL';
    else
    v_stmt:='update test_group set m'||i||'='||v_arr(i);
    end if;
    dbms_output.put_line(v_stmt);
    execute immediate v_stmt;
    END loop;
    end;
    I just ran this block in 'SQL Commands', It worked for me. but i inserted only one row, so it updates a single row, In case of multiple row need to use the unique column for update. change the above code as per your requirement.
    I hope this work around will help you. If not can you please create an example in apex.oracle.com and share login credentials.
    Thanks
    Lakshmi

  • Deleting a row from a table using jsp

    Given a table in a jsp, can an user click on a row of that table and retrieve the information so that the program can delete a record from a database table?
    most of the tables that I have seen are static, the user cannot interact with them(specially when the user wants to delete several records from a database table).
    Can anyone suggests a good book or way of deleting a row from table using jsp.

    eg use a column in the table that has a radio button or check box,
    on submit, get all the rows that are checked, using the row as an index into your db store, get the key and use the key to issue the sql delete command.

  • 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

  • Referencing rows within a table

    Hi all,
    I don't know if this has been brought up before, and believe me I have looked, but here goes...  I have a table with many tens of rows.  Cell 1 of those rows is a checkbox with the exit event scripted as (formcalc)
    if 
    (this.rawValue == "1") then
    form1.Main_Subform.GeneralTable.Row1.presence
    = "visible"
    else   form1.Main_Subform.GeneralTable.Row1.presence = "hidden"
    endif
    What I want to do is not have to put the above script in each event of each checkbox.  So is there a way of referencing all the checkboxes at once and having the same result of making the associated row go hidden if not checked?
    Also, I have a reset button for the form that I want to be able to reset all row presences to visible when clicked.  I should mention here that the form has several tables all with checkboxes in cell one and all with add buttons that addInstances at the bottom of the tables that I do not want reset with the reset button.  In short, the tables list controlled documents that need to be reviewed annually and that because of the sheer volume of them will need to be parsed out, and the parsing may or may not be entire tables and the tables need to be able to be added to.  Here is what I have regarding the reset of the presences of the rows (I have only just begun):
    xfa.host.resetData();
    form1.Main_Subform.GeneralTable.Row1.presence
    = "visible";form1.Main_Subform.GeneralTable.Row2.presence
    = "visible";form1.Main_Subform.GeneralTable.Row3.presence
    = "visible";form1.Main_Subform.GeneralTable.Row4.presence
    = "visible";
    So my question regarding the reset button is...  Is there a way of resetting the presences of all rows within either all tables or each table without listing each and every row individually within the click event of the reset button?
    Thank you all in advance.  -rpeterson

    Hi,
    You can add one more button to your form. On click event of this button you can put script, which will loop througth all rows of your table and check checkbox, if it will be checked then hide is bot - leas as it is.
    If you want to hide row after click on checkbox, you have to put scripts to each of it.
    BR,
    Paul Butenko

  • Can we create a new row in a table using a down arrow

    Hi,
    I am using jdeveloper 11.1.1.6.
    For one of my project, I have a requirement where i need to create a new row in table using a down arrow. My client does not want to use mouse clicks. They want to use keyboard as much as possible.(Fast data entry).
    Is it possible to create a new row using down arrow. Any pointers will be helpful!
    Thanks,
    Umesh

    you can try this thing
    steps
    - capture downkey event - may b this help http://www.qualitycodes.com/tip/1/capturing-keys-with-javascript.html
    if not google more
    -then call from javascript call java method - https://blogs.oracle.com/jdevotnharvest/entry/how-to_call_server_side_java_from_javascript
    -then create new row of table VO .....

  • Trapping the selected row in the table using boolean checkbox

    Hi,
    I am using Jdev 11.1.1.2.0 with ADF 11g.
    I have a screen that has a table with an additional column of 'Select boolean checkbox'. I have assigned a valuechangelistener method that helps me know which row has been selected. But the issue is it gets fired for all the rows in the table once I select/de-select a checkbox of 1 single row.
    How can I handle this? Yes I can iterate through the table rows and check the values of the checkbox. But that is not I want, I also want to trap the de-select event.
    What is the way to achieve this?

    Timo Hahn wrote:
    I don't see a bug in this behavior. This is because each row gets stamped when they render.
    The way to do this is to use an attribute (which can be transient) to hold the status of the check box. Exactly this does the link I gave.
    TimoHi,
    Why I am saying it as a bug is because it is not firing the event for the record where the event has occurred. instead the event is fired for each row which should definitely not what is expected. And because of this we have to add an additional variable.
    Now it becomes more complex if I have to handle de-selection as well, b'coz if the valuchangelistener is going to fire for all the records then I need to know which row was previously selected and now de-selected as now the de-selected record will also return a false.
    So any better solution, anyone?

  • Inserting Multiple Rows into Database Table using JDBC Adapter - Efficiency

    I need to insert multiple rows into a database table using the JDBC adapter (receiver).
    I understand the traditional way of repeating the statement multiple times, each having its <access> element. However, I am just wondering whether this might be performance-inefficient, as it might insert records one by one.
    Is there a way to ensure that the records are inserted into the table as a block, rather than record-by-record?

    Hi Bhavesh/Kanwaljit,
    If we have multiple ACCESS tags then what happens is that the connection to the database is made only once. But the data is inserted row by row.
    Why i am saying this?
    If we add the following in JDBC Adapter..logSQLStatement = true. Then incase of multiple inserts we can see that there are multiple
    <i>Insert into tablename(EMP_NAME,EMP_ID) VALUES('J','1000')
    Insert into tablename(EMP_NAME,EMP_ID) VALUES('J','2000')</i>
    Doesnt this mean that rows are inserted one by one?
    Correct me if i am wrong.
    This does not mean that the transaction is not guaranted. Either all the rows will be inserted or rolled back.
    Regards,
    Sumit

  • 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;

  • Migration of million rows from remote table using merge

    I need to migrate (using merge) almost 15 million rows from a remote database table having unique index (DAY, Key) with the following data setup.
    DAY1 -- Key1 -- NKey11
    DAY1 -- Key2 -- NKey12
    DAY2 -- Key1 -- NKey21
    DAY2 -- Key2 -- NKey22
    DAY3 -- Key1 -- NKey31
    DAY3 -- Key2 -- NKey32
    In my database, I have to merge all these 15 million rows into a table having unique index (Key); no DAY in destination table.
    First, it would be executed for DAY1 and the merge command will insert following two rows. For DAY2, it would update two rows with the NKey2 (for each Key) values and so on.
    Key1 -- NKey11
    Key2 -- NKey12
    I am looking for the best possible approach. Please note that I cannot make any change at remote database.
    Right now, I am using the following one which is taking huge time for DAY2 and so on (mainly update).
    MERGE INTO destination D
      USING (SELECT /*+ DRIVING_SITE(A) */ DAY, Key, NKey
                   FROM source@dblink A WHERE DAY = v_day) S
      ON (D.Key = S.Key)
    WHEN MATCHED THEN
       UPDATE SET D.NKey = S.NKey
    WHEN NOT MATCHED THEN
       INSERT (D.Key, D.NKey) VALUES (S.Key, S.NKey)
    LOG ERRORS INTO err$_destination REJECT LIMIT UNLIMITED;Edited by: 986517 on Feb 14, 2013 3:29 PM
    Edited by: 986517 on Feb 14, 2013 3:33 PM

    MERGE INTO destination D
      USING (SELECT /*+ DRIVING_SITE(A) */ DAY, Key, NKey
                   FROM source@dblink A WHERE DAY = v_day) S
      ON (D.Key = S.Key)
    WHEN MATCHED THEN
       UPDATE SET D.NKey = S.NKey
    WHEN NOT MATCHED THEN
       INSERT (D.Key, D.NKey) VALUES (S.Key, S.NKey)
    LOG ERRORS INTO err$_destination REJECT LIMIT UNLIMITED;The first remark I have to emphasize here is that the hint /*+ DRIVING_SITE(A) */ is silently ignored because in case of insert/update/delete/merge the driving site is always the site where the insert/update/delete is done.
    http://jonathanlewis.wordpress.com/2008/12/05/distributed-dml/#more-809
    Right now, I am using the following one which is taking huge time for DAY2 and so on (mainly update).The second remark is that you've realised that your MERGE is taking time but you didn't trace it to see where time is being spent. For that you can either use the 10046 trace event or at a first step get the execution plan followed by your MERGE statement.
    LOG ERRORS INTO err$_destination REJECT LIMIT UNLIMITED;The third remark is related to the DML error logging : be aware that unique keys will empeach the DML error loggig to work correctly.
    http://hourim.wordpress.com/?s=DML+error
    And finally I advise you to look at the following blog article I wrote about enhancing an insert/select over db-link
    http://hourim.wordpress.com/?s=insert+select
    Mohamed Houri
    www.hourim.wordpress.com

  • Question on Updating the rows of a table using a SELECT Statement

    Hi,
    I am trying to set all of the R_IDs in one table to the ID from another table using a join.
    Here is the SQL I came up with. I don't this is correct though.
    UPDATE TABLEA A
    SET R_ID=(Select Id from TABLEB B
    WHERE A.DEE=B.DEE AND
    B.RNUM=1);
    Does this make sense?

    You can try the join view.
    UPDATE ( SELECT table_a.id   AS a_id,
                    table_b.id   AS b_id,
                    table_a.col1 AS a_col1,
                    table_b.col1 AS b_col1,
                    table_a.col2 AS a_col2,
                    table_b.col2 AS b_col2,
                    table_a.col3 AS a_col3,
                    table_b.col3 AS b_col3
               FROM table_a,
                    table_b
              WHERE table_a.id = table_b.id)
       SET a_col1 = b_col1,
           a_col2 = b_col2,
           a_col3 = b_col3;
    However it may result in
    ORA-01779: cannot modify a column which maps to a non key-preserved tableThis is because the key-preserving property of a table does not depend on the actual data in the table. It is, rather, a property of its schema. For example, if in table_b there was at most one record for each id value, then table_a.id would be unique in the result of a join of table_a and table_b, but table_a would still not be a key-preserved table. By adding the unique/primary key on the id column of table_b we can assure that if table_b.id were part of the result set of the join view then it would be unique. This makes table_a key preserved.
    Thus, in order to update a join view we must assure that the columns involved in the join view from the source table are unique. We do this by creating a unique or primary key on those columns.
    However, if you do not mind taking responsibility for making sure that there is one-to-one cardinality between the source and destination rows, then you might try the correlated subquery
    UPDATE table_a
       SET (col1, col2, col3 ) =
              ( SELECT col1, col2, col3
                  FROM table_b
                 WHERE table_b.id = table_a.id )
           WHERE EXISTS
               ( SELECT col1, col2, col3
                   FROM table_b
                   WHERE table_b.id = table_a.id )

Maybe you are looking for