Deleting from multiple table using hsql

I am having the following code which runs fine with mysql. But the sql statement fails for hsql (hipersonic database). Can you please give
some pointershow the statement should be for hsql
================CODE====================
import org.springframework.jdbc.core.JdbcTemplate
def statement = "delete a, ac, ace from Alarm a, AlarmCause ac, AlarmCauseElement ace where a.timeStamp <= ? and a.id=ac.alarm_id and
ac.id=ace.cause_id"
JdbcTemplate.
int rows = jdbcTemplate.update(statement, 1000000000) // I just added 1000000000 as sample date
===============ERROR=====================
PreparedStatementCallback; bad SQL grammar [delete a, ac, ace from Alarm a, AlarmCause ac, AlarmCauseElement ace where a.timeStamp <= ? and
a.id=ac.alarm_id and ac.id=ace.cause_id]; nested exception is java.sql.SQLException: Unexpected token A, requires FROM in statement [delete a,
ac, ace from Alarm a, AlarmCause ac, AlarmCauseElement ace where a.timeStamp <= ? and a.id=ac.alarm_id and ac.id=ace.cause_id]

2. Explain what "does not work" means exactly.Reading between the lines the OP is trying to remove rows from three different tables. Perhaps the following from the original post really does work in MySQL?
delete a, ac, ace from Alarm a, AlarmCause ac, AlarmCauseElement ace where a.timeStamp <= ? and a.id=ac.alarm_id and ac.id=ace.cause_idHowever I doubt you can do join deletes in HSQL. So he will probably need to split it into multiple deletes based upon subqueries. Something like:
delete from AlarmCauseElement where cause_id in ( select ac.id from Alarm a left join AlarmCause ac on ac.alarm_id = a.id where a.timestamp <= ?);
delete from AlarmCause where alarm_id in (select id from Alarm where timestamp <= ?);
delete from Alarm where timestamp <= ?;(None of the above is tested).
Edited by: dcminter on 28-Oct-2009 10:00

Similar Messages

  • Create Trigger to Delete from multiple tables

    Hello:
    I'm trying to write a trigger which will allow me to delete from multiple records. I have two tables where the record for the same client_id needs to be deleted.
    Is it possible to do this? I started writing some code and this is what I have so far:
    create or replace trigger app_t1
    before delete on <table1> ?? -
    for each row
    begin
    delete from client where clientid = :new.clientid;
    delete from key where pk = :newclientid;
    end;I'm stuck on the line where I have "before delete on" where I'm supposed to provide a table name. I can only use one table and I need to delete from two.
    This trigger is supposed to be used within APEX. In APEX, fields are designated as :P1_clientid where P1 references page 1 of the application. Yet, :P1_clientid is set to the field clientid in the table.
    So when I write my trigger, I'm not sure how I'm supposed to set my variables.
    Can someone help?
    I'm also going to post this into the APEX forum.
    Thanks.

    It's not clear to me if you are just trying to keep two tables in syn or whether you are trying to achieve something else.
    A couple of points though:
    - In delete database triggers the :new attributes are NULL. You probably mean to use the :old attributes.
    - Is there some relationship between the two tables? If so, setting the foreign key to CASCADE DELETE might do the trick for you.
    - Another option - better than a database trigger in my opinion - is to just code a procedure that deletes from both tables and call that one from APEX.
    Regards,
    Rob.

  • Deleting from multiple tables

    I have a master table and a detail table. I need to delete a set of records from both the master and detail tables based on a criteria. Now if I delete from one table then I will not know which records I have to delete from the other table. So the records needs to be deleted from both the tables using the criteria. My SQL statement to select the records is
    <<
    select *
    FROM TL_RATE A, TL_RATE_DETAIL B
    WHERE A.CARRIER_ID = B.CARRIER_ID
    AND A.TARIFF_CLASS_ID = B.TARIFF_CLASS_ID
    AND A.LANE_ID = B.LANE_ID
    AND A.SERVICE_COM_ID = B.SERVICE_COM_ID
    AND A.EFFECTIVE = B.EFFECTIVE
    AND DATE_INVALID < SYSDATE-365;
    >>
    Thanks

    You don't show what table DATE_INVALID is in. However, you should just delete the matching rows from the OTHER table first then that table. This is very slightly different from the rows returned by your query since your query is an inner join. In other words, you're excluding rows that might exist in one table but not the other. Assuming DATE_INVALID is in TL_RATE ...
    delete tl_rate_detail
    where (CARRIER_ID, TARIFF_CLASS_ID, LANE_ID, SERVICE_COM_ID, EFFECTIVE) in (
      select CARRIER_ID, TARIFF_CLASS_ID, LANE_ID, SERVICE_COM_ID, EFFECTIVE
      from tl_rate
      where date_invalid < sysdate - 365)
    delete tl_rate
    where date_invalid < sysdate - 365
    /Richard

  • Deleting from multiple tables where few tables have same column name

    Hi,
    I am new to PL/SQL and need some help. I need to delete data older then X years from some 35 odd tables in my schema and out of those tables 25 tables have same column name on which i can have my "where" clause and rest 10 table have different table names. I am doing something like this :
    declare
    table_list UTL_FILE.FILE_TYPE;
    string_line VARCHAR2(1000);
    tables_count number:=0;
    table_name VARCHAR2(400);
    column_name VARCHAR2(400);
    BEGIN
    table_list := UTL_FILE.FOPEN('ORALOAD','test7.txt','R');
    DBMS_OUTPUT.PUT_LINE(table_list);
    LOOP
    UTL_FILE.GET_LINE(table_list,string_line);
    table_name := substr(string_line,1, instr(string_line,'|')-1);
    column_name := substr(string_line, instr(string_line,'|')+1);
    DBMS_OUTPUT.PUT_LINE(table_name);
    DBMS_OUTPUT.PUT_LINE(column_name);
    IF column_name = 'SUBMISSION_TIME' THEN
    delete from :table_name where to_date(:column_name)<(sysdate-(365*7));
    ELSE
    delete from || table_name || where ( || to_date(column_name) || ) <(sysdate-(365*7));
    END IF;
    END LOOP;
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    UTL_FILE.FCLOSE(table_list);
    DBMS_OUTPUT.PUT_LINE('Number of Tables processed is : ' || tables_count);
    UTL_FILE.FCLOSE(table_list);
    END;
    WHERE the text file "text7.txt" contains list of table name and column names separated by a pipe line. But when I execute the above proc it gives error "invalid table name".
    Can something like this be done or is there any other way to execute this task of deletion from 35 tables.
    Thanks.

    Thanks for replies. I don't know what I am doing wrong but still not getting this damn thing work...This is the proc i am running now :
    declare
    table_list UTL_FILE.FILE_TYPE;
    string_line VARCHAR2(1000);
    tables_count number:=0;
    table_name VARCHAR2(4000);
    column_name VARCHAR2(4000);
    code_text VARCHAR2(2000);
    BEGIN
    table_list := UTL_FILE.FOPEN('ORALOAD','test7.txt','R');
    LOOP
    UTL_FILE.GET_LINE(table_list,string_line);
    table_name := substr(string_line,1, instr(string_line,'|')-1);
    column_name := substr(string_line, instr(string_line,'|')+1);
    IF column_name = 'SUBMISSION_TIME' THEN
    DBMS_OUTPUT.PUT_LINE('do nothing');
    ELSE
    code_text:= 'begin delete from'|| (table_name) ||'where to_date' || (column_name) || '<(sysdate-(365*7))';
    Execute Immediate code_text;
    END IF;
    END LOOP;
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    UTL_FILE.FCLOSE(table_list);
    DBMS_OUTPUT.PUT_LINE('Number of Tables processed is : ' || tables_count);
    UTL_FILE.FCLOSE(table_list);
    END;
    But it gives following error :
    " ORA-06550: line 1, column 51:
    PL/SQL: ORA-00933: SQL command not properly ended
    ORA-06550: line 1, column 7:
    PL/SQL: SQL Statement ignored
    ORA-06550: line 1, column 68:
    PLS-00103: Encountered the symbol "end-of-file" when expecting one of the following:
    ORA-06512: at line 22 "

  • Deletion from multiple tables

    Hi,
    I am having three tables
    Payment (Parent)
    Header (Child)
    Items (Grand Child)
    one payment can have multiple header and the header can have multiple item in it.
    P
    H H -- level 1
    I I I I -- level 2
    e.g one payment is having 2 headers and each header is having 2 items in it.
    I need to delete the item table first then header table then payment table.
    Condition for deletion. There is field(flag) in item table which decides when to delete record. I need to delete record when all the item records flag value is 2.
    How to check for all items flag value?
    P1
    H1 H2
    I1 I2 I3 I4
    2 1 1 1
    P1
    H1 H2
    I1 I2 I3 I 4
    1 1 2 2
    Since if we miss any check at level 1 or level 2 We will be having Orphan records in the database.
    First case(Level 2 check is missed)then
    I1 -> H1 -> P1 deleted
    and we have H2,I2,I3,I4 Orphans
    Second Case (Level 1 Check is missed)then
    I3,I4 -> H2 -> P1 deleted
    and we have H1,I1,I2 as orphans.
    Please help how to check the flag value of each item. These table are related through primary and foreign keys.
    Thanks in advance
    Edited by: anu2 on Oct 20, 2009 12:04 AM

    Double negation coming up again...
    You can identify the parents that are eligable for deletion as follows:
    select p.*
    from Payment p
    where not exists
          (select 'x'
           from Header h
           where h.FK = p.PK
             and not exists
                  (select 'x'
                   from Items i
                   where i.FK = h.PK
                     and i.status != 2))And then use the resultset of above query to:
    - delete the grandchildren of these parents first,
    - and then delete the children of these parents,
    - and then delete the parents.
    Maybe this helps.
    Edited by: Toon Koppelaars on Oct 20, 2009 9:19 AM

  • Delete from multiple tables

    Hello guys,
    Can somebody please help me. I want to delete this one transaction from all the below tables in my testing environment. Can somebody please help me with a script to do that? So basically I want a delete statement for the same select statement I have below.
    select distinct b.*
    from ra_customer_trx_all a,
         ra_customer_trx_lines_all b,
         ra_cust_trx_line_salesreps_all c,
         ra_cust_trx_line_gl_dist_all d,
         ar_payment_schedules_all e
    where a.CUSTOMER_TRX_ID = b.CUSTOMER_TRX_ID
    and b.CUSTOMER_TRX_ID = c.CUSTOMER_TRX_ID
    and c.CUSTOMER_TRX_ID = d.CUSTOMER_TRX_ID
    and d.CUSTOMER_TRX_ID = e.CUSTOMER_TRX_ID
    and b.CUSTOMER_TRX_LINE_ID = d.CUSTOMER_TRX_LINE_ID
    and a.customer_trx_id = 1328 Thanking you in advance

    If you are checking to see if that ID exists in all 5 tables then
    DECLARE
      v_trx_id   ra_customer_trx_all.CUSTOMER_TRX_ID%TYPE;
    BEGIN
      SELECT DISTINCT b.CUSTOMER_TRX_ID
        INTO v_trx_id
        FROM ra_customer_trx_all A,
             ra_customer_trx_lines_all b,
             ra_cust_trx_line_salesreps_all c,
             ra_cust_trx_line_gl_dist_all d,
             ar_payment_schedules_all E
       WHERE A.CUSTOMER_TRX_ID = b.CUSTOMER_TRX_ID
         AND b.CUSTOMER_TRX_ID = c.CUSTOMER_TRX_ID
         AND c.CUSTOMER_TRX_ID = d.CUSTOMER_TRX_ID
         AND d.CUSTOMER_TRX_ID = E.CUSTOMER_TRX_ID
         AND b.CUSTOMER_TRX_LINE_ID = d.CUSTOMER_TRX_LINE_ID
         AND A.customer_trx_id = 1328;
      IF v_trx_id IS NOT NULL
      THEN
        DELETE FROM ra_customer_trx_all
         WHERE CUSTOMER_TRX_ID = v_trx_id;
        DELETE FROM ra_customer_trx_lines_all
         WHERE CUSTOMER_TRX_ID = v_trx_id;
        DELETE FROM ra_cust_trx_line_salesreps_all
         WHERE CUSTOMER_TRX_ID = v_trx_id;
        DELETE FROM ra_cust_trx_line_gl_dist_all
         WHERE CUSTOMER_TRX_ID = v_trx_id;
        DELETE FROM ar_payment_schedules_all
         WHERE CUSTOMER_TRX_ID = v_trx_id;
      END IF;
    END;Other wise do this simply.
    DELETE FROM ra_customer_trx_all
    WHERE CUSTOMER_TRX_ID = 1328;
    DELETE FROM ra_customer_trx_lines_all
    WHERE CUSTOMER_TRX_ID = 1328;
    DELETE FROM ra_cust_trx_line_salesreps_all
    WHERE CUSTOMER_TRX_ID = 1328;
    DELETE FROM ra_cust_trx_line_gl_dist_all
    WHERE CUSTOMER_TRX_ID = 1328;
    DELETE FROM ar_payment_schedules_all
    WHERE CUSTOMER_TRX_ID = 1328;G.
    Edited by: Ganesh Srivatsav on Apr 1, 2011 12:34 PM

  • Extracting data from multiple tables using DB connect

    Hi,
       I am having different tables which are  having the same structure in oracle database but  there names are different.Now i have only one datasource at BI side.This datasource shld extract data from the  tables dynamically.How can i do it using DB Connect .
    Thnxs

    ahh I see - problem as you said then is if you then take on a new location!
    I would then put into the source system a table identifier and create a view across all the tables
    Then dbconnect from the view and use the selection parameter of table parameter if you wanted one infopackage per "location"
    If you do need to have a new table in the source then just expand the view and create a new ipak
    hence NO bw changes required that need a dev-q-p transport - just the ipak in prod and it;s the source systems problem to add the extra table to the view

  • Getting Result from multiple table using code table.

    I am having hard time getting data from different table not directly connected.
    

    The data model is not proper. Why should you store the game details in separate tables?
    IMO its just matter of putting them in same table with additional field gamename to indicate the game. That would have been much easier to query and retrieve results
    Anyways in the current way what you can do is this
    SELECT p.ID,p.Name,c.CategoryName AS [WinnerIn]
    FROM GameParticipants p
    INNER JOIN (SELECT ParticipantID, Value AS ParticipantName,'CGW Table' AS TableName
    FROM CGWTable
    UNION ALL
    SELECT ParticipantID, Value AS ParticipantName,'FW Table' AS TableName
    FROM FWTable
    SELECT ParticipantID, Value AS ParticipantName,'WC Winner' AS TableName
    FROM WCWinner
    ... all other winner tables
    )v
    ON v.ParticipantID = p.ID
    AND v.ParticipantName = p.Name
    INNER JOIN Category c
    ON c.TableName = v.TableName
    If you want you can also add a filter like
    WHERE p.Name = @Name
    to filter for particular player like Henry in your example
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

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

  • Getting statistics from multiple tables using conditional expressions (e.g. combining min, count, sum, etc) in PHP/MySQL

    Hi,
    I'm trying to get statistics from a variety of related tables
    where the statistical counts are based on comparing the value on
    one table with an equivalent value on a second table (and I want to
    view the results grouped by time period, day, week, month, etc);
    e.g.
    Consider two tables - Customer & Customer_Action which
    are related as a one-to-many (one customer can take many actions):
    Customer: id, create_date, customer_name, etc.
    Customer_Action: id, customer_id, create_date, action, etc.
    If the customer took their first action at the same time as
    they registered on the system (i.e. if the customer record was
    created at the same time as the very first action record)
    YES_count is incremented by 1 else
    NO_count is incremented by 1
    So running the query against the database the report would
    look something like:
    Customers Yes No
    January 8 5 3
    February 14 9 5 .... Etc.
    I've tried this around a number of different ways but always
    seem to end up with double counting in one way or another: see this
    sample data
    Customer Create_Date Action_Date
    01 05/07/2008 12:36 05/07/2008 12:36
    01 05/07/2008 12:36 28/08/2008 22:22
    02 10/07/2008 12:04 10/07/2008 12:04
    03 10/07/2008 12:12 10/07/2008 12:12
    This should give me
    Count Yes No
    July 3 3 0
    ...... but I get always get a customer counts of 4 2 2!
    My current statement is .....
    SELECT count( m2u_Customer.id ) AS Customer,
    min( m2u_Customer_Action.action_date ) AS 'Action_Date',
    DATE_FORMAT( m2u_Customer.create_date, '%m-%M' ) AS Month,
    sum(case when m2u_Customer.create_date =
    m2u_Customer_Action.create_date then 1 else 0 end) as Yes,
    sum(case when m2u_Customer.create_date !=
    m2u_Customer_Action.create_date then 1 else 0 end) as No
    FROM m2u_Customer
    LEFT JOIN m2u_Customer_Action ON ( m2u_Customer.id =
    m2u_CustomerAction.customer_ id )
    WHERE m2u_Customer.create_date > '2008-07-02'
    AND m2u_Customer.create_date < '2008-08-01'
    GROUP BY DATE_FORMAT( m2u_Customer.create_date, '%m-%M' )
    Can this be done?
    Regards.
    Patrick

    In the default php.ini is set open_basedir which limits work with php only to few directories (and directories bellow them). There is set /srv/http, /home,/tmp and /usr/share/pear by default.
    To allow your vhost you should add /data/www or set empty value.

  • Select from multiple tables using max

    I have these 3 tables listed below and I want to write an sql that would give me
    WORKER_ACCOUNT.Name along with his latest status (which can be derived from WORK_LOG.Status for max(WORK_LOG.Log_ID) )
    I want NULL for missing status.
    Any help appreciated
    DROP TABLE WORKER_ACCOUNT;
    CREATE TABLE WORKER_ACCOUNT
    NAME VARCHAR2(255) NULL,
    ID INTEGER NULL
    INSERT INTO PANDORA_SVC.WORKER_ACCOUNT VALUES ('John Doe', 51);
    INSERT INTO WORKER_ACCOUNT VALUES ('Jane Doe', 52);
    DROP TABLE WORK_ASSIGNMENT;
    CREATE TABLE WORK_ASSIGNMENT
    WORKER_ID INTEGER NULL,
    WORK_ID INTEGER NULL
    INSERT INTO WORK_ASSIGNMENT VALUES (51, 101);
    INSERT INTO WORK_ASSIGNMENT VALUES (52, 102);
    DROP TABLE WORK_LOG;
    CREATE TABLE WORK_LOG
    WORK_ID INTEGER NULL,
    LOG_ID INTEGER NULL,
    STATUS VARCHAR2(255) NULL
    INSERT INTO WORK_LOG VALUES (101, 1, 'INITIATED');
    INSERT INTO WORK_LOG VALUES (101, 2, 'INVESTIGATING');
    INSERT INTO WORK_LOG VALUES (101, 3, 'FILING REPORT');
    COMMIT;
    Edited by: 811677 on Feb 22, 2011 11:10 PM

    try it please
    with data as
    (select wa.worker_id, wc.name, nvl(wl.status,'MISSING') status , nvl(wl.log_id,-1) LOG_ID
    from work_log wl, work_assignment wa, worker_account wc
    where wl.work_id(+)=wa.work_id
    and wa.worker_id(+)=wc.id)
    select worker_id, name, status
    from data a
    where
      log_id = (select max(b.log_id ) from data b
                  where a.worker_id = b.worker_id
                group by b.worker_id)or
    with data as
    (select wa.worker_id, wc.name, nvl(wl.status,'MISSING') status , nvl(wl.log_id,-1) LOG_ID
    from work_log wl, work_assignment wa, worker_account wc
    where wl.work_id(+)=wa.work_id
    and wa.worker_id(+)=wc.id)
    select worker_id, name, status, log_id from
    (select worker_id, name, status, log_id, max(log_id) over (partition by worker_id order by worker_id) max_log
    from data )
    where log_id = max_logEdited by: Mahir M. Quluzade on Feb 23, 2011 11:37 AM

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

  • Update On data from multiple Tables

    How can i update data from multiple tables(Using a Join)
    using a single update statement.

    Hii
    Suppose i have following tables
    create table emp_mas(empno number primary key,name varchar2(30));
    create table emp_grad(empno number primary key,grade varchar2(1));
    SQL> select * from emp_grad;
    EMPNO G
    100 A
    101 A
    102 B
    SQL> select * from emp_mas;
    EMPNO NAME
    100 GREG
    101 THOMAS
    102 SAM
    I would like to update information of employee 'GREG' Using a single update statement as
    UPDATE (SELECT E.EMPNO,E.NAME,G.GRADE FROM EMP_MAS E,EMP_GRAD G WHERE E.EMPNO=G.EMPNO) J
    SET J.NAME='GREG THOMAS',J.GRADE='B' WHERE EMPNO=100
    Then i am getting Error message like this.
    ERROR at line 2:
    ORA-01776: cannot modify more than one base table through a join view
    How can i achieve the result

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

  • 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

Maybe you are looking for