Multiple row update of a table from another one

Im trying to make a multiple row update with date from a different table, but it's giving me an error.
update inv.mtl_system_items_b
set attribute1 = t2.description,
    last_update_date = SYSDATE,
    last_updated_by = 3606
from inv.mtl_system_items_b t2
     inner join TMP.TMP_INACTIVAR_PRODUCTOS t1
     on t2.segment2 = t1.inventory_item_id;Edited by: user8986013 on 21-may-2010 14:15

Hi,
Whenever you have a question involving an error message, post the complete error message, including line number. Don't you think that might help people solve your problem?
Whneve you have any question, post a little sample data (CREATE TABLE and INSERT statements) and the results you want from that data. (In the case of a DM<L statement, like UPDATE, the INSERT statements show the tables before the change, and the results are the contents of the changed table after it.)
Review the syntax of the UPDATE statement in the SQL Language manual:
http://download.oracle.com/docs/cd/B28359_01/server.111/b28286/statements_10008.htm#sthref9598
MERGE may be more efficient and easier to use than UPDATE.

Similar Messages

  • Insert multiple rows into a same table from a single record

    Hi All,
    I need to insert multiple rows into a same table from a single record. Here is what I am trying to do and I need your expertise. I am using Oracle 11g
    DataFile
    1,"1001,2001,3001,4001"
    2,"1002,2002,3002,4002"
    The data needs to be loaded as
    Field1      Field2
    1               1001
    1               2001
    1               3001
    1               4001
    2               1002
    2               2002
    2               3002
    2               4002
    Thanks

    You could use SQL*Loader to load the data into a staging table with a varray column, then use a SQL insert statement to distribute it to the destination table, as demonstrated below.
    SCOTT@orcl> host type test.dat
    1,"1001,2001,3001,4001"
    2,"1002,2002,3002,4002"
    SCOTT@orcl> host type test.ctl
    load data
    infile test.dat
    into table staging
    fields terminated by ','
    ( field1
    , numbers varray enclosed by '"' and '"' (x))
    SCOTT@orcl> create table staging
      2    (field1  number,
      3     numbers sys.odcinumberlist)
      4  /
    Table created.
    SCOTT@orcl> host sqlldr scott/tiger control=test.ctl log=test.log
    SQL*Loader: Release 11.2.0.1.0 - Production on Wed Dec 18 21:48:09 2013
    Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.
    Commit point reached - logical record count 2
    SCOTT@orcl> column numbers format a60
    SCOTT@orcl> select * from staging
      2  /
        FIELD1 NUMBERS
             1 ODCINUMBERLIST(1001, 2001, 3001, 4001)
             2 ODCINUMBERLIST(1002, 2002, 3002, 4002)
    2 rows selected.
    SCOTT@orcl> create table destination
      2    (field1  number,
      3     field2  number)
      4  /
    Table created.
    SCOTT@orcl> insert into destination
      2  select s.field1, t.column_value
      3  from   staging s, table (s.numbers) t
      4  /
    8 rows created.
    SCOTT@orcl> select * from destination
      2  /
        FIELD1     FIELD2
             1       1001
             1       2001
             1       3001
             1       4001
             2       1002
             2       2002
             2       3002
             2       4002
    8 rows selected.

  • Multiple Row Update in a Table

    Hi,
    How do I do a multiple row update in a single table in Oracle? I was thinking of something that is similar to the insert example below:
    Insert into SOME_TABLE (COL1, COL2) (select COL1, COL2 from ANOTHER_TABLE);
    ...wherein I don't have to write multiple lines of update statement.
    Thanks.

    Hi Mike,
    Thanks for replying. I was actually looking for a multiple row update using a single update statement. The only reason I provided an Insert statement example is to show the idea. I did some test and I was able to figure it out. I thought it was something complicated but I just had to retrieve the new values from another table and equate the primary key and foreign keys of the two tables.

  • How to create multiple rows in a child table from the multi select Lov

    Hi
    We have Departments and EmployDept and Persons tables and each employee can associate multiple departments and vice versa.While creating a Department page there should be a Multi Select LOV(values from Persons table) with search option for the Persons.From the search panel we can select multiple persons for that department.Suppose we have selected 5 persons and click on submit, then it should create 5 rows in the EmployDept table for 5 persons with that department id.
    Any inputs on how to implement this scenario please..

    Maybe you can get some ideas from here -
    http://adfdeveloper.blogspot.com/2011/07/simple-implementation-of-af.html

  • Load multiple rows of data in table

    hi i want to load multiple rows of data into table from flat file.
    i have oracle 10g enterprise edition, and can not find and envok
    sqlldr. edit command only does one line at a time.
    help please.

    thank you i got sqlldr.
    new problem
    i have created a control file customers.ctl
    LOAD DATA
    INFILE 'C:\ADD_CUST.TXT'
    INTO TABLE CUSTOMERS
    (CUSTOMER_NUMBER,LAST,FIRST,STREET,CITY,STATE,ZIP_CODE,BALANCE,CREDIT_LIMIT,SLSREP_NUMBER)
    and i have data to be loaded into the table in ADD_CUST.txt file.
    this is one line of data there are 9 similer lines.
    '124','ADAMS','SALLY','481 OAK','LANSING','MI','49224',818.75,1000,'03'
    now when i run sqlldr from cmd line below is the message i get.
    SQL*Loader: Release 10.2.0.1.0 - Production on Wed Feb 13 21:04:08 2008
    Copyright (c) 1982, 2005, Oracle. All rights reserved.
    C:\>SQLLDR hr/hr control=CUSTOMERS.CTL log=customers.log
    SQL*Loader: Release 10.2.0.1.0 - Production on Wed Feb 13 22:10:19 2008
    Copyright (c) 1982, 2005, Oracle. All rights reserved.
    Commit point reached - logical record count 9
    Commit point reached - logical record count 10
    C:\>
    please help

  • How to update one table from another

    I am creating scripts in Oracle 10g. I have a table that has data corruption on three date fields.
    I created a table with the following sql of all the affected rows:
    CREATE TABLE LSU_INTER_FIX_DATE AS
    select request_id,received_date,planned_start_date, actual_start_date
    from lsu_inter2_requests_t
    where received_date < to_date('01-JAN-1900')
    OR planned_start_date < to_date('01-JAN-1900')
    OR actual_start_date < to_date('01-JAN-1900')
    I then repaired all of the rows with three data fixes
    UPDATE LSU_INTER_FIX_DATE
    SET received_date = TO_CHAR(received_date,'YY-MON') ||'-'||(TO_CHAR(received_date,'RRRR') + 2000)
    where received_date < to_date('01-JAN-1900')
    UPDATE LSU_INTER_FIX_DATE
    SET planned_start_date = TO_CHAR(planned_start_date,'YY-MON') ||'-'||(TO_CHAR(planned_start_date,'RRRR') + 2000)
    where planned_start_date < to_date('01-JAN-1900')
    UPDATE LSU_INTER_FIX_DATE
    SET actual_start_date = TO_CHAR(actual_start_date,'YY-MON') ||'-'||(TO_CHAR(actual_start_date,'RRRR') + 2000)
    where actual_start_date < to_date('01-JAN-1900')
    I now want to update the original base table with the corrected data so I wrote the following SQL UPDATE command:
    UPDATE lsu_inter2_requests_t aaa
    SET aaa.received_date = bbb.received_date
    FROM LSU_INTER_FIX_DATE bbb WHERE aaa.request_id = bbb.request_id
    When I run this sql Oracle returns the error “ORA-00933 SQL command not properly ended.” How do I update multiple rows in one table from another table that share the same primary key?

    Comet wrote:
    I am creating scripts in Oracle 10g. I have a table that has data corruption on three date fields.
    I created a table with the following sql of all the affected rows:
    CREATE TABLE LSU_INTER_FIX_DATE AS
    select request_id,received_date,planned_start_date, actual_start_date
    from lsu_inter2_requests_t
    where received_date < to_date('01-JAN-1900')
    OR planned_start_date < to_date('01-JAN-1900')
    OR actual_start_date < to_date('01-JAN-1900')
    I then repaired all of the rows with three data fixes
    UPDATE LSU_INTER_FIX_DATE
    SET received_date = TO_CHAR(received_date,'YY-MON') ||'-'||(TO_CHAR(received_date,'RRRR') + 2000)
    where received_date < to_date('01-JAN-1900')
    UPDATE LSU_INTER_FIX_DATE
    SET planned_start_date = TO_CHAR(planned_start_date,'YY-MON') ||'-'||(TO_CHAR(planned_start_date,'RRRR') + 2000)
    where planned_start_date < to_date('01-JAN-1900')
    UPDATE LSU_INTER_FIX_DATE
    SET actual_start_date = TO_CHAR(actual_start_date,'YY-MON') ||'-'||(TO_CHAR(actual_start_date,'RRRR') + 2000)
    where actual_start_date < to_date('01-JAN-1900')
    I now want to update the original base table with the corrected data so I wrote the following SQL UPDATE command:
    UPDATE lsu_inter2_requests_t aaa
    SET aaa.received_date = bbb.received_date
    FROM LSU_INTER_FIX_DATE bbb WHERE aaa.request_id = bbb.request_id
    When I run this sql Oracle returns the error “ORA-00933 SQL command not properly ended.” How do I update multiple rows in one table from another table that share the same primary key?I am not convinced you have what you think you have
    >
    UPDATE LSU_INTER_FIX_DATE
    SET received_date = TO_CHAR(received_date,'YY-MON') ||'-'||(TO_CHAR(received_date,'RRRR') + 2000)
    where received_date < to_date('01-JAN-1900')
    When you want to produce a DATE datatype when starting with a string,
    you must use TO_DATE() on the SET line!
    (TO_CHAR(received_date,'RRRR') + 2000)since when do you do add characters (from TO_CHAR) with a constant number (2000)?
    You should NEVER EVER rely on implicit datatype conversion
    Edited by: sb92075 on Jul 27, 2011 7:09 PM

  • How to update date in a table from another database

    Hello,
    I am trying to code a way to Update my Testing database from another database. In the coding below the database that has the updated data ends in Restore.
    Use ClientDB_MASTER_Restore
    Truncate Table ClientDB_MASTER_Testing.dbo.Activity_Tracking_AZ
    GO
    SELECT * INTO ClientDB_Master_Testing.dbo.Activity_Tracking_AZ
    FROM Activity_Tracking_AZ
    Go
    I know with this Technique the table must be truncated if not deleted first.  There is probably a better way to do this which I'm very open to.  I'm also looking for coding that will roll back any changes made should an error occur.
      As always, any help is greatly appreciated.
    David92595

    USE ClientDB_MASTER_Testing
    go
    SET XACT_ABORT ON
    BEGIN TRANSACTION
    Truncate Table dbo.Activity_Tracking_AZ
    -- SET IDENTITY_INSERT dbo.Activity_Tracking_AZ ON
    INSERT dbo.Activity_Tracking_AZ (col1, col2, ...)
    SELECT col1, col2,
    FROM ClientDB_MASTER_Restore.dbo.Activity_Tracking_AZ
    -- SET IDENTITY_INSERT dbo.Activity_Tracking_AZ OFF
    COMMIT TRANSACTION
    If you find it boring to type the column lists, just find the table in Object Explorer, and drag the columns node to where you want the column list.
    You need the SET IDENTITY_INSERT command if the table has an IDENTITY column.
    By wrapping the code in a transaction, you are not left with an empty table if the INSERT fails. The command SET XACT_ABORT ON makes sure that the batch is aborted and rolled back in case of an error.
    Erland Sommarskog, SQL Server MVP, [email protected]

  • Multiple Rows Update / Refresh Toplink Query when database trigger involved

    Hi everybody!
    I have two easy troubles for you; the platform is the same as the SRDemo Toplink version.
    1.     Multiple Rows Update: I want to update with mergeEntity method, multiple rows for an isolated table; that method receives a parameter that I try to bind with the iterator "dataProvider" but it only merges the first row, not all, any other combination returns an error.
    What I want to do is to have a form (like tabular forms in Apex) that lets me update multiple rows in a single page. ¿May anyone tell me how to do it?
    2.     Refresh Toplink Named Query: I have a list on a page with two columns. From another page, a button does an action that fires a database trigger that updates one of the columns on the list´s page. When I go back to the list, it is not updated; however, the CacheResults´s property is set to false on the iterator.
    Thanks in advance,
    Alejandro T

    I didn't use it (yet), but - you might take a look. You'll find a [url http://www.oracle.com/technetwork/developer-tools/apex/application-express/apex-plug-ins-182042.html]Timer plug-in on this page. It is a dynamic action which allows you to periodically fire other dynamic actions in the browser. For example use the timer to refresh a region every five minutes. You can perform any dynamic action you want using this infrastructure.So I was thinking: you might use it to run a dynamic action which would check whether something changed in that table (I suppose you'll know the way) (for example, a database trigger might set a flag in some table, timestamp or similar), and - if you find that something really changed - refresh the page.
    As I said, I never used it so that's pure theory. Someone else might know better, though.

  • Multiple row update; CEV business rule parameters are not refreshed

    During a multiple row update, a business rule is fired for each row.
    This change event business rule must update the value of another column in the same table (and same row).
    Unfortunately, the parameters of the BR are keeping the values of the first row that has been checked. Since my parameter p_id always keeps the same value, I always update the same row.
    Does somebody have a hint on how to solve this problem ?
    I'm using Headstart R6i and Forms6i with Oracle9i DB.
    Thanks in advance for your help,
    Denis.

    I think that's how it works. I tried that with a variable where type is Members.
    It is not showing me a prompt when i select multiple rows. However works only for first row. (even if the menu is initiated from second row).
    Multiple rows selected, variable type is members. works only for first row in selection. (in 11.1.2.2) You can try log an SR and see what Oracle has to say.
    Regards
    Celvin
    http://www.orahyplabs.com

  • Multiple Rows Update

    Hi,
    I am creating a form which will display the multiple rows from the table. Is there any way to make multiple rows update at the same time.
    If it is report generated by the query, can we do multiple rows update.
    Regards,
    Munish

    Munish,
    Sounds like what you’re looking for is a tabular form. Click on create page, then choose form, then tabular form and follow the steps of the wizard. This will create a tabular form for you that lets you update multiple rows, add new rows and delete multiple rows.
    Regards,
    Marc

  • ADF JSF - Multiple Rows Update

    Does anybody if there is a new component in ADF JSF that allows update of multiple rows? Se example...
    ID     | Name | Number
    1     | textbox | textbox
    2     | textbox | textbox
    3     | textbox | textbox
    |Create- button| | Save - button|

    Sure, the ADF Faces <af:table> supports updating multiple rows: just put an <af:inputText> inside one of the columns.

  • Hide multiple rows in a dynamic table based on the row value.

    Hi,
    I need to hide multiple rows in a dynamic table based on the specific value of that row.
    I cant find the right expression to do that.
    please help

    Go to the Row Properties, and in the Visibility tab, you have "Show or hide based on an expression". You can use this to write an expression that resolves to true if the row should be hidden, false otherwise.
    Additionally, in the Matrix properties you should take a look at the filters section, perhaps you can achieve what you wish to achieve through there by removing the unnecessary rows instead of just hiding them.
    It's only so much I can help you with the limited information. If you require further help, please provide us with more information such as what data are you displaying, what's the criteria to hiding rows, etc...
    Regards
    Andrew Borg Cardona

  • How to import a table from another oracle database ?

    Hi all ,
    i could like to use pl/sql to import one table from another oracle database server ?
    is it possible to do this ?
    A server B server
    table: test <------------------------> table : newtest
    the tns profile already configurated . the connection is ready .
    thanks a lot !
    Best Regards,
    Carlos

    if i don't have TEST table on server B whether COPY command will create this table on server B with the same structure ? If you specify CREATE as a clause the table will be created:
    SQL> help copy
    COPY
    COPY copies data from a query to a table in a local or remote
    database. COPY supports CHAR, DATE, LONG, NUMBER and VARCHAR2.
    COPY {FROM database | TO database | FROM database TO database}
                APPENDCREATE|INSERT|REPLACE} destination_table
                [(column, column, column, ...)] USING query
    where database has the following syntax:
         username[password]@connect_identifier

  • I can't create table from another table?

    Hi everyone!
    I have a problem that I don't known the reason why?
    I'm using Oracle version 8i and I want to create a table from another table, such as:
         CREATE TABLE a_backup as SELECT * FROM a => It's OK, table a_backup is created.
    But there is only a table that I can't created like that, such as:
         CREATE TABLE b_backup AS SELECT * FROM b;
    When I run over command, SQL Plus is not responding... and clients are can't access to DB or Executing forever
    This is the first time I met this problem.
    Can Anyone help me to resolved it?
    Thanks in advance!

    xi`tin wrote:
    Hi everyone!
    I have a problem that I don't known the reason why?
    I'm using Oracle version 8i and I want to create a table from another table, such as:You realize, of course, that 8i is completely out of support .... Is your OS and hardware just as old as your rdbms software, or is it only the rdbms that your company refuses to upgrade?
         CREATE TABLE a_backup as SELECT * FROM a => It's OK, table a_backup is created.
    But there is only a table that I can't created like that, such as:
         CREATE TABLE b_backup AS SELECT * FROM b;
    When I run over command, SQL Plus is not responding... and clients are can't access to DB or Executing forever
    This is the first time I met this problem.
    Can Anyone help me to resolved it?
    Thanks in advance!

  • Update the z table from the header text of VF01 on save

    Hi All,
    I have a  Z table 'ZEXIM_LICDETAILS'. Whenever a billing doc. of type 'ZEXP' is created with tcode VF01, the Z table fields should also be updated. I have learned that we cannot include tabs in Billing Doc, so the licence number is put in the header text of the VF01.
    Is there any way that I can update my Z table from header text, when we save the VF01.
    Waiting for your repy in anticipation.
    Thanks a lot in advance,
    Anu

    Write code in USEREXIT_FILL_VBRK_VBRP (Module pool SAPLV60A, program RV60AFZC)
    Reddy

Maybe you are looking for

  • Checks just feed through or paper size mismatch on C7250, Bad paper sensors on new printers

    Hi all,   I have seen these related posts: http://h30434.www3.hp.com/t5/Other-printing-questions/Printing-checks-on-officejet-pro-8500/m-p/2460... http://h30434.www3.hp.com/t5/Other-printing-questions/B8850-Printing-Problem-on-Canary-print-paper/t...

  • Partition external HD to use it for time machine backup and nas storage

    i have a macbook pro with retina display with 500gb of ssd storage runing yosemite and a airport extreme latest model. what i want to do is to use an external drive (1TB) and use it to hold all my files of my macbook, and i want to make time machine

  • Profile Matchup With Own Position

    Hello All, I am working on upgrade from EP 5.0 to EP 7.0 In this i am working on profile match up .In EP 5.0 standard ITS service MY_PROFILEMATC is used ,this calls report RHPD_MY_PROFILEMATCHUP and Profile Matchup screen opens .It basically shows th

  • Executing multiple process instances in a batch

    In one of our processes we need to execute multiple process instances together in one go. In order to accomplish this, we have taken a new process which takes a list of instanceStampIds to be processed and then using PAPI processing them one after an

  • Analytical workspace for Oracle10g to use OLAP

    hi i have downloaded Oracle10g Release 2 from oracel website. i couldn find Analytical Workspace with this installation. what should i do to work with AW manager. very urgent please rgds karthi