Join conditions, update a table

Hello

I created a table of choice in the apex, so my Dispatcher column, moved to the new table. (first time doing so)

I created again the dispatcher of the column in the first table.

I have the following code:

SELECT R.DISPATCHER, B.DISPATCHER

OF GCAT_V3 R JOIN GCAT_DISPATCHER_LOOKUP B

ON R.DISPATCHER_ID = B.DISPATCHER_ID

DISPATCHER DISPATCHER
-SU. [email protected]
-SU. [email protected]
-SU. [email protected]
-SU. [email protected]

I need to copy the data back.

Basically, what I have in the column that b.Dispatcher must be copied to another column dispatcher.

Any ideas?

Kind regards

Leonard

Hi, Leonard,

Whenever you have a question, please post a small example of data (CREATE TABLE and only relevant columns, INSERT statements) for all of the tables involved and the accurate results you want from this data, so that people who want to help you can recreate the problem and test their ideas.

If you ask about a DML operation, such as UPDATE, then INSERT statements, you post should show what looks like the tables before the DML, and the results will be the content of the table changed after the DML.

Explain, using specific examples, how you get these results from these data.

Always say what version of Oracle you are using (for example, 11.2.0.2.0).

See the FAQ forum: Re: 2. How can I ask a question on the forums?

You can use the UPDATE or MERGE to copy data from a table to the existing lines in another.  For example:

UPDATE gcat_v3 r

SET dispactcher =)

SELECT b.dispatcher

OF gcat_dispatcher_lookup b

WHERE b.dispatcher_id = r.dispatcher_id

)

;

The above statement assumes that dispatcher_id is unique in gcat_dispatcher_lookup; But there is no need to be unique in gcat_v3.

Tags: Database

Similar Questions

  • Under certain conditions, update a table based on the comparison with a SQL statement

    I have a table (table 1) that has 4 columns:

    UID. THE NEST | VALUE1 | VALUE2

    I have another statement SQL (STMT) that returns the 3 columns of a few other tables:

    UID. THE NEST | VALUE1

    Now this is the condition of the way in which I want to put up-to-date TABLE1:

    First, to compare a pair of UID and PID of STMT with those in TABLE1,

    -1, for any new pair UID and PID not in TABLE1, insert a new line of STMT in TABLE1 set TABLE1. Value2 = 0 (I already did this).

    2, for an existing UID and PID pair in STMT and TABLE1, do:

    a. in TABLE1. Value2 > 0, update TABLE1. VALUE1 = STMT. VALUE1

    b. to TABLE1. Value2 = 0 and if TABLE1. VALUE1! = STMT. Value1, update of TABLE1. VALUE1 = STMT. Value1, otherwise nothing to do.

    I can't seem to come with a solution for condition 2. Any help is appreciated!

    Hello

    Here's one way:

    MERGE INTO  table1  dst
    USING          (
                 SELECT  ...   -- your stmt query goes here
             )   src
    ON         (    src.uid  = dst.uid
             AND      src.pid  = dst.pid
             )
    WHEN MATCHED THEN UPDATE
    SET           dst.value1 = CASE
                                   WHEN   dst.value2 > 0
                        OR     (   dst.value2 = 0
                             AND dst.calue1 != src.value1
                        )
                        THEN   src.value1
                               END
    WHERE   dst.value2 > 0
    OR (    dst.value2 = 0
       AND  dst.calue1 != src.value1
       )
    ;
    

    This assumes that the combination (uid, pid) is unique in stmt. It doesn't have to be unique in table1.

    sb92075 wrote:

    -1, for any new pair UID and PID not in TABLE1, insert a new line of STMT in TABLE1 set TABLE1. Value2 = 0 (I already did this).

    FUSION could also do parts 1 and 2 together, in the same statement.

    2, for an existing UID and PID pair in STMT and TABLE1, do:

    a. in TABLE1. Value2 > 0, update TABLE1. VALUE1 = STMT. VALUE1

    b. to TABLE1. Value2 = 0 and if TABLE1. VALUE1! = STMT. Value1, update of TABLE1. VALUE1 = STMT. Value1, otherwise nothing to do.

    Why are they not simply your needs ' uid and pid that already exist in stmt and table1, if table1.value2 > = 0, then the value table1.value1 = stmt.value1 "? Are you concerned about shooting triggers unnecessarily? It has something to do with null values? The MERGE statement above does exactly what you asked, but, depending on your needs, something simpler and more efficient could do it as well.

    I hope that answers your question.
    If not, post a small example data (CREATE TABLE and only relevant columns, INSERT statements) for all of the tables involved and also publish outcomes from these data.
    If you ask on a DML statement, such as UPDATE, the sample data will be the content of the or the tables before the DML, and the results will be the State of the or the tables changed when it's all over.
    Explain, using specific examples, how you get these results from these data.
    Always tell what version of Oracle you are using.
    See the FAQ forum {message identifier: = 9360002}

    Published by: Frank Kulash, June 6, 2012 14:51

  • Update of table with no column

    Hello

    Why oracle is that although the statement is incorrect? is there any docid for this?

    SQL > select banner version of v$.

    BANNER
    ----------------------------------------------------------------
    Oracle9i Enterprise Edition Release 9.2.0.8.0 - 64 bit Production
    PL/SQL Release 9.2.0.8.0 - Production
    CORE Production 9.2.0.8.0
    AMT for Solaris: 9.2.0.8.0 - Production Version
    NLSRTL Version 9.2.0.8.0 - Production


    SQL > desc one
    Name Null? Type
    ----------------------------------------- -------- ----------------------------
    AA NUMBER (1)
    BB NUMBER (1)

    SQL > desc b
    Name Null? Type
    ----------------------------------------- -------- ----------------------------
    AA NUMBER (1)
    CC NUMBER (1)

    SQL > select * from a;

    AA BB
    ---------- ----------
    1 1
    2 2
    3 3
    4 4
    3 s

    SQL > select b bb;
    Select bb b
    *
    ERROR on line 1:
    ORA-00904: "BB": invalid identifier


    SQL > update a game aa = 3 where bb (select b BB); -> bb of the column does not exist in table b

    5 lines to date.

    SQL > select * from a;

    AA BB
    ---------- ----------
    1 of 3
    1 p
    3 3
    3 4
    6 P

    Thank you
    Shanker

    No specific document. He has correlated subqueries. There is, of course, usually join condition.

    http://download.Oracle.com/docs/CD/B19306_01/server.102/b14200/statements_10002.htm#i2066912

  • Incompatibility of County to join condition

    Hello

    I do a join on the relational tables (select * T_ZIP_CODE - save 47561 County and SELECT * OF P_GEODATA - number of records 42451) using the below sql # 1 (where a.zip_cde = b.zip_cde) I'm number of records as 41979 and while I am executing sql # 2 (difference of 2 SQL is condition where a.zip_cde <>b.zip_cde) get the number of records = 1773815507

    For SQL # 2 I should get the number of records about 541

    Can someone me please suggest that if something is wrong.

    SQL # 1

    Select

    b.ZIP_CDE,

    a.ZIP_CDE_STRT_DTE,

    b.TLPHN_AREA_CDE,

    b.POP_LVL_CDE,

    b.PMSA_MSA_NECMA_CDE,

    b.FIPS_PRMRY_CNTY_CDE,

    b.CNTY_NAM_PRMY,

    b.FIPS_ADDL_CNTY_1_CDE,

    b.CNTY_NAM_1,

    b.FIPS_ADDL_CNTY_2_CDE,

    b.CNTY_NAM_2,

    b.FIPS_ADDL_CNTY_3_CDE,

    b.CNTY_NAM_3,

    b.FIPS_ADDL_CNTY_4_CDE,

    b.CNTY_NAM_4,

    b.DMA_CDE,

    b.DMA_NAM,

    b.CBSA_CDE,

    b.CBSA_TYP,

    b.MSA_DIV_CDE,

    b.CSA_CDE,

    b.CMSA_CDE

    T_ZIP_CODE a, P_GEODATA B where a.zip_cde = b.zip_cde

    and CURRENT_DATE < ZIP_CDE_END_DTE

    record COUNT - 41979

    Select

    b.ZIP_CDE,

    a.ZIP_CDE_STRT_DTE,

    b.TLPHN_AREA_CDE,

    b.POP_LVL_CDE,

    b.PMSA_MSA_NECMA_CDE,

    b.FIPS_PRMRY_CNTY_CDE,

    b.CNTY_NAM_PRMY,

    b.FIPS_ADDL_CNTY_1_CDE,

    b.CNTY_NAM_1,

    b.FIPS_ADDL_CNTY_2_CDE,

    b.CNTY_NAM_2,

    b.FIPS_ADDL_CNTY_3_CDE,

    b.CNTY_NAM_3,

    b.FIPS_ADDL_CNTY_4_CDE,

    b.CNTY_NAM_4,

    b.DMA_CDE,

    b.DMA_NAM,

    b.CBSA_CDE,

    b.CBSA_TYP,

    b.MSA_DIV_CDE,

    b.CSA_CDE,

    b.CMSA_CDE

    T_ZIP_CODE a, P_GEODATA B where a.zip_cde <>b.zip_cde

    and CURRENT_DATE < ZIP_CDE_END_DTE

    record count = 1773815507

    Thank you!

    3058870 wrote:

    Hello

    I do a join on the relational tables (select * T_ZIP_CODE - save 47561 County and SELECT * OF P_GEODATA - number of records 42451) using the below sql # 1 (where a.zip_cde = b.zip_cde) I'm number of records as 41979 and while I am executing sql # 2 (difference of 2 SQL is condition where a.zip_cde <> b.zip_cde) get the number of records = 1773815507

    For SQL # 2 I should get the number of records about 541

    Why? Suppose table A has three lines id = 1,2,3 and table B has 4 lines, id = 1,2,3,4. A.id = b.id condition will return 3 rows. But condition a.id! = b.id will not return 1 row. Why? A.id condition! = b.id will be true for:

    a.ID = b.id 1 = 2

    a.ID = b.id 1 = 3

    a.ID = b.id 1 = 4

    a.ID = b.id 2 = 1

    a.ID = b.id 2 = 3

    a.ID = b.id 2 = 4

    a.ID = b.id 3 = 1

    a.ID = b.id 3 = 2

    a.ID = b.id 3 = 4

    A.ID Yes! = b.id will not return 1, but 9 lines.

    SY.

  • Trying to update a table in a second table when the data are different

    Hello;
    I have a the same table in two databases. The database are connected with a DB link. I'm trying to update one table based on the data in the second table when the EMP_ID is but the name does not match.

    The table will look like:
    Table name: EMP
    EMP_ID
    LAST_NAME
    FIRST NAME
    MIDDLE_INITIAL

    My SQL is:
     
    update EMP TARGET 
        set (TARGET.LAST_NAME, TARGET.FIRST_NAME,TARGET.MIDDLE_INITIAL) = ( 
            select SOURCE.LAST_NAME, SOURCE.FIRST_NAME, SOURCE.MIDDLE_INITIAL 
            from EMP@OTHER_DB SOURCE where 
            TARGET.PHYSICIAN_ID = SOURCE.PHYSICIAN_ID 
            and TARGET.LAST_NAME <> SOURCE.LAST_NAME); 
    This refers to a number of update of all lines not the bit I want.

    Any help would be great!

    Hello

    Sky13 wrote:
    Hello;
    I have a the same table in two databases. The database are connected with a DB link. I'm trying to update one table based on the data in the second table when the EMP_ID match

    Do you doctor_id?

    but the name does not match.

    The table will look like:
    Table name: EMP
    EMP_ID
    LAST_NAME
    FIRST NAME
    MIDDLE_INITIAL

    My SQL is:

    
    update EMP TARGET
    set (TARGET.LAST_NAME, TARGET.FIRST_NAME,TARGET.MIDDLE_INITIAL) = (
    select SOURCE.LAST_NAME, SOURCE.FIRST_NAME, SOURCE.MIDDLE_INITIAL
    from EMP@OTHER_DB SOURCE where
    TARGET.PHYSICIAN_ID = SOURCE.PHYSICIAN_ID
    and TARGET.LAST_NAME <> SOURCE.LAST_NAME); 
    

    This refers to a number of update of all lines not the bit I want.

    Any help would be great!

    There is no WHERE clause in the UPDATE statement, so that each row in the target table will be changed.
    If you only want to change the lines that have a match in the source table, then add a WHERE clause (perhaps "WHERE EXISTS (...)) with a subquery miuch very similar to the one you already have), or use the MERGER instead of UPDATE.

    If you want to know, post CREATE TABLE and INSERT statements to recreate the tables they existed before the UPDATE and also post the contents of the table changed after the UPDATE.
    Always tell what version of Oracle you are using.

    Maybe you want something like this:
    {code}
    MERGE INTO the emp target
    WITH THE HELP OF)
    SELECT o.emp_id
    o.last_name
    o.last_name
    o.middle_initial
    OF emp@other_db o
    JOIN emp t ON o.emp_id = t.emp_id
    AND o.last_name! = t.last_name
    ) source
    WE (target.emp_id = source.emp_id
    WHEN MATCHED THEN UPDATE
    SET target.last_name = source.last_name
    target.first_name = source.first_name,
    target.middle_initial = source.middle_initial,
    ;
    {code}
    assuming that emp is unique, at least in other_db.

    It will work in Oracle 10 (and more). In Oracle 9, MERGER still requires a WHEN MATCHED clause, so add one if you must. No matter what he does; the subquery USE will only return matches.

    Published by: Frank Kulash, October 10, 2011 16:45

  • OLAP cube - complex join condition

    Hi Experts,

    I requires a complex join between the dimension and cube.

    Requirement goes like this-

    We have a dimension to the date level-
    January 1, 2011
    January 2, 2011
    ...
    .. and so on.

    The fact table is not a matching surrogate key, but it has valid_from_date and valid_to_date that are stamps.

    I need to join these two to reach the condition readings - where dim.date between trunc (valid_from_date) and trunc (valid_to_date).

    Is it possible/feasible? Enjoyed your responses.

    Best regards, Marion

    You should be able to set a condition like this in the field "Join Condition" of the mapping pane cube in AWM. You would need to qualify table names to be something like this

    dim_table.date between trunc(fact_table.valid_from_date) and trunc(fact_table.valid_to_date).
    

    The only restriction to this approach is that you will not be able to partition on the time dimension for this cube due to the complexity of the condition.

    As an alternative, you can define a SQL view that joined your fact table in your time dimension table using the same condition. You map the cube on this point of view, in which case the restriction on partitioning goes.

  • Join condition of cube and other mapping missing mapping

    Hi David,

    I have a strange problem... After the creation of cube mapping tables defning and physical objects joins and the change of my mapping intermittently disappears... Not being able to trace what's happening. Is this a known bug or nothing is done correctly?

    Enjoy your previous answer.

    Thank you very much
    Paiva

    A "mapping" is a term of olap product management which means that the cube is not mapped to the level the fact sheet. For example, suppose you have tables like this

    CREATE TABLE SALES_FACT
    (
      DAY_OF_SALE DATE,
      PRODUCT_ID NUMBER,
      UNITS NUMBER,
      COST NUMBER
    )
    
    CREATE TABLE TIME
    (
      DAY DATE,
      MONTH NUMBER,
      QUARTER NUMBER,
      YEAR NUMBER
    )
    

    Suppose you want to analyze the data only at the level of the MONTH and more. In this case, you must set a time of hierarchy which includes levels MONTHS->->-> ALL_TIME YEAR QUARTER and you would need to define a join condition between SALES_FACT and TIME of the form

    SALES_FACT.DAY_OF_SALE = TIME.DAY
    

    This is sometimes called a "mapping" because it maps data in the AW to a higher level than what is stored in the fact (for example, the MONTHS instead of DAYS).

  • Update of table column in this table corresponds with another table

    UPDATE of table column where this table corresponds to a column with another table of columns,
    Example:

    I need to update column in the table SIEBEL_ASSETS MATACH_FLAG = 'Yes' when less than the conditions of the
    Select a.*, SIEBEL_ASSETS a, gis_cad, c
    where upper (a.Province) = upper (c.province)
    and upper (a.TOWNSHIP_NAME_EXT) = upper (c.suburb)
    and a.Stand_ # = c.ERF_NO
    update siebel_assets a
    set    match_flag = 'yes'
    where  exists (select 1
                   from   gis_cad c
                   where  upper(a.Province) = upper(c.province)
                   and    upper(a.TOWNSHIP_NAME_EXT) = upper(c.suburb)
                   and    a.Stand_# = c.ERF_NO
                  )
    ;
    
  • try to find the join condition

    Hello
    Does anyone know what table in the working repository stores the join interface conditions?



    Thanks in advance
    REDA

    Raj,

    You can reach SNP_TXT, SNP_POP_CLAUSE and SNP_POP for the join conditions.

    Select sp.pop_name, snp_pop sp, spc snp_pop_clause st snp_txt st.txt
    where SP. I_POP = SPC. I_POP
    and MS. POP_NAME = "YOUR_INTERFACE_NAME".
    and SPC. I_TXT_SQL = ST. I_TXT

    See if that helps you.

  • Update target tables...

    Hello

    I'm actually in a difficult situation. I need to update a table with a view. The table has 3 columns (* col1, col2, col3 *) initialized as NULLs in all records, noting that the other columns are given inside... So what I'm basically doing is this:

    I maps the columns to display in the table and click on the table to display the table operator properties, then set the type of loading for UPDATE. Then under a conditional loading in the filter of the target for the update , I have inserted the following condition:

    (INOUTGRP1.*col4 * IS NOT NULL) which shows a successful validation.

    Taking into account the constraints Match is chosen to be NO_CONSTRAINTS...

    After that I click on col1, col2 and col3 respectively to put the Match column when new line Yes...

    Unfortunately, these warnings will appear saying the following:

    + VLD-2753: all mapped attributes are used in corresponding to the criteria of 15_REC.

    It will be a meaningless update action if all attributes are mapped are used for matching. The update statement selects rows that meet the condition of correspondence and be updated with the same values. Specify at least one mapped attribute of my_table to use for updating by setting use update for Matching No.: ( COL1 COL2 COL3). +


    + VLD-2761: impossible to generate the Merge statement.

    MERGE statement cannot be generated because the COL4 column is used for correspondence and updating. A column can be updated in a merge statement. +



    So if anyone has any kind of idea help as soon as possible... Since it is in fact urgent...

    Thanks a lot already recognizing in reading.
    Hossam

    "Merge statement cannot be generated because the COL4 column is used for correspondence and updating. A column cannot be updated in a merge statement.

    You have to column 4, set the Match column when new line no. and update column Yes?

    Concerning
    Nico

  • Programatically update af:table when clicking on createInsert af:button

    Hi all

    I use JDeveloper 11.1.2.4.0.

    Requirement:

    I have an af:panelCollection, inside I have a (Add) af:button and an af:table. Af: button creates an empty line in a table as createInsert. Now when I click on the Add button, it creates the empty line in the af: table. But the blank row is not visible immediately. It is visible only when I do another action in this page, as on some other tab and back.

    From my observation, I found that the updating of the table does not occur immediately.

    I want to create a blank line like createInsert done and immediately refresh the table so that the empty line is visible in the table.

    I tried to adjust the partialTrigger of the tab; the reference to the id of the af: button, but still not working.

    I tried to update the table in a pragmatic way during the click on the button, but did not work.

    Can anyone suggest me solution for this.

    Thank you and best regards,

    Susanto

    Try to update af:panelCollection and see.

  • ORA-01445: cannot select ROWID, or sample, a view of join without key - preserved table form w/report and LOV

    I create a page "Form on a Table with Report" (APEX 5). Table I has 3 columns: cat_key, item_value, item_description. The cat_key is a foreign key in a table with columns cat_key, cat_value. I created the report and everything works fine.  The page of the report shows my domain cat_key in number, so I want it instead to display the cat_value. I change the field cat_key to a text based on LOV, select my LOV and now when I view the page of report I get the "'ORA-01445: cannot select ROWID from where sample, a join without key preserved table view ' error." The report uses the ROWID as a link to the edit page field.

    If I use the same tables and even shared LOV in a report page interactive, it works fine.

    What I am doing wrong?

    This is a limitation of the IR Apex will rewrite your query to a query that includes the lookup table and the columns. So now you have actually created a query on an inline view, which causes the error. You can see the query apex created when running in debug mode. APEX will join the table of choice with your primary table. For example from one of my IR:

    Select 'ID '...

    "MSL". "" HIS_COUNTRIES "=> my primary table

    ) ) b,

    (select rv_meaning d, rv_low_value r

    of msl_ref_codes_table

    where rv_domain = "JOHN".

    ) L1 = > query My LOV Lookup

    ...

    So, if possible, base your reports and forms on the real primary key, no rowid.

    You can also write the IR query with the search yourself:

    Select T1.rowid...

    of primary_table T1

    look_table L1

    ...

  • What API can be used to update the table cs_estimate_details (repair)

    I need to update the columns 'pricing_context' and 'pricing_attribute1' in the cs_estimate_details table.

    Which API can be used to update the columns. Where can I update the table directly?

    Try to use this "CS_Charge_Details_PVT" which in turn call "CS_ESTIMATE_DETAILS_PKG".

  • How do I update the table in Jdev

    Hello

    I use Jdev 11.1.1.7.1.

    The control of data, I added that ADF only read the table. When I click on the button create and return to the report screen, highlight lines are added.

    Highlighted those who is not inserted into the DB table but he showed in the report. How to remove it. How can I update the table?

    Kindly advice me.

    Thank you

    Swathi

    That's what I got:

    -You have a table read-only, and a link to create.

    -When you press the link create a popup will be launched with a new record (may be a form in the same table iterator).

    -When you press save to save the changes validation triggers, stop you to insert the record.

    -After the fire of validation you will close the pop-up window (by pressing icon or by pressing Cancel).

    -After closure of the pop-up window, you will find that reading one table has some blank lines.

    If it is your problem if you have 2 choices:

    1. in the AppModule you can make a new instance on the view object (to which redirect the table) If your view object called 'EmployeesView', so, in AppModule, you should have EmployeeView1 and EmployeeView2 and your table may point to EmployeeView1, and when you create new line create in EmployeeView2 and after completing the creation you can run the query and then refresh the table (as shown in the following code).

    2 - the second option in the popup cancelListener link at the rear bean method then you can update the table by program as:

        DCIteratorBinding iter = (DCIteratorBinding) BindingContext.getCurrent().getCurrentBindingsEntry().get("TableIteratorName"); // from pageDef.
        iter.getViewObject().executeQuery();
        RequestContext.getCurrentInstance().addPartialTarget(getTableComponent());// from table Binding property bind it to object in back bean
    
  • Update the Table of Adf

    Hi all

    I have a page jspx, with a table and a button.

    Create the table data control, and it contains 4 columns

    (Name, card student, asked (Question or answer)).

    I create the code for the button to work

    1. Select a record

    2 send email

    3. when I send the request goes from Q to A

    All work fine. The mail has been sent. The demand for DB password Q has. But in my jspx table refreshes.

    Until I close and open again, it displays all the data.

    How cal I solve it?

    Thanks in advance

    Christos.

    Simply add partialTrigger on table pointing to the button.

    It will update the table when the button is clicked.

Maybe you are looking for