Updating more then one table

Is it possible to update more then one table (just out of curiousity)?
Something like (I know the following doesn't actually work but that's the basic logic):
UPDATE ps_vchr_hdr_stg a, ps_vchr_line_stg b
SET a.voucher_style = 'ADJ', b.po_id = ' '
WHERE a.key1 = b.key1
AND a.key2= b.key2
and a.gross_amt < 0

Hi, I don't think it is possible:
UPDATE {table_reference | [THE] (subquery1)} [alias]
SET
{column_name = {sql_expression | (subquery2)}
| (column_name [, column_name]...) = (subquery3)}
[, {column_name = {sql_expression | (subquery2)}
    | (column_name [, column_name]...) = (subquery3)}]...
[WHERE {search_condition | CURRENT_OF cursor_name}] [RETURNING]
[row_expression [, row_expression]... INTO
{variable_name | :host_variable_name}
[, {variable_name | :host_variable_name}]...];If you need to perform 2 or more operations put it into procedure or function as separate statements.
Regards,
Tomas

Similar Messages

  • Updation of more then one table at a time

    Hi,
    Can we Update more than one table at a time with a single query????
    and pl Note my server is : SQL Server

    pls note that you are in a Oracle forum (FYI Oracle is not a MS product).
    Alos I'm sure that there are plenty of MS SQL Server forums on the WWW where you ll find an answer to your question.

  • Can i update more then one column using select query.

    Dear All,
    Can i update more then one column of target table A from source table B. Like
    Update table A set A.A1 = (Select B.B1 from B where A.A3 = B.B3).
    Above stmt. I am updating only one column. But I want to update more then one column A.A1 and A.A2
    Plz give me the possible ways.
    Thanks,
    Vikas

    Yes you can do. Try the below Query
    Update A set (A.A1,A.A2) = (Select B.B1,B.B2 from B where A.A3 = B.B3)

  • How can i update more than one table at a time?

    i would like to update more than one table at a time. In Java Studio creator2 how can i do table updation?

    Hi,
    Please go through the below thread might be of help to you.
    http://forum.sun.com/jive/thread.jspa?forumID=123&threadID=51839
    RK

  • Update more then one records in join

    How to update more then one records in join query.
    means each reocrds have different value.
    Thanks

    Can you give an example to illustrate your question?

  • Using more then one table/view in same Report

    Hi,
    I am using Discoverer Plus Version 9.0.4.43.15.
    Is it possible to use more then one table/view in a report without the tables/views being joined in any way? It would be like using two different datasets in the same report without the datasets having anything to do with one another. Right now when I select items from the available tab I can only pick tables that relate to one another in some way.
    Or is it possible to use more the one table in the same report? Each table using a different query/view/table.
    Thanks

    Spence,
    try following type of query using set operator UNION / UNION ALL:
    select col1,col2
    from t1
    union all
    select col1,col2
    from t2
    If you don't have restrictions then this is the best way.

  • How to update more than one table using EO

    Hi frnds,
    Can someone provide me a doc/link which explain in detail how we can we update more than one PL/SQL tables using entity objects(on which VOs are based).
    Till date I have been doing this using PL/SQL procedures but now my requirement is to achieve it thru EO.Someone suggested me use VL to achieve plz help
    Thanks & Regards,

    Hi,
    That would be very nice of you,plz send me the docs and also send me similar docs that would be beneficial for a beginner like me.
    My id is [email protected]
    Thnx for your time.

  • Update more than one table

    Can more than one table be updated from a single form that was created using a wizard? If so, how? I tried firing a trigger to add a new record to another table, but get this message "No updatable report found. Multi row updated and delete operations can only be performed on tabular forms of type "Updateable Report"
    Thanks
    John

    Hi John B
    Please make sure you explain to forum when asking for help.
    What version of Apex your using.
    Database Version:
    Browser etc.
    Yes you can update multiple tables from one single form. I'm not 100% sure about the wizard part, because before anyone can answer that we need to know which version of Apex your using?

  • Using XSQL to insert rows in more then one table

    I tried to insert rows in one table and it works fine but does anyone know is it possiblle to insert row in two tables using one XML file.

    Alem,
    Could u please let me know how u achieved this ? I am using xsql servlet too and would be interested in the same. If u have been able to insert/update into more than one table using insert-request let me too know how u did it.
    Thanks in advance,
    Shanthi

  • Can xsu not be used to update more than one table at a time.

    I would like to update two or more tables using the same XML package. However when I use XML that contains tags using column names from both tables I get an error that the second table's columns names can not be found in the first table even if I use setUpdateColumnList and build an array that contains only columns from the first table.
    Xsu does not do me a lot of good if only one table at a time can be updated.

    Assuming you are using Oracle 8i you may want to bone up on 'Object Views' and 'instead of' triggers. This is the functionality that is commonly used to perform multiple table updates from a single data source such as XML.
    An object view can be based on a query such as 'select a.col1, a.col2, b.col1, b.col2 from a, b where a.key1 = b.key1'.
    The object view is then used by the XSU to perform the XML query/update rather than using tables a and b.
    You would then write an 'instead of' trigger on the object view. The trigger would update the appropriate table (a or b) based on the columns provided in the update list.
    Steve's book 'Building Oracle XML Applications' in Chapter 12 explains how to do it and has sample code that demonstrates the process.
    The book is available everywhere and you can download the sample code from the book at o'reilly's web site.
    Good luck!

  • Can XML Update more than One Table in one call?

    Hello,
    I had a quick question. I have a client who is using both Oracle and SQL. They have an app developed in C sharp with XML whichs runs against SQL and want to port to Oracle.
    In SQL one XML statment can update multiple Tables. Can we do that in XML in Oracle? I know, we can't do that using PL/SQL.
    Subhash

    Anupama,
    Thanks for offering your help. I have attached the sample code. It works fione on SQL. I need to make sure it works on Oracle as well.
    Subhash
    ALTER PROCEDURE dbo.spx_PutPackage
    @XMLText text
    AS
    DECLARE @hDoc int,
    @Package_Tbl_Id Int,
    @Package_Type_Id Int,
    @Binder_Id Int,
    @Package_Name Varchar(256),
    @Package_Status_Type_Id Int,
    @Package_Approval_SeqNo Int,
    @Package_Current_Issue Int
    BEGIN
    --******************************** DELETE ********************************
    EXEC sp_xml_preparedocument @hDoc OUTPUT, @XMLText
    DECLARE xml_cursor
    CURSOR FOR
    SELECT Package_Tbl_Id,Package_Type_Id,Binder_Id
    FROM openxml(@hDoc,'/ROOT/Package[@Package_Status="D"]')
    With Package
    OPEN xml_cursor
    FETCH NEXT FROM xml_cursor INTO @Package_Tbl_Id,@Package_Type_Id,@Binder_Id
    WHILE @@fetch_status = 0
    BEGIN
    DELETE Package WHERE Package_tbl_Id = @Package_Tbl_Id
    --If this package is an addendum, a trigger decrements the Current_Addendum_Number
    --when the addendum table is deleted as part of the cascade delete.
    FETCH NEXT FROM xml_cursor INTO @Package_Tbl_Id,@Package_Type_Id,@Binder_Id
    End
    Close xml_cursor
    DEALLOCATE xml_cursor
    --******************************** INSERT ********************************
    DECLARE xml_cursor
    CURSOR FOR
    SELECT
    Package_Tbl_Id,
    Package_Type_Id,
    Binder_Id,
    Package_Name,
    Package_Status_Type_Id,
    Package_Approval_SeqNo,
    Package_Current_Issue
    FROM openxml(@hDoc,'/ROOT/Package[@Package_Status="I"]')
    With Package
    OPEN xml_cursor
    FETCH NEXT FROM xml_cursor INTO
    @Package_Tbl_Id,
    @Package_Type_Id,
    @Binder_Id,
    @Package_Name,
    @Package_Status_Type_Id,
    @Package_Approval_SeqNo,
    @Package_Current_Issue
    WHILE @@fetch_status = 0
    BEGIN
    INSERT INTO Package (Package_Tbl_Id, Package_Type_Id, Binder_Id, Package_Name,
    Package_Status_Type_Id, Package_Approval_SeqNo, Package_Current_Issue)
    VALUES(@Package_Tbl_Id,
    @Package_Type_Id, @Binder_Id, @Package_Name, @Package_Status_Type_Id,
    @Package_Approval_SeqNo, @Package_Current_Issue)
    FETCH NEXT FROM xml_cursor INTO
    @Package_Tbl_Id,
    @Package_Type_Id,
    @Binder_Id,
    @Package_Name,
    @Package_Status_Type_Id,
    @Package_Approval_SeqNo,
    @Package_Current_Issue
    End
    Close xml_cursor
    DEALLOCATE xml_cursor
    --******************************** UPDATE ********************************
    DECLARE xml_cursor
    CURSOR FOR
    SELECT
    Package_Tbl_Id,
    Package_Type_Id,
    Binder_Id,
    Package_Name,
    Package_Status_Type_Id,
    Package_Approval_SeqNo,
    Package_Current_Issue
    FROM openxml(@hDoc,'/ROOT/Package[@Package_Status="U"]')
    With Package
    OPEN xml_cursor
    FETCH NEXT FROM xml_cursor INTO
    @Package_Tbl_Id,
    @Package_Type_Id,
    @Binder_Id,
    @Package_Name,
    @Package_Status_Type_Id,
    @Package_Approval_SeqNo,
    @Package_Current_Issue
    WHILE @@fetch_status = 0
    BEGIN
    Update Package
    SET
    Package_Type_Id = @Package_Type_Id,
    Binder_Id = @Binder_Id,
    Package_Name = @Package_Name,
    Package_Status_Type_Id = @Package_Status_Type_Id,
    Package_Approval_SeqNo = @Package_Approval_SeqNo,
    Package_Current_Issue = @Package_Current_Issue
    WHERE Package_tbl_Id = @Package_tbl_Id
    FETCH NEXT FROM xml_cursor INTO
    @Package_Tbl_Id,
    @Package_Type_Id,
    @Binder_Id,
    @Package_Name,
    @Package_Status_Type_Id,
    @Package_Approval_SeqNo,
    @Package_Current_Issue
    End
    Close xml_cursor
    DEALLOCATE xml_cursor
    EXEC sp_xml_removedocument @hDoc
    exec spx_putattachment @XMLText
    End
    SET QUOTED_IDENTIFIER ON

  • Updating more than one table in the same region

    Hi all,
    I have a header and detail relationship created between to entities. I created an association between them. I have 2 views and a view link based on the 2 entities.
    I have built an update page and I'm able to display the detail and header fields in the same region and my update to the detail fields are being processed correctly. However, my update to the header field is not working. I'm not getting any error messages, just that my header field remain unchange even after modifying the value and clicked the submit button on my page.
    Any suggestiong as to where I might have made a mistake?

    Ok, I got it to work by creating an association between the 2 entity objects and create a view based on the 2 entities. However, my real requirement is to only update the header level entity attribute after performing validations on the detail level attribute. My question now is this,
    How do call the set method associated with the header entity from the detail EOImpl?
    Please help!

  • How can I restrict more then one user to access the table?

    Hi !
    I have a problem and two solutions and I am a bit confused as to
    which one is the best one and/or can there be any better way of
    handling the problem ?
    Problem : I have to update a key field of a table when I update
    it in the form 5.0 screen. I am basically doing a maintenance of
    a table and if a certain field is updated then the change has to
    be reflected in two more tables. But the issue is that the field
    is a part of the key in those two tables. So all I can think of
    is that I need to insert new set or rows for that new value of
    the field and delete the old set of records for old values of
    the field.
    There are two ways of doing it;
    1.One option can be to explicitely define two cursors separately
    and fetch the values in them one by one and then insert the new
    records and then delete the old records in both the tables. This
    I feel will be a cumbersome process both in terms of processing
    time and the coding.
    2.Second option I was thinking can be to create two flat tables
    (without keys) and insert the values in them and update the
    changed field there and then insert the rows in the respective
    tables. Delete the old records in the main tables and delets the
    records in these flat tables. This is a bit more faster and
    easier to predict and code. This seems to be a better option for
    me.
    Any comments on these ?
    In both the cases I was thinking of making some provision so
    that more then one person can't update the table simultaneously.
    Since if there are more then one persons doing the processing
    then some inconsistency might creep into the whole process.
    This is easier to do in the second process as if I check the
    data in the flat tables and if there is some data then I can
    presume that some one is doing the processing and I can ask the
    other person to hold for a while. But in this case how can I
    stop more then two people to simultaneously check for the empty
    table and start inserting the record ?
    I was just thinking of having a sepatare table having only one
    field and this will be a key field and as the process begins the
    process will insert a fix value say 'Y' in the key field and at
    the end of the process the record will be deleted and this way
    we can restrict the user to access the process more then one at
    a time..? Since you can't have same value of the key in a table
    more then once.
    Any better way of handling it will be deeply appreciated.
    How about locking the table at the begining and releasing the
    lock at the end ? Will there be any issue in that? since I am
    inserting and deleting the rows in the same transaction.
    Comments welcome,
    Shobhit
    null

    How about performing the update IN the database using a stored
    procedure?
    By using non-database fields on your form to get the
    information, you can then call the procedure in the database to
    perform the updates. If an error occurs in the procedure you
    rollback, if necessary, and send a message or status back to the
    form. If it succeeds you might wish to commit and then re-
    execute the form's query -- using either the original key values
    or the new key values...
    null

  • Update in JDBC Sender adapter for more than one table

    Dear Friends,
              I have to select more than one table in the JDBC sender using the join condition. But i found that update statement is also mandatory in the sender comm channel. I am not going to update any flag after the select but as it is mandatory, i have decided to use the following update statement which wont effect the existing data UPDATE <tablename> set flag = ' ' where flag = ' '.
    But in my case i have 3 tables, do i need to update stmts for all the three tables.
    if yes how can i do the same.
    plz revert back i u couldnt get the queries.
    Thanks
    Prem

    HI
    UPDATE T1
    Set T1.flag =1
    where T1.columnA=value1 and T2.columnB=value2
    where T1 and T2 are tables in the same database,
    and the values (value1 and value 2 ) are provided to XI by SAP based on which the flag need to be updated in T1
    write a stored procedure specifying the join and call it in XI.
    For doing it in SQL statement only reffer to the below link ..sur you will get help .
    Multiple records update using JDBC
    Regard's
    Chetan Ahuja

  • Common diemsions and more then one fact table join problem

    Hi,
    I have 5 common dimension and 3 fact table which in the same subject area. When I want to display results from more then one fact table sending database then query more then one and I think BI server join this two different result on OBI server. But I think if obi server sending database query for exp. WITH SAWITH0 .... the results get effective.
    +++002002:2ea0000:2ea000f:----2009/03/14 10:12:59
    -------------------- SQL Request:
    SET VARIABLE QUERY_SRC_CD='Report';SELECT "- Common Dimensions"."Year Month" saw_0, "- Subs. Tariff"."Subscriber Current Tariff Type" saw_1, "- Common Measures".Arpu saw_2, "- Common Measures"."Gross Margin" saw_3, "- Call Out"."Callout Dur" saw_4, "- Case".Case_Info_Num saw_5 FROM "CUSTOMER PROFILING" WHERE ("- Common Dimensions"."Year Month" = 200901) AND ("- Subs. Tariff"."Subscriber Current Tariff Type" = 'PREPAID') ORDER BY saw_0, saw_1
    +++002002:2ea0000:2ea000f:----2009/03/14 10:12:59
    -------------------- General Query Info:
    Repository: Star, Subject Area: CUSTOMER PROFILING REV, Presentation: CUSTOMER PROFILING
    +++002002:2ea0000:2ea000f:----2009/03/14 10:13:00
    -------------------- Sending query to database named CENTRAVEA (id: <<471777>>):
    select T223282.DIM_TIME_MONTH_ID as c1,
    T221204.DIM_SUBS_CURRENT_TARIFF_TYPE as c2,
    avg(T223490.FACT_CP_ARPU) as c3,
    sum(T223490.FACT_CP_GROSS_MARGIN) as c4,
    sum(T223490.FACT_CP_CO_DUR) as c5
    from
    DM.DIM_SUBSCRIBER T221204 /* A_DIM_SUBSCRIBER */ ,
    DM.DIM_TIME_MONTH T223282 /* A_DIM_TIME_MONTH */ ,
    DM.FACT_CUST_PROFILING_PART3 T223490 /* A_FACT_CUST_PROFILING_PART3 */
    where ( T221204.DIM_SUBS_ID = T223490.DIM_SUBS_ID and T221204.DIM_SUBS_CURRENT_TARIFF_TYPE = 'PREPAID' and T223282.DIM_TIME_MONTH_ID = T223490.DIM_TIME_MONTH_ID and T223282.DIM_TIME_MONTH_ID = 200901 and T223490.DIM_TIME_MONTH_ID = 200901 )
    group by T221204.DIM_SUBS_CURRENT_TARIFF_TYPE, T223282.DIM_TIME_MONTH_ID
    order by c1, c2
    +++002002:2ea0000:2ea000f:----2009/03/14 10:13:00
    -------------------- Sending query to database named CENTRAVEA (id: <<471881>>):
    select T223282.DIM_TIME_MONTH_ID as c1,
    T221204.DIM_SUBS_CURRENT_TARIFF_TYPE as c2,
    sum(T223294.FACT_CP_CASE_INFO_NO) as c3
    from
    DM.DIM_SUBSCRIBER T221204 /* A_DIM_SUBSCRIBER */ ,
    DM.DIM_TIME_MONTH T223282 /* A_DIM_TIME_MONTH */ ,
    DM.FACT_CUST_PROFILING_PART1 T223294 /* A_FACT_CUST_PROFILING_PART1 */
    where ( T221204.DIM_SUBS_ID = T223294.DIM_SUBS_ID and T221204.DIM_SUBS_CURRENT_TARIFF_TYPE = 'PREPAID' and T223282.DIM_TIME_MONTH_ID = T223294.DIM_TIME_MONTH_ID and T223282.DIM_TIME_MONTH_ID = 200901 and T223294.DIM_TIME_MONTH_ID = 200901 )
    group by T221204.DIM_SUBS_CURRENT_TARIFF_TYPE, T223282.DIM_TIME_MONTH_ID
    order by c1, c2
    I have another subject area and which defined like this subject area contain two dimension and 5 fact table. If I want to display results on this subject area I can see best sql for my database
    My problem is why this two different subject areas create different queries. I think following query is the best for database.
    Thanks for your help
    +++002002:2ea0000:2ea0015:----2009/03/14 10:30:06
    -------------------- SQL Request:
    SET VARIABLE QUERY_SRC_CD='Report';SELECT "Dim - Segments"."Marketing Segment" saw_0, "Fact - Campaign Response"."Fact Campaign Award Amount" saw_1, "Fact - Customer Interaction"."Issue Response Cost" saw_2 FROM "AVEA ALL" ORDER BY saw_0
    +++002002:2ea0000:2ea0015:----2009/03/14 10:30:06
    -------------------- General Query Info:
    Repository: Star, Subject Area: AVEA ALL, Presentation: AVEA ALL
    +++002002:2ea0000:2ea0015:----2009/03/14 10:30:06
    -------------------- Sending query to database named AVEA ALL (id: <<474694>>):
    WITH
    SAWITH0 AS (select sum(T51461.FACT_CMPGN_AWARD_AMOUNT) as c1,
    T49384.DIM_MARKETING_SGMNT_DESC as c2
    from
    DM.DIM_MARKETING_SEGMENT T49384 /* DIM_BI_MARKETING_SEGMENT */ ,
    DM.FACT_CMPGN_RESPONSE T51461 /* FACT_BI_CMPGN_RESPONSE */
    where ( T49384.DIM_MARKETING_SGMNT_ID = T51461.DIM_MARKETING_SGMNT_ID )
    group by T49384.DIM_MARKETING_SGMNT_DESC),
    SAWITH1 AS (select sum(T51503.FACT_CUST_INT_ISSUE_RES_COST) as c1,
    T49384.DIM_MARKETING_SGMNT_DESC as c2
    from
    DM.DIM_MARKETING_SEGMENT T49384 /* DIM_BI_MARKETING_SEGMENT */ ,
    DM.FACT_CUST_INTERACTN T51503 /* FACT_BI_CUST_INTERACTN */
    where ( T49384.DIM_MARKETING_SGMNT_ID = T51503.DIM_MARKETING_SGMNT_ID )
    group by T49384.DIM_MARKETING_SGMNT_DESC)
    select distinct case when SAWITH0.c2 is not null then SAWITH0.c2 when SAWITH1.c2 is not null then SAWITH1.c2 end as c1,
    SAWITH0.c1 as c2,
    SAWITH1.c1 as c3
    from
    SAWITH0 full outer join SAWITH1 On SAWITH0.c2 = SAWITH1.c2
    order by c1

    I find solution on Oracle® Business Intelligence Suite Enterprise Edition Release Notes.
    If you use a version of Oracle Database 10g Release 2 prior to 10.2.0.3, then you might encounter an issue with a Full Outer Join that causes severe database performance issues and appears to hang the database when the Oracle BI Server sends to the database SQL queries that include WITH clauses.
    To work around this issue when using Oracle Database 10g Release 1 or 2, upgrade to Oracle Database 10g Release 2 Patch Set 2 (for 10.2.0.3). For performance reasons, this is the preferred workaround.
    To work around this issue without installing Patch Set 2, modify the Database Features table using the Administration Tool. This configuration prevents the Oracle BI Server from sending SQL constructs that expose the issue in an unpatched Oracle Database 10g.
    To modify the Database Features table:
    In the Administration Tool, open the properties of the Physical Database metadata object.
    Navigate to the Features tab.
    Ensure the values for the PERF_PREFER_MINIMAL_WITH_USAGE and PERF_PREFER_INTERNAL_STITCH_JOIN entries are selected, that is, set to True.

Maybe you are looking for