Copy the result of a join to another table

Hi all

I want to copy the join of two tables in another table. I tried the following approach, but I have error

       insert into new_copy  values (ID,name,na_name)   
       SELECT
         name
        FROM
          country u
        INNER JOIN
          (
            SELECT
             na_name
            FROM
              country2 st
          )
          s
        ON
          u.id = s.ID;
  1. insert into new_copy (ID, name, na_name)
  2. SELECT i.id, u.name, s.na_name
  3. COUNTRY u
  4. INNER JOIN s countries2 ON u.id = s.id

must be done

Tags: Database

Similar Questions

  • Questions, try to copy the RGBA channels or grayscale in another RGBA file

    Older versions of photoshop allowed to copy the channels of a file to another easily, if I remember correctly, now I'll have questions. Copy of a channel of one RGBA file for another work, or a copy of a file to grayscale in a channel RGBA.

    Hi zakresh

    Please see: link double, split and merger of the channels in Photoshop .

    Let us know if that helps.

    Kind regards

    Mohit

  • Is there a way to copy the attributes of one composition to another?

    I use After Effects 7.0

    I would copy the same attributes of Zoom of a composition of 30 photographs.

    In Final Cut, you can copy the attributes of one element to another. Or from one photo to another.

    Is it possible to do in AE 7?

    Thanx

    Mike

    There are dozens of ways you can go here. You can duplicate the comp, then replace the images in the layout. You can create predefined animations. You can select all the animated properties and copy and paste in another layer. It depends on your workflow.

    I suggest that you look into the preset animations. I have over 200 of those custom in my system. They save a ton of time.

  • Add a simple table without one logical join to another table (OBIEE 10 g)

    Sometimes I want to just show a simple table without a logical join to another table in the repository. However, every time I move the layer Business model and mapping and an audit of overall coherence, he tells me that he has a logical join and I am forced to create another table to join her. Creating a dimension-fact relationship. There are times where I need this relationship and I want to just display some data. Is anyway to circumvent this?

    Thanks in advance!

    Yes, you must create a join. You can't take one table to MDB layer. You can create an alias for the table. Join this alias and the base through any common column table and take the two tables in MDB and table you want to the presentation layer.

    Another way is to create a view in the physical layer. Write a select statement as

    Select Table primary_key

    Where primary_key is the primary key of the base table. Join the base table of view ith and repeat the steps defined for the Alias.

    Kind regards
    Sandeep

  • How to copy the numbers in a cell to another cell and gets their total

    500.40

    192932.90

    231838 * 90

    290414 * 15

    222312 * 15

    222314 * 5

    141722 * 20

    Hello, can I ask how to copy the numbers after the period/asterisk to another cell and then add up all the numbers copied without having to type them.thank you

    Hi mirijin,

    Break the problem into small steps:

    Step 1. All separators (periods and asterisks) convert the asterisks.

    Formula in B2 (fill down)

    = SUBSTITUTE(A2,".","*")

    Step 2. Find the position of an asterisk in each cell.

    Formula in C2 (fill down)

    = FIND("*",B2)

    Step 3. Extract everything to the right of the asterisk.

    Formula in D2 (fill down)

    = RIGHT (B2, LEN (B2) −C2)

    Step 4. Convert the text to numbers re using the VALUE function.

    Formula in E2 (fill down)

    VALUE = (D2)

    This table has a header row and footer of the line, so the SUM in E9 apply to all cells in the body.

    = SUM (E)

    You can combine the individual forms in a unique and complex formula, or simply to hide intermediate columns B, C and D:

    Kind regards

    Ian.

  • copy the project from one farm to another template

    Hello
    can you get it someone please let me know how to copy a project template to an another operating unit operating unit.
    Concerning
    Hawker

    Oracle Standard does not allow to copy the model or project through the unit of operation.

    Concerning
    Govind

  • Copy the value of a cell in another tab.

    Hello

    First of all, I'm french. I hope you could understand my poor English.

    I have a got a form with a tab where you can sup or ad raws.

    I gat a second tab.

    I would like to copy the value of the cell (textfield) in a cell in the second tab.

    I try ' this.rawValue = evolution.forobj.tab1.r1.txt1.rawValue; ' event, but it does not change.

    Thanks for your help.

    Nath

    Hi Nath,

    This should work in case the object in tab2 calculate:

    this.rawValue = evolution.forobj.tab1.r1.txt1.rawValue;
    

    The language must be set to Javascript.

    There is another way to approach this problem without script. So, if you can not get this to work, come back.

    Niall

    Ensure the dynamics

  • How to copy the database using rman file from another location.

    You can clone data base using the files of rman backup from somewhere else (on the server to clone).

    I have two server db source and clone db server.
    I normally copy the files of RMAN backup to clone server (under the same folder structure, as it was on the source server).

    The purpose of the test, IE I don't have same partition and free space on the source server and the clone.

    I usually use under notes to the clone.
    http://trysellit.com/hosting/Ttrail/Fajr.php?doc=wtrail & ND = 0556200

    I would try to explain for example again.
    In source server, my rman backup are stored in / U01 and clone server, I copied the files of rman /u04. What step I should take to clone to work anywhere else?

    Using Oracle 10 g on Linux RedHat.

    sape007 wrote:
    Thanks Ken & PrafullaNath.

    BUT my question is: how to transport .dbf files in another place on the clone (I already do).

    Rather:
    The clone is on another server. How to restore by copying the RMAN files from another location on the clone. Please read description above in its entirety.

    Sorry for not being clear.

    Please see my video tutorial. In this tutorial that I take backup of the database, copy the backup to the different server and perform a recovery disaster

  • Is there a way to copy the capture from one photo to another time?

    I recently re-scanning of pictures that were original scanned a few years ago. Giving them the same name as the previous scanned (only with a _1 at the end), I import the newly scanned photo in the same folder (which is how to organize my photos), to be able to compare and then copy the metadata from the initial analysis to the latter. As I did not yet all signs or notation, most metadata will contain only keywords. But stored under "Metadata" in the view library, 'Capture time' is also stored, but I can't in any case among the options "copy of the metadata. Is there something that I missed, or is there a work-around somewhere?

    Thanks in advance-

    OLE K

    Hi Ole,

    You cannot copy, but edit:

    In the menu goto of the metadata module library - change the Capture time.

    If you have multiple images selected when you choose this command, you set the active image to what you enter as 'date and time specified' and others will be adjusted by the same increment. Decrement in your case, as I suppose.

    So if you want it to be exactly identical to that of the old scan, you must do it one by one for each new analysis.

    Cornelia

  • Copy the value from one point to another element

    Hi all

    I have a few items of data selector and a check point, now I want to copy the value of the element selector data for other transmissions of data selector by clicking on the chechbox, an example of javascript?


    Thank you

    Deep

    Deep,

    So the objective is to copy a single date field in several date fields? try this out...

    
    

    See you soon,.

    Janet Tyson

    Published by: Tyson Janet on April 20, 2009 14:05

  • Where clause with XMLExists and join to another table

    Hello

    We have table as:

    drop table xml_tbl;

    create table xml_tbl)
    whole xml_msg_id
    xmltype xml_msg_text
    );

    insert into xml_tbl values
    (1, "< principal > < id > 1 < /ID > < / hand > '");

    insert into xml_tbl values-(xml_msg_id, xml_msg_text)
    (1, "< principal > < id > 2 < /ID > < / hand > '");


    Another table like:

    create the table1 Table:
    (id1 int);

    Insert into Table1 values (2);
    Insert into Table1 values (3);

    We need to have a view on top of the table xml_tbl where/hand/IDs should only have the values located in id1 column of the Table1 table.

    Something like

    CREATE OR REPLACE VIEW V_xml_tbl
    (
    xml_msg_text
    )
    AS
    SELECT T.xml_msg_text
    OF xml_tbl T
    WHERE (XMLEXISTS)
    ' declare namespace Namesp1 = "Abc: Set";
    Let $Results as XS: Boolean: = fn:exists($p/main/id_in_(Select_id1_from_Table1))-now, here I know that I can't select id1 of

    Table 1
    return if ($Results) then true() (else)"
    PASSAGE T.xml_msg_text AS 'p');


    In fact, in the scenario real Table1 will have several IDs and xml_tbl a lot of XML files...
    So I'm stuck on how to do it. Help, please.

    Thank you...

    Published by: user8941550 on November 20, 2012 19:19

    One of these two:

    SQL> select t.xml_msg_text
      2  from xml_tbl t
      3  where exists (
      4    select null
      5    from table1 t1
      6    where t1.id1 = xmlcast(
      7                     xmlquery('/main/id' passing t.xml_msg_text returning content)
      8                     as integer
      9                   )
     10  );
    
    XML_MSG_TEXT
    --------------------------------------------------------------------------------
    
    2
    
    SQL> select t.xml_msg_text
      2  from xml_tbl t
      3     , xmltable('/main' passing t.xml_msg_text
      4         columns id integer path 'id'
      5       ) x
      6  where exists (
      7    select null
      8    from table1 t1
      9    where t1.id1 = x.id
     10  );
    
    XML_MSG_TEXT
    --------------------------------------------------------------------------------
    
    2

    And a third, using XMLExists:

    SQL> select t.xml_msg_text
      2  from xml_tbl t
      3  where xmlexists (
      4    'fn:collection("oradb:/DEV/TABLE1")/ROW[ID1=$d/main/id]'
      5    passing t.xml_msg_text as "d"
      6  );
    
    XML_MSG_TEXT
    ------------------------------------------------------------------------------------------------------------------------
    
    2
    Execution Plan ---------------------------------------------------------- Plan hash value: 3633580934 ------------------------------------------------------------------------------- | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | ------------------------------------------------------------------------------- | 0 | SELECT STATEMENT | | 2 | 116 | 8 (0)| 00:00:01 | |* 1 | FILTER | | | | | | | 2 | TABLE ACCESS FULL | XML_TBL | 2 | 116 | 3 (0)| 00:00:01 | | 3 | NESTED LOOPS | | 1 | 5 | 5 (0)| 00:00:01 | | 4 | TABLE ACCESS FULL| TABLE1 | 2 | 6 | 3 (0)| 00:00:01 | |* 5 | XPATH EVALUATION | | | | | | ------------------------------------------------------------------------------- Predicate Information (identified by operation id): --------------------------------------------------- 1 - filter( EXISTS (SELECT 0 FROM "DEV"."TABLE1" "SYS_ORAVW_2",XPATHTABLE('/main/id' PASSING :B1 COLUMNS "C_00$" XMLTYPE PATH '.', "C_01$" XQEXVAL CHAR PATH '.') "P" WHERE TO_BINARY_DOUBLE("ID1")=TO_BINARY_DOUBLE("P"."C_01$"))) 5 - filter(TO_BINARY_DOUBLE("ID1")=TO_BINARY_DOUBLE("P"."C_01$"))

    The plan is similar to that of the second query above (XMLTable/EXISTS).

    Still using XMLExists, a plan similar to the first query (EXISTS, XMLCast, XMLQuery) can be achieved by id of casting to an integer data type:

    SQL> select t.xml_msg_text
      2  from xml_tbl t
      3  where xmlexists (
      4    'fn:collection("oradb:/DEV/TABLE1")/ROW[ID1=xs:int($d/main/id)]'
      5    passing t.xml_msg_text as "d"
      6  );
    
    XML_MSG_TEXT
    ------------------------------------------------------------------------------------------------------------------------
    
    2
    Execution Plan ---------------------------------------------------------- Plan hash value: 1149640166 ------------------------------------------------------------------------------ | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time | ------------------------------------------------------------------------------ | 0 | SELECT STATEMENT | | 1 | 61 | 7 (15)| 00:00:01 | |* 1 | HASH JOIN SEMI | | 1 | 61 | 7 (15)| 00:00:01 | | 2 | TABLE ACCESS FULL| XML_TBL | 2 | 116 | 3 (0)| 00:00:01 | | 3 | TABLE ACCESS FULL| TABLE1 | 2 | 6 | 3 (0)| 00:00:01 | ------------------------------------------------------------------------------ Predicate Information (identified by operation id): --------------------------------------------------- 1 - access("ID1"=SYS_XQ_ATOMCNVCHK(TO_NUMBER(SYS_XQ_UPKXML2SQL(SYS_XQ EXVAL(SYS_XQEXTRACT(SYS_MAKEXML(0,"T"."SYS_NC00003$"),'/main/id'),1,50,3 3792,8192),50,1,0)),2,37)) Note ----- - Unoptimized XML construct detected (enable XMLOptimizationCheck for more information)

    Check each on your real-world scenario to see that present better performance.
    (I would say those involving streaming of assessment)

    Published by: odie_63 on 5 nov. 2012 12:24

    Published by: odie_63 on 5 nov. 2012 12:38

  • ORA-01417: a table can be external joined as another table

    Hi, I use Oracle 8i and could not use LEFT JOIN. So I need to use (+) instead.
    But I encounter ORA-01417 for = G.COL5 of I.COL3 (+)

    Complete the order as follows:
    SELECT *.
    B, A, C, D, J, K, L, E, F, G, H, I
    WHERE B.COL1 = 'ABC'
    AND B.COL1 = A.COL1 AND B.COL2 = A.COL2 AND B.COL3 = A.COL3
    AND C.COL1 = B.COL1 AND C.COL2 = B.COL6 AND C.COL3 = B.COL7
    AND B.COL1 = D.COL1 (+) AND D.COL2 (+) = B.COL6
    AND A.COL1 = J.COL1 (+) AND A.COL2 = J.COL2 (+)
    AND B.COL1 = K.COL1 (+) AND (+)-K.COL2 AND B.COL11 = B.COL6 = K.COL3 (+) AND B.COL12 = K.COL4 (+)
    AND A.COL1 = L.COL1 (+) AND L.COL2 (+) = A.COL2 AND A.COL3 = L.COL3 (+)
    AND E.COL1 = 'ABC' AND E.COL2 (+) (+) = C.COL20 AND E.COL3 (+) = C.COL21
    AND F.COL1 (+) = 'ABC' AND F.COL2 (+) = C.COL20
    AND G.COL1 = 'ABC' AND G.COL2 (+) (+) = B.COL11 AND G.COL3 (+) = B.COL12
    AND H.COL1 (+) = 'ABC' AND H.COL2 (+) = "PINCH" AND H.COL3 (+) = G.COL5
    AND I.COL1 (+) = 'ABC' AND I.COL2 (+) = "PINCH" AND I.COL3 (+) = G.COL5* AND = A.COL5 I.COL4 (+) AND I.COL5 (+) = "0001"

    Please notify.
    Thanks in advance.

    Hello

    981637 wrote:
    ... How to re-write the script according to your suggestion?

    Maybe something like:

    SELECT  *
    FROM      (     -- Begin in-line view abc
              SELECT     b.col4      AS b_col4
              ,     c.col4      AS c_col4
         --     ,     ...      -- Whatever columns you want to display in the main query
              FROM     a
              ,      b
              ,      c
              WHERE      b.col1          = a.col1
              AND     b.col2          = a.col2
              AND     b.col3          = a.col3
              AND     c.col1 (+)      = 'ABC'
              AND     c.col2 (+)      = a.col4
              AND     c.col3 (+)      = a.col5
         ) abc     -- End in-line view
    ,     d
    WHERE     d.col1 (+)     = 'ABC'
    AND     d.col2 (+)      = 'LOC'
    AND     d.col3 (+)      = abc.c_col4
    AND     d.col4 (+)      = abc.b_col4
    ;
    

    I can't say with certainty without examples of data (CREATE TABLE and INSERT statements) and the results desired from these data.

    In your real problem, the other tables can be joined to the a, b and c of the subquery (I assume it will be the most convenient way to do so), or they can be reached at abc in the main query.

  • [11g] ORA-22993 when extracted xmltype great values in the outbreak of the BIU as a CLOB in another table

    [I ask nicely for a few comments for this question.

    Someone else can reproduce it with the test below?

    Is my code invalid or false?

    Or what is the problem here?

    -Thank you

    Frank

    ]

    Hello

    Oracle Database 11 g Enterprise Edition Release 11.2.0.3.0 - 64 bit Production

    PL/SQL Release 11.2.0.3.0 - Production

    CORE Production 11.2.0.3.0

    AMT for Linux: Version 11.2.0.3.0 - Production

    NLSRTL Version 11.2.0.3.0 - Production

    Trigger Before Insert or Update to a table, I invoke a PL/SQL package function to check the size of an xmltype column (passing as IN OUT NOCOPY).

    PL/SQL functions retrieves the xmltype. GetClobVal(), check its size, and when it is beyond a limit, he tries to insert the data into another table (GTT - global temporary table).

    Finally, it changes the value of the value of the column of xmltype to the shorter XML (just by referring to the corresponding record in the TWG).

    But the Insert SQL in the TWG operation strike ORA-22993: specified input is greater than the amount actual source.

    I don't know why this happens. In the internet I only find references on importing files in lob/clob.

    Anyone have the same problem?

    I know that you prefer to have a sample program to demonstrate the problem - I'll try to post one, but it will take time.

    But maybe someone can help me based on the information above already.

    -Thanks a lot!

    Best regards

    Frank

    I have reproduced the issue.

    It must be a bug.

  • Table 2 join vs inline view join to another table

    Hi, I was wondering if it makes a difference of 2 tables to join directly vs join of a table to a view online. I ran a few tests of my own and looked like to explain plans. The costs appear to be identical between each method. But, I was wondering if there are situations where a method should be used on the other.

    Using Oracle version 11.2.0.2.0

    The tables are as follows.

    Table1 (varchar2 (20) col1, col2 number)
    Table2 (col1 number, col2, col3 number)

    insert into table1 values ('test1', 1).
    insert into table1 values ('test', 2)
    insert into table2 values (1, 2, 4)
    insert into table2 values (2, 2, 4)


    Here is an example that I use.

    Select a.col1, b.col3
    FROM table1, table2 b
    where a.col2 = b.col2
    and a.col1 = 'test '.

    Select a.col1, b.col3
    FROM table1, (select col2, col3 from table2) b
    where a.col2 = b.col2
    and a.col1 = 'test '.

    Published by: arizona9952 on December 29, 2012 12:49

    Hello

    arizona9952 wrote:
    Hi, I was wondering if it makes a difference of 2 tables to join directly vs join of a table to a view online. I ran a few tests of my own and looked like to explain plans. The costs appear to be identical between each method.

    About efficiency, it does not matter that you use. The online display will not necessarily be performed first. The optimizer chooses what it thinks is the best plan anyway.

    But, I was wondering if there are situations where a method should be used on the other. Here is an example that I use.

    Select a.col1, b.col3
    FROM table1, table2 b
    where a.col2 = b.col2
    and a.col1 = 'test '.

    Select a.col1, b.col3
    FROM table1, (select col2, col3 from table2) b
    where a.col2 = b.col2
    and a.col1 = 'test '.

    I can't imagine any situation where the choice between these two issues. But consder the query below:

    SELECT  a.col1
    ,      b.col3
    FROM     table1 a
    ,      (          -- Begin in-line view b
             SELECT  col2
             ,          col3
         --  ,         ROWNUM     AS r_n
             FROM    table2
             WHERE   col2_type     = 'NUMBER'
         ) b               -- End in-line view B
    WHERE     a.col2     = TO_NUMBER (b.col2)
    AND     a.col1      = 'test'
    ;
    

    Suppose table2.col2 is a VARCHAR2 and table2.col2_type correctly identifies if col2 can be converted to a NUMBER. The above query might get conversion errors, because the optimzer may decide to join first and evaluate the WHERE col2_type = 'NUMBER' later condition, how to make sure that doesn't happen is different depending on whether you use a subquery or not. If you use a sub0 query (such as display online above) you can add a reference to ROWNUM in the subquery, as displayed if commnet line.

  • The use of FORMS_DDL to upadate another table

    Hi all

    I want to update a record in a table by using the statement of forms_ddl against a button to a form that is based on another table. I used the following to do this but no updates or error free code
    occered-

    COMMIT_FORM;
    IF: CASE_STATUS. WRIT_OFF = 1 THEN
    FORMS_DDL ('UPDATE CASE_INFO SET WRIT_OFF = 1 WHERE CASE_NO =' |: CASE_STATUS.) CASE_NO);
    ON THE OTHER
    FORMS_DDL ('UPDATE CASE_INFO SET WRIT_OFF = 0 WHEN CASE_NO =' |: CASE_STATUS.) CASE_NO);
    END IF;
    COMMIT_FORM;


    What is wrong with my code. Please help me find the problem. I use form 10g.

    Arif
    COMMIT_FORM;
    IF :CASE_STATUS.WRIT_OFF=1 THEN
    UPDATE CASE_INFO SET WRIT_OFF=1 where CASE_NO= :CASE_STATUS.CASE_NO;
    ELSE
    UPDATE CASE_INFO SET WRIT_OFF=0 where CASE_NO=:CASE_STATUS.CASE_NO;
    END IF;
    COMMIT;
    

    Forms_ddl builtin is used to launch the ddl through forms. No need to use it for dml.

Maybe you are looking for