Updating multiple fields in oracle

Rated 4.63/5 based on 765 customer reviews

By commenting, you are accepting the DISQUS terms of service.Hi Everyone how should i update multiple columns of a table from another table...This will result in the active column for some products set to Y and others set to N: It is possible to use a subquery in the WHERE clause as well.

Assume that the company wants to activate products that have a price above average.

UPDATE dest_tab tt SET (tt.code, tt.description) = (SELECT st.code, st.description FROM source_tab st WHERE = tt.id) WHERE EXISTS (SELECT 1 FROM source_tab WHERE id = tt.id); 5000 rows updated.

SQL ----------------------------------------------------------------------------------------------- | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | ----------------------------------------------------------------------------------------------- | 0 | UPDATE STATEMENT | | 4999 | 185K| 30013 (34)| | | 1 | UPDATE | dest_tab | | | | | | 2 | NESTED LOOPS SEMI | | 4999 | 185K| 19 (6)| | | 3 | TABLE ACCESS FULL | dest_tab | 10000 | 332K| 18 (0)| | |* 4 | INDEX UNIQUE SCAN | source_tab_PK | 2500 | 10000 | 0 (0)| | | 5 | TABLE ACCESS BY INDEX ROWID| source_tab | 1 | 43 | 2 (0)| | |* 6 | INDEX UNIQUE SCAN | source_tab_PK | 1 | | 1 (0)| | ----------------------------------------------------------------------------------------------- Predicate Information (identified by operation id): --------------------------------------------------- 4 - access("ID"="TT"."ID") 6 - access("ST"."ID"=: B1) UPDATE (SELECT tt.id, tt.code, tt.description, AS st_code, st.description AS st_description FROM dest_tab tt, source_tab st WHERE = st.id) ilv SET = ilv.st_code, ilv.description = ilv.st_description; 5000 rows updated.

Suppose I have table A and B and having four columns each table A(col1,col2,col3,col4) B(col1,col2,col3,col4) then how should i do something like this update A set(col2,col4)=(select B.col2, B.col4 from B where B.col1=A.col1 and A.col3=A.col3) Please help..........

If you omit the WHERE clause, all records in the table will be updated!

Leave a Reply

  1. pof com online dating service for singles 03-Feb-2020 10:23

    She was an avatar in Second Life, the online, 3D, digital world developed by San Francisco company Linden Labs.

  2. names of dating agencies 21-Nov-2020 03:02

    You can still send a message -- it just won't show up in the recipient's inbox unless you match.

  3. Adult oral dating 23-Dec-2020 17:23

    Terrence J is currently hosting the dating competition show “Coupled” on FOX.

  4. dating jewish girls tips 20-Jul-2020 21:12

    Teachers teach with words, which is verbal learning. However, there are learning styles these methods ignore: the kinesthetic or physical method of learning; the aural or hearing learning style; the logical or mathematical sequencing style.

  5. lil scrappy and shay buckeey johnson dating 28-Feb-2020 08:41

    Common rules for all anonymous chat rooms: - All the secrets you share in Anti Chat, must stay in Anti Chat- Teens aged less than 17 are not allowed to download and use this app- All international and private chats must remain free of trolling, bullying and agitating.