How to delete rows from multiple tables when pressing button

Hi, I'm wondering how do I delete a row from two different tables at the same time when I press the Delete button. Both tables have GROUP_ID as their primary key.

Nevermind! I realized that I had "reset" before my process to delete from the 2nd table.

Similar Messages

  • How to fetch rows from multiple tables

    I have a page with items from 3 tables. I need to populate these items with values from the database. The page does not allow me to use multiple automated fetches. So instead I decided to use a pl/sql page process that runs a cursor to get my field values and the uses apex_util.set_session_state to set the field item values. IS there any isues with doing this? Is there a better way?

    These tables are not really related so I gues I will stick with the pl/sql to populate and then page process to insert/update/delete. Here is the code I'm using.
    Chris
    DECLARE
    CURSOR get_info IS
    select A.FK_STU_BASE, A.FK_CONTACT, A.FK_RELATION, A.PRIORITY, A.CAN_PICK_UP_STUDENT,
    A.GETS_STX, A.GETS_STG, A.GETS_STA, A.GETS_DIS, A.GETS_THX, A.GETS_MED,
    A.GETS_MAIL, A.NOTES as STUDENT_NOTES, A.USER_FLD1, A.USER_FLD2, A.USER_FLD3,
    A.USER_FLD4, A.USER_FLD5, A.LAST_UPDATE_DATE, A.LAST_UPDATE_USER,
    B.PK_ID as CONTACT_PK_ID, B.FIRST_NAME, B.LAST_NAME, B.MIDDLE_INIT, B.PREFIX,
    B.SUFFIX, B.FK_LANGUAGE, B.PHONE, B.PHONE_UNLISTED, B.PHONE_EXTENSION,
    B.PHONE_DESCRIPTION, B.EMERGENCY_PHONE, B.EMERGENCY_UNLISTED, B.EMERGENCY_EXTENSION,
    B.EMERGENCY_DESCRIPTION, B.CELL_PHONE, B.CELL_UNLISTED, B.CELL_EXTENSION,
    B.CELL_DESCRIPTION, B.CELL2_PHONE, B.CELL2_UNLISTED, B.CELL2_EXTENSION,
    B.CELL2_DESCRIPTION, B.WORK1_PHONE, B.WORK1_UNLISTED, B.WORK1_EXTENSION,
    B.WORK1_DESCRIPTION, B.WORK2_PHONE, B.WORK2_UNLISTED, B.WORK2_EXTENSION,
    B.WORK2_DESCRIPTION, B.FAX_PHONE, B.FAX_DESCRIPTION, B.EMAIL1, B.EMAIL2,
    B.NOTES as CONTACT_NOTES, B.FK_LODGING, B.FK_EDUCATION_LEVEL,
    C.PK_ID as LODGING_PK_ID, C.FK_ZIP, C.FK_DISTRICT, C.HOUSE_NO, C.LETTER,
    C.DIRECTION, C.STREET, C.STREET2, C.PLUS4, C.APT, C.FK_GRIDCODE,
    C.FK_MUNICIPALITY, C.OPTIONAL_INFO1, C.OPTIONAL_INFO2, C.OPTIONAL_INFO3,
    C.FK_DWELLING, C.OPTIONAL_ZIPCODE
    from contact_link A,
    contact B,
    lodging C
    where A.PK_ID = :P470_CONTACT_LINK_PK_ID and
    B.PK_ID (+) = A.FK_CONTACT and
    C.PK_ID (+) = B.FK_LODGING;
    BEGIN
    FOR x in get_info LOOP
    -- Set Contact Link Items
    APEX_UTIL.SET_SESSION_STATE('P470_FK_STU_BASE',X.FK_STU_BASE);
    APEX_UTIL.SET_SESSION_STATE('P470_FK_CONTACT',X.FK_CONTACT);
    APEX_UTIL.SET_SESSION_STATE('P470_FK_RELATION',X.FK_RELATION);
    APEX_UTIL.SET_SESSION_STATE('P470_PRIORITY',X.PRIORITY);
    APEX_UTIL.SET_SESSION_STATE('P470_CAN_PICK_UP_STUDENT',X.CAN_PICK_UP_STUDENT);
    APEX_UTIL.SET_SESSION_STATE('P470_GETS_STX',X.GETS_STX);
    APEX_UTIL.SET_SESSION_STATE('P470_GETS_STG',X.GETS_STG);
    APEX_UTIL.SET_SESSION_STATE('P470_GETS_STA',X.GETS_STA);
    APEX_UTIL.SET_SESSION_STATE('P470_GETS_DIS',X.GETS_DIS);
    APEX_UTIL.SET_SESSION_STATE('P470_GETS_THX',X.GETS_THX);
    APEX_UTIL.SET_SESSION_STATE('P470_GETS_MED',X.GETS_MED);
    APEX_UTIL.SET_SESSION_STATE('P470_GETS_MAIL',X.GETS_MAIL);
    APEX_UTIL.SET_SESSION_STATE('P470_STUDENT_NOTES',X.STUDENT_NOTES);
    APEX_UTIL.SET_SESSION_STATE('P470_USER_FLD1',X.USER_FLD1);
    APEX_UTIL.SET_SESSION_STATE('P470_USER_FLD2',X.USER_FLD2);
    APEX_UTIL.SET_SESSION_STATE('P470_USER_FLD3',X.USER_FLD3);
    APEX_UTIL.SET_SESSION_STATE('P470_USER_FLD4',X.USER_FLD4);
    APEX_UTIL.SET_SESSION_STATE('P470_USER_FLD5',X.USER_FLD5);
    APEX_UTIL.SET_SESSION_STATE('P470_LAST_UPDATE_DATE',X.LAST_UPDATE_DATE);
    APEX_UTIL.SET_SESSION_STATE('P470_LAST_UPDATE_USER',X.LAST_UPDATE_USER);
    --Set Contact Items
    APEX_UTIL.SET_SESSION_STATE('P470_CONTACT_PK_ID',X.CONTACT_PK_iD);
    APEX_UTIL.SET_SESSION_STATE('P470_FIRST_NAME',X.FIRST_NAME);
    APEX_UTIL.SET_SESSION_STATE('P470_LAST_NAME',X.LAST_NAME);
    APEX_UTIL.SET_SESSION_STATE('P470_MIDDLE_INIT',X.MIDDLE_INIT);
    APEX_UTIL.SET_SESSION_STATE('P470_PREFIX',X.PREFIX);
    APEX_UTIL.SET_SESSION_STATE('P470_SUFFIX',X.SUFFIX);
    APEX_UTIL.SET_SESSION_STATE('P470_FK_LANGUAGE',X.FK_LANGUAGE);
    APEX_UTIL.SET_SESSION_STATE('P470_PHONE',X.PHONE);
    APEX_UTIL.SET_SESSION_STATE('P470_PHONE_UNLISTED',X.PHONE_UNLISTED);
    APEX_UTIL.SET_SESSION_STATE('P470_PHONE_EXTENSION',X.PHONE_EXTENSION);
    APEX_UTIL.SET_SESSION_STATE('P470_PHONE_DESCRIPTION',X.PHONE_DESCRIPTION);
    APEX_UTIL.SET_SESSION_STATE('P470_EMERGENCY_PHONE',X.EMERGENCY_PHONE);
    APEX_UTIL.SET_SESSION_STATE('P470_EMERGENCY_UNLISTED',X.EMERGENCY_UNLISTED);
    APEX_UTIL.SET_SESSION_STATE('P470_EMERGENCY_EXTENSION',X.EMERGENCY_EXTENSION);
    APEX_UTIL.SET_SESSION_STATE('P470_EMERGENCY_DESCRIPTION',X.EMERGENCY_DESCRIPTION);
    APEX_UTIL.SET_SESSION_STATE('P470_CELL_PHONE',X.CELL_PHONE);
    APEX_UTIL.SET_SESSION_STATE('P470_CELL_UNLISTED',X.CELL_UNLISTED);
    APEX_UTIL.SET_SESSION_STATE('P470_CELL_EXTENSION',X.CELL_EXTENSION);
    APEX_UTIL.SET_SESSION_STATE('P470_CELL_DESCRIPTION',X.CELL_DESCRIPTION);
    APEX_UTIL.SET_SESSION_STATE('P470_CELL2_PHONE',X.CELL2_PHONE);
    APEX_UTIL.SET_SESSION_STATE('P470_CELL2_UNLISTED',X.CELL2_UNLISTED);
    APEX_UTIL.SET_SESSION_STATE('P470_CELL2_EXTENSION',X.CELL2_EXTENSION);
    APEX_UTIL.SET_SESSION_STATE('P470_CELL2_DESCRIPTION',X.CELL2_DESCRIPTION);
    APEX_UTIL.SET_SESSION_STATE('P470_WORK1_PHONE',X.WORK1_PHONE);
    APEX_UTIL.SET_SESSION_STATE('P470_WORK1_UNLISTED',X.WORK1_UNLISTED);
    APEX_UTIL.SET_SESSION_STATE('P470_WORK1_EXTENSION',X.WORK1_EXTENSION);
    APEX_UTIL.SET_SESSION_STATE('P470_WORK1_DESCRIPTION',X.WORK1_DESCRIPTION);
    APEX_UTIL.SET_SESSION_STATE('P470_WORK2_PHONE',X.WORK2_PHONE);
    APEX_UTIL.SET_SESSION_STATE('P470_WORK2_UNLISTED',X.WORK2_UNLISTED);
    APEX_UTIL.SET_SESSION_STATE('P470_WORK2_EXTENSION',X.WORK2_EXTENSION);
    APEX_UTIL.SET_SESSION_STATE('P470_WORK2_DESCRIPTION',X.WORK2_DESCRIPTION);
    APEX_UTIL.SET_SESSION_STATE('P470_FAX_PHONE',X.FAX_PHONE);
    APEX_UTIL.SET_SESSION_STATE('P470_FAX_DESCRIPTION',X.FAX_DESCRIPTION);
    APEX_UTIL.SET_SESSION_STATE('P470_EMAIL1',X.EMAIL1);
    APEX_UTIL.SET_SESSION_STATE('P470_EMAIL2',X.EMAIL2);
    APEX_UTIL.SET_SESSION_STATE('P470_CONTACT_NOTES',X.CONTACT_NOTES);
    APEX_UTIL.SET_SESSION_STATE('P470_FK_LODGING',X.FK_LODGING);
    APEX_UTIL.SET_SESSION_STATE('P470_FK_EDUCATION_LEVEL',X.FK_EDUCATION_LEVEL);
    --Set Lodging Items
    APEX_UTIL.SET_SESSION_STATE('P470_LODGING_PK_ID',X.LODGING_PK_ID);
    APEX_UTIL.SET_SESSION_STATE('P470_FK_ZIP',X.FK_ZIP);
    APEX_UTIL.SET_SESSION_STATE('P470_FK_DISTRICT',X.FK_DISTRICT);
    APEX_UTIL.SET_SESSION_STATE('P470_HOUSE_NO',X.HOUSE_NO);
    APEX_UTIL.SET_SESSION_STATE('P470_LETTER',X.LETTER);
    APEX_UTIL.SET_SESSION_STATE('P470_DIRECTION',X.DIRECTION);
    APEX_UTIL.SET_SESSION_STATE('P470_STREET',X.STREET);
    APEX_UTIL.SET_SESSION_STATE('P470_STREET2',X.STREET2);
    APEX_UTIL.SET_SESSION_STATE('P470_PLUS4',X.PLUS4);
    APEX_UTIL.SET_SESSION_STATE('P470_APT',X.APT);
    APEX_UTIL.SET_SESSION_STATE('P470_FK_GRIDCODE',X.FK_GRIDCODE);
    APEX_UTIL.SET_SESSION_STATE('P470_FK_MUNICIPALITY',X.FK_MUNICIPALITY);
    APEX_UTIL.SET_SESSION_STATE('P470_OPTIONAL_INFO1',X.OPTIONAL_INFO1);
    APEX_UTIL.SET_SESSION_STATE('P470_OPTIONAL_INFO2',X.OPTIONAL_INFO2);
    APEX_UTIL.SET_SESSION_STATE('P470_OPTIONAL_INFO3',X.OPTIONAL_INFO3);
    APEX_UTIL.SET_SESSION_STATE('P470_FK_DWELLING',X.FK_DWELLING);
    APEX_UTIL.SET_SESSION_STATE('P470_OPTIONAL_ZIPCODE',X.OPTIONAL_ZIPCODE);
    END LOOP;
    END;

  • Deleting rows from a table

    COuld anyone tell me how to delete rows from a table which has millions of rows.
    TIA,
    Oracle user

    if you are deleting all the rows, use "truncate table" in sql*plus.
    or if you are deleting all but a handful of rows, then copy the rows you still want to a spare table, drop the original table, and rename the spare table back to the original table's name.
    hope this helps

  • Deleting Multiple Rows From Multiple Tables As an APEX Process

    Hi There,
    I'm interesting in hearing best practice approaches for deleting multiple rows from multiple tables from a single button click in an APEX application. I'm using 3.0.1.008
    On my APEX page I have a Select list displaying all the Payments made and a user can view individual payments by selecting a Payment from the Select List (individual items are displayed below using Text Field (Disabled, saves state) items with a source of Database Column).
    A Payment is to be deleted by selecting a custom image (Delete Payments Button) displayed in a Vertical Images List on the same page. The Target is set as the same page and I gave the Request a name of DELETEPAY.
    What I tried to implement was creating a Conditional Process On Submit - After Computations and Validations that has a source of a PL/SQL anonymous block as follows:
    BEGIN
    UPDATE tblDebitNotes d
    SET d.Paid = 0
    WHERE 1=1
    AND d.DebitNoteID = :P7_DEBITNOTEID;
    INSERT INTO tblDeletedPayments
    ( PaymentID,
    DebitNoteID,
    Amount,
    Date_A,
    SupplierRef,
    Description
    VALUES
    ( :P7_PAYMENTID,
    :P7_DEBITNOTEID,
    :P7_PAID,
    SYSDATE,
    :P7_SUPPLIERREF,
    :P7_DESCRIPTION
    DELETE FROM tblPayments
    WHERE 1=1
    AND PaymentID = :P7_PAYMENTID;
    END;
    The Condition Type used was Request = Expression 1 where Expression 1 had a value of DELETEPAY
    However this process is not doing anything!! Any insights greatly appreciated.
    Many thanks,
    Gary.

    ...the "button" is using a page level Target,...
    I'm not sure what that means. If the target is specified in the definition of a list item, then clicking on the image will simply redirect to that URL. You must cause the page to be submitted instead, perhaps by making the URL a reference to the javaScript doSubmit function that is part of the standard library shipped with Application Express. Take a look at a Standard Tab on a sample application and see how it submits the page using doSubmit() and emulate that.
    Scott

  • Delete records from multiple table

    Hi,
    I need to delete records from multiple tables using a single delete statement. Is it possible ? If so please let me know the procedure.
    Kindly Help.
    Thanks,
    Alexander.

    Hi Tim,
    Syntax of DELETE statement does not allow for multiple tables to be specified in this way. Infact, none of the DMLs allow you to specify table names like this.
    Technically, there are other ways of deleting from multiple tables with one statement.
    1. "Use a trigger":
    What was probably meant by this is that you have a driving-table on which you create a on-delete trigger. In this trigger, you write the logic for deleting from other tables that you want to delete from.
    This does mean a one-time effort of writing the trigger. But the actual DML operation of deleting from all the tables would be simply triggered by a delete on driving-table.
    2. Dynamic SQL:
    Write a PL/SQL code to open a cursor with table-names from which you want the data to be deleted from. In the cursor-for loop, write a dynamic SQL using the table-name to delete from that table.
    3. Using Foreign-Key constraint with Cascade-Delete:
    This I feel is a more 'cleaner' way of doing this.
    Having to delete data from multiple tables means that there is some kind of parent-child relationship between your tables. These relationships can be implemented in database using foreign-key constraints. While creating foreign-key constraint give the 'on delete cascade' clause to ensure that whenever data is deleted from parent-table, its dependent data is deleted from child-table.
    Using foreign-key constraint you can create a heirarchy of parent-child relationships and still your DELETE would be simple as you would only have to delete from parent-table.
    IMPORTANT: Implementing foreign-key constraints would also impact other DML operations that you should keep in mind.

  • Deleting row from a table binded to a matrix

    Hi all
    i have a form with a matrix binded to a user table which is handled as a Master Data lines by UDO.
    i want to enable deleting lines from the table by selecting a row in the matrix and clicking a delete button.
    currently i'm handling the click event by usint the method DeletRow of the matrix object.
    when i press the Update button (UID = "1"). the fact that a row was deleted from the matrix does not affect the bounded table.
    my question is how in code can i cause the deletion of a row from the matrix to also be deleted from the database table?
    appreciate the help
    Yoav

    Hi Yechiel
    flushToDatasource make the following:
    Flushes current data from the GUI to the bounded data source using the following process:
    1)Cleans the data source.
    2)Copies each row from the matrix to the corresponding data source record.
    In other words: This method load data from Matrix to DataSource (but not to database)
    the next step is update database from userdatasource
    Note: You migth read sdk help for more information

  • Prevent user from deleting rows from all tables in his own schema

    Hi,
    How can I prevent user from deleting rows in all tables in his own schema.
    I want the user to not able to delete rows from any existing or new tables that might be added in the future.
    The user does not have the "DELETE ANY TABLE" system privilege.
    Please advise.
    Thanks.

    Nowadays, I'd also avoid triggers (if possible).
    Sometimes, when I daydream, I'm rewriting a few applications that I've contributed to as a newbie, and I'm very ashamed of it nowadays.
    From what I've experienced, in retrospective, the emphasis on teaching 'Oracle stuff' has been lying far too much on PL/SQL row-by-row oriented processing instead of letting Oracle 'crunch' sets at once.
    Most of my debugging hours ended up in discovering one or more database triggers 'doing stuff automagically'.
    Another nice blogpost: http://rwijk.blogspot.com/2007/09/database-triggers-are-evil.html
    Regarding OP's question:
    I would just rethink/reconsider this requirement completely.
    Correctly implementing privileges and roles seems the best way to go, yes.
    Triggers? Nah...
    pre-post-edit, noticed thread got updated just before posting
    Don't know what you mean with 'namedropping', but I think it's legitimate to point other readers to interesting Oracle related opinions/articles that do have a technical background and lots of interesting examples.
    post dreaded OTN outage edit (from here)
    Again: I would just rethink/reconsider this requirement completely.
    Both trigger/vpd are being used to hide a design flaw here.

  • How to extract data from multiple tables (always got errors)

    Dear Experts,
    I have a simple mapping to extract data from multiple tables as a source (A, B, C) to a target table (X). Below is the picture:
    (Sources)....(Target)
    A----------------***
    B----------------X
    C----------------***
    Sample Source Data:
    Table A:
    ColA1
    100
    200
    etc
    Table B:
    ColB1 ColB2 ColB3
    10 Y Ten
    20 Y Twenty
    30 Y Thirty
    etc
    Table C:
    ColC1 ColC2
    11
    12
    13
    etc
    Target table (X) should be (just has 1 group INGRP1):
    ColA1 ColB1 ColB3 ColC1
    100 10 Ten 11
    100 10 Ten 12
    100 20 Twenty 21
    etc
    Scenarios:
    1. Directly map from A, B, C to X. Unable to map with error message: "API8003: Connection target attribute group is already connected to an incompatible data source. Use a Joiner or Set operator to join the upstream data first before connecting it into this operator."
    2. Map each source to Expression Operator and then map from each Expression to target table. I am able to map all attributes successfully but got error when validating it with message: "VLD-1104: Attributes flowing into TEST.EXPR_SRC.INGRP1 have different data sources."
    How can I achieve the correct mapping for this purpose?
    Use Joiner? I have no key to join the sources
    Use Set? The sources have different number of columns
    Thanks in advance
    Prat

    Thanks Nico,
    I think it will results data like this:
    100 10 Ten 11
    200 20 Twenty 12
    300 30 Thirty 13
    etc
    and not the expected:
    100 10 Ten 11
    100 10 Ten 12
    100 20 Twenty 21
    etc
    But it inspired me to solve this by adding key expression in each source table (B & C) to be joined to table A with this formula:
    100+TRUNC(INGRP1.COLB1,-2)
    Regards
    Prat

  • Deleting Rows From A Table After Running a Report

    I've created a report that inserts rows into a table on the asp page then calls a BI Publisher report to display the data. After running the report in BI Publisher I need to delete the rows from the table that had just been inserted. How is the best way to go about this in BI Publisher?

    The best way I know of would be to use an "afterReport trigger".
    An afterReport trigger fires after the XML output has been generated.
    Thanks,
    Bipuser

  • JDBC-XI-FILE scenario. How to extract data from multiple tables

    Hi,
    At this moment I didn't have the access for XI system. So here I have some silly question. Could you please clarify the same ??
    If I got to extract data from single table using JDBC adapter I can put the below query in communication channel
    SELECT *FROM orders WHERE new='true'.
    But if I got to extract data from multiple tables, logic to be used should be like as shown below. ( from previous thread------prabhu).
    SELECT <Table_2>.EID, <Table_2>.FName, <Table_2>.LName, <Table_1>.REC_DAT, <Table_1>.DESCRP
    FROM <Table_1> INNER JOIN <Table_2> on
    <Table_1>.CARDNO = <Table_2>.CARD
    where REC_DAT = <condition>
    union
    SELECT <Table_2>.EID, <Table_2>.FName, <Table_2>.LName, <Table_1>.REC_DAT, <Table_1>.DESCRP
    FROM <Table_1> INNER JOIN <Table_2> on
    <Table_1>.CARDNO = <Table_2>.CARD
    where REC_DAT = <condition>
    But my query is ........how to put the above entire code in one line. (i.e in Qery place of communication channel ) ??
    Thanks
    Kumar

    Hi Palnati,
        You either use a select query with join or a stored procedure which will contain the logic to extract the data from multiple tables. But, the limitation in case of stored procedure is u can hv only one selct query in it.
    You write ur actual query provided in the parameter 'Query SQL Statement". u can also wrt a stored procedure in it. Also, u can provide a update statement in it which will update a certain flag so tht u don selct the data again.
    Check the following link
    <a href="http://help.sap.com/saphelp_nw04/helpdata/en/14/80243b4a66ae0ce10000000a11402f/frameset.htm">http://help.sap.com/saphelp_nw04/helpdata/en/14/80243b4a66ae0ce10000000a11402f/frameset.htm</a>
    Regards,
    Akshay
    Message was edited by:
            Akshay Salunke

  • Deleting rows from one table while filter condition lies into another table

    Hi All,
    I'm facing a problem deleting a row from a table where the condition lies in other table. To ealaborate the scenario further let's say I have two table T1 (transaction table) and T2 (Master Table). I want to delete a record from table T1 by checking some conditions lies in table T2.
    I tried with the below query but this query deleting records from both the table.
    DELETE FROM ( SELECT * FROM T1 top INNER JOIN T2 tp
    ON top.TID = tp.TID
    WHERE top.DEAL_SITE_ID = inputparameter1
    AND (TP.SEGMENT <>inputparameter2 OR tp.segment is not null));
    Here the record is getting deleted from both the tables but I don't want to delete data from my master table i.e table T2.
    Any help would be highly appreciated. Thanks in advance.
    Regards,
    Subhadeep

    SQL> select *
      2   from the_table;
    X          Y
    AA         a
    BB         a
    CC         a
    AA         b
    DD         b
    SQL> select *
      2   from the_table_2;
    X          Y
    AA         a
    BB         a
    CC         a
    SQL>  delete from
      2  (
      3  select *
      4  from the_table  t1 inner join the_table_2 t2
      5  on  t1.x = t2.x
      6  and t1.y = t2.y);
    3 rows deleted.
    SQL> select *
      2   from the_table;
    X          Y
    AA         b
    DD         b
    SQL> select *
      2   from the_table_2;
    X          Y
    AA         a
    BB         a
    CC         a

  • How to fetch rows from a table like search engines do?

    Is it possible to fetch rows from a table like Google does? I want to fetch row number 20-40 after the select has ordered the rows.
    Pseudo code: select * from log where rownum > 20 and rownum < 40 order by date;
    Rownum doesn't work with ordering so I tried:
    select * from log where (select * from log order by date) and rownum <20;
    But that still doesn't do what I want. I get the "top 20" rows but I can't get rows 20-40.
    My real table has 70000 rows and I want to select 69000-70000 so I really need a SQL do fetch only the rows I need.
    Any help would be very appreciated!
    Best regards,
    Christer Nordvik

    SELECT alias_for_rownum, column_names
            FROM   (SELECT ROWNUM AS alias_for_rownum, column_names
                    FROM   (SELECT   column_names
                            FROM     table_name
                            ORDER BY columns_to_order_by)
                    WHERE  ROWNUM <= last_row_you_want)
            WHERE  alias_for_rownum >= first_row_you_want
    Example:
    -- (This example uses the Oracle dept demo table.
    SET AUTOTRACE ON EXPLAIN
    SELECT rn, deptno, dname, loc
            FROM   (SELECT ROWNUM AS rn, deptno, dname, loc
                    FROM   (SELECT   deptno, dname, loc
                            FROM     dept
                            ORDER BY deptno)
                    WHERE  ROWNUM <= 3)
            WHERE  rn >= 2
                    RN     DEPTNO DNAME          LOC
                     2         20 RESEARCH       DALLAS
                     3         30 SALES          CHICAGO

  • Deleting rows from a table matching values from an ascii file

    Hi All,
    I have an ASCII file with 12,000 lines. Each line represents a value (you may call this as bad data) that matches a database column value in table. I have to delete all the rows from a database table (~ 400,000 rows) where a column value matches the bad data value. Linux is the OS is where SQLPLUS client is installed and I can execure any SQL queries from this Linux server. Oracle DB server is 10g.
    Any input on how to do this will be helpfull to me. I am not a database programmer so if any details will be appreciated.
    Thanks

    Hi,
    That's going to be very slow (among other problems) if you don't have the bad data in a table. An index-organized table would probably be best.
    Assuming the data data are uinique strings, up to 30 characters long, and that you don't need any other columns, you can create a table like this:
    CREATE TABLE  bad_data
    (   bad_txt    VARCHAR (30)
    ,  CONSTRAINT  bad_data_pk  PRIMARY KEY (bad_txt)
    ) ORGANIZATION INDEX;SQL*Loader is one way of getting the data from the file (doesn't have to be on the database server; it can be on your client machine) into the table.
    Once you have a table, actually removing the rows from the big table might be as simple as:
    DELETE  big_table
    WHERE   column_a  IN
            (   SELECT  bad_txt
                FROM    bad_data
    ;

  • Deleting Row from Advanced Table Region

    Dear Members,
    I have an OAF Page where I am using Advanced Table Region to display the data of a table.
    As soon as the page opens I am displaying one line in Advanced Table Region. In this region I have also given a button called ADD ANOTHER ROW +(using the feature of ADVANCED TABLE COMPONENTS, FOOTER, TABLE FOOTER , ADD TABLE ROW)+.
    So when user clicks on this button a new row will be added. Now if user wants to delete it how to achieve this.
    Kindly please help me in achieving this functionality.
    Many thanks in advance.
    Best Regards,
    Arun Reddy D.

    Hi Arun,
    First you need to create a button or image called Delete on your Advanced table region.
    Action Type : firePartialAction
    Event: delete
    Then In your CO PFR , write the below code
        if ("delete".equals(pageContext.getParameter(EVENT_PARAM)))
          String rowRef = pageContext.getParameter(OAWebBeanConstants.EVENT_SOURCE_ROW_REFERENCE);
          OARow row = (OARow)am.findRowByRef(rowRef);
          row.remove();
        }Hope this helps. :)
    Thanks,
    SK
    Edited by: SK on Feb 9, 2011 5:21 PM

  • Remove a row from multiple tables

    Hello,
    I have a form that has what appears to be one table.  Since I needed 30 columns (29 of them are single character fields) I had to use 2 table objects.  Then I needed the ability to add and remove rows.  Adding a row at the end is easy enough.  Deleting a specific row is the problem.  At the moment, I added a third table which has a header row and a item body row.  the body row is a button with the intention of removing that entire row from the large table.  This means it needs to remove the row from all 3 tables.
    My structure is:
    form1
    (Some other flowed subform that doesn't matter for us)
    SubformPersonnel (a flowed subform)
    SubformHeader (a positioned subform)
    TextOverallHeader (text to label the oeverall 3 tables)
    ButtonAddRow (adds a row to the end of all 3 tables)
    SubformPersonnelTable (a positioned subform)
    ContractorTableRemove (a table with 1 column for the Remove button)
    HeaderRow (A hidden row to align the table with the other 2)
    Item (A row with the Remove button)CellRemoveButton (the cell with the remove button and associated JavaScript)
    ContractorTableLeft (a table with the left 15 printed columns)
    HeaderRow
    Contractor (A row of data to be removed when CellButton above is clicked)
    ContractorTableRight (a table with the right 15 printed columns)
    HeaderRow
    Contractor (A row of data to be removed when CellButton above is clicked)
    (Some other flowed subforms that I am not worried about at the moment)
    The 3 tables are aligned so the headers all line up, with no spaces between them.  The body rows then line up and this looks like one large table.  From left to right, they are:
    ContractorTableRemove, ContractorTableLeft, ContractorTableRight
    So Item and Contractor rows are added when ButtonAddRow is clicked in the overall header.  The intial count is set to 8 for each table, so I get 8 rows at startup. The minimum count is set to 1 for each.  I know that each row of each table has the same index number because I filled those into a cell in each table durig the cell's initialize.  This line, in the CellRemoveButton's click event deletes that cell's row in that table:
    this.parent.parent._Item.removeInstance(this.parent.index);
    I have tried all sorts of ways to delete the same row (using same index #) in the other 2 tables: ContractorTableLeft and ContractorTableRight, but don't seem to be getting the correct syntax correct.  I have tried hard coding the references, using .parent as shown below, and also tried using an index of 1 just to try deleting a row with no results.
         this.parent.parent.parent.ContractorTableLeft._Contractor.removeInstance(this.parent.inde x);
    Can someone get me the correct syntax here?
    I have seen examples of putting a hidden delete button on each table and clicking that, but I am concerned that it will get in the way of the tables on either side of the table it is in.  I reeally want to just reference the row and remove it so I can avoid any problems these additional delete problems may cause.
    I have copied the form to https://acrobat.com/#d=7M8R50rEHf4AaVXppwyKLw

    Thank you, Niall.  Much appreciated!
    The Delete button was more to make sure one could delete these outside a button in the actual row and I see I had the index wrong such that I was deleting the second row and not the first.  I had toyed with using this as a hidden button if I could pass the index to the event's function.
    I had not thought of adding the reference to each row as a variable.  It seems to work very well.
    For future reference to others, here is the code from the cellRemoveButton click event:
         // Declare some variables
         var i = this.parent.index;
         var oContractorLeft = ContractorTableLeft.Contractor;
         var oContractorRight = ContractorTableRight.Contractor;
         // Remove this row by accessing its index within the set of 'Item' row instances of the parent table
         _Item.removeInstance(i);
          // Since this table is actually 3 tables, we need to remove the other two table's instances as well.
         // Their index should be the same, so we just need to get their names correct.
         oContractorLeft.instanceManager.removeInstance(i);
         oContractorRight.instanceManager.removeInstance(i);
          // removing the row doesn't trigger calculations in tables in the form's current target (fixed in later versions of Acrobat)
         // force calculations to fire so the ItemIndex field's value is updated according to the remaining row's indexes
         // see http://forms.stefcameron.com/2006/05/20/add-recalculate/
         xfa.form.recalculate(1);
    Again, thank you!
    Karl

Maybe you are looking for

  • MSI Twin Forzer GTX 760 no longer recognised in Windows or showing in BIOS

    This evening when I switched on my PC, I got no signal to my monitor. * I checked all the connections from my DVI -> VGA connector * I Tried with an HDMI cable Both would no produce a signal.  I then checked in the BIOS (MSI z87-g65) and the PCIe 16x

  • Creating xml file and inert tin to xml file in clob column

    i have a table CREATE TABLE XMLCLOB of XMLType XMLTYPE store AS CLOB; now i want to create a xml file by qurying emp table ie select sal,empname from emp. the cretaed xml file is saved in the xmlclob table how to do that?

  • Gnome crashes randomly

    Gnome has been crashing randomly for the past 2 weeks and I finally am so tired of it so I posted this. It will just randomly fallback to gdm. Here is my Xorg.5.log. I hope you can make sense of what's going on. It seems like something about screens

  • Calculate database size for a particular company code

    Hi Experts, We have 30 company codes in our FI production system. So to plan another new company code to be deployed into the system, we need to know exact capacity (database) of the previous company code that we already deployed. Kindly let me know

  • Cannot install hardware

    Hi guys, I have a problem in connecting my phone to pc via pc suite mode.I want to update my phone.Whenever i connect my phone via pc suite mode,pc searches for drivers and fails with a ''cannot install hardware message'',but it detects phone fine in