Insert columns to a table in another

How can we insert the columns in a table in another table, to every strange place this table in which inserts must be made? In short, the columns of a table into another table bt possibly between the table already detected.

Here's an example, feel free to ask the question if it is not clear to you.

It may be useful

Tags: NI Software

Similar Questions

  • Bulk Insert for more than 50 columns of one table to another.

    Hi all

    I have two Source and target tables that are the same in structure, and I need the Source Table Insert into the target Table.

    Source and the target Table is to have about 60 columns. And Volumn of data in the Source Table is about 1 Cr.

    Previously, someone wrote the Simple insertion as

    INSERT INTO TARGET_TBL (C1, C2, C3, C4... C60)

    (SELECT C1, C2, C3, C4... TARGET_TAB C60);

    And it will not work for this a large part of the data. Could you please suggest the best approach to do this.

    Thanks in advance.


    Hello..

    This will not work for that much of the data

    Tips for use as APPEND... See below link for direct loading

    Direct-load INSERT

    Try the below

    ALTER session enable parallel dml.

    INSERT / * + append parallel (6) * / INTO TARGET_TBL (C1, C2, C3, C4... C60)

    (SELECT C1, C2, C3, C4... TARGET_TAB C60);

  • Inserting data into one table to another table.

    Hi all

    I'm having a few problems when copying data from the 1 table to another table. I have a data 1 date in a table, and I want to insert data in a partition of the main table. As it is the dev database space by getting a problem. I don't have enough space that I can maintain the data for the same date in 2 places.

    Here every way possible in oracle this 1 table may be made partition in the other table. (Just a question).

    Please suggest me a way out and if possible should be fast that data are more than 50 million lines and size along 10 GB.

    Thank you

    Are the columns of your source table identical to that of the destination partitioned table?

    If so, you can create an empty partition in the partitioned table and then create a swap partition to swap the source with the new empty partition table.

  • Need to update a column in a table to another table

    I followed two tables
    () PP_TAX
    BAN NUMBER (9),
    FEATURE_CODE TANK (6 BYTES),
    FTR_REVENUE_CODE TANK (3 BYTES),
    TAX_CALC_METHOD CHAR (1)
    )
    () CHARGE_INFO
    FEATURE_CODE TANK (6 BYTES),
    FTR_REVENUE_CODE TANK (3 BYTES),
    TAX_CALC_METHOD CHAR (1)
    )

    First PP_TAX table is a temporary table. I inserted the values of the 3 columns (BAN, feature_code and FTR_REVENUE_CODE). And now I want to update this table TAX_CALC_METHOD column by using the CHARGE_INFO table.
    I need to compare feature_code & FTR_REVENUE_CODE of the columns of the tables, and update the values in the PP_TAX table.
    Kindly help
    Paragraphs

    Welcome to the forum.

    Are you like?

    CREATE TABLE PP_TAX (
    BAN NUMBER(9),
    FEATURE_CODE CHAR(6 BYTE),
    FTR_REVENUE_CODE CHAR(3 BYTE),
    TAX_CALC_METHOD CHAR(1)
    );
    CREATE TABLE CHARGE_INFO(
    FEATURE_CODE CHAR(6 BYTE),
    FTR_REVENUE_CODE CHAR(3 BYTE),
    TAX_CALC_METHOD CHAR(1));
    
    INSERT INTO  PP_TAX(BAN, FEATURE_CODE, FTR_REVENUE_CODE)
    VALUES (1,'AAAAAA','BBB');
    
    INSERT INTO  CHARGE_INFO(FEATURE_CODE, FTR_REVENUE_CODE,TAX_CALC_METHOD )
    VALUES ('AAAAAA','BBB','U');
    
    COMMIT;
    
    UPDATE PP_TAX P SET P.TAX_CALC_METHOD = (SELECT TAX_CALC_METHOD FROM CHARGE_INFO CC
                                              WHERE CC.FEATURE_CODE=P.FEATURE_CODE
                                                AND P.FTR_REVENUE_CODE=CC.FTR_REVENUE_CODE)
    
    COMMIT; 
    
    select *  from  PP_TAX;
                               
    
  • Insert records from one table to another table

    Hello

    I want to insert all records in table 1 which are not in table 2 in table2

    o/p
    Insert into table2
    Select * from table1
    where a.id! = b.id;

    Please let me know is there any way I can complete reviews
    insert
      into table2
      select  *
        from  table1
        where id not in (
                         select  id
                           from  table2
                        );
    

    SY.

  • Correspondence of the columns from one table to another

    I have a database column that contains the name of a person. I have another table that has a column that contains the names separated by a comma.

    I want to match records where all records of two columns have a corresponding name. I tried this:

    < cfquery name = "MyQuery" datasource = "myds" >

    SELECT *.

    OF TBL_A

    WHERE TBL_A.customername IN (#DifferentQuery.ListOfNames #)

    < / cfquery >

    Everything that I try results in only get a recording. Basically, I want to get all records from a table where one of its columns contains the name of a column in another table.

    It's a many-to-many relationship. That is to say an editorial can be linked to many ads, and vice versa.  He is best represented with three tables. Such as:

    Table: [Editorial] column: [EditorialID (PK), EditorialText,...]

    Table: Columns of the [advertiser]: [AdvertiserID (PK), AdvertiserName]

    Table:   [Editorial_Advertisers] columns: [EditorialID, AdvertiserID]

    The name of the advertiser throw himself into a column...

    my client can decide which ads get related to which editorials

    The third table stores the relationship between ads and editorials.  So instead of storing a list of advertisers, you need to insert record for each EditorialID + AdvertiserID combination. You can then use joins to retrieve all the advertisements for EditorialID 123.

    SELECT  a.AdvertiserName
    FROM     Editorial_Advertiser ea INNER JOIN Advertiser a ON ea.AdvertiserID = a.AdvertiserID
    WHERE   ea.EditorialID = 123
    
  • How to use the slider in the insertion of data in table to another

    Hi all

    I am beginner in oracle and I have a question to deal with my table

    I have 2 table lets say (c1) and (c2).

    C1 contains the following columns (product_number, product_name, description)

    C2 contains the following columns (product_code, product_id, description)

    I need to build anonymous blocks including cursor, this extraction of cursor data c2 to insert in c1 in the following way:

    product_code = product_number,

    product_id = product_name,

    description = description

    a help can you please...?

    Thanks for all,

    Best regards.

    Sorry to say that this is not "talking nonsense." the statement below, you wrote, updated the TABLE whenever a row is inserted:

    Update products

    Set service_code = 'VOIP', Charge_type = 'FIXED', PRODUCT_TYPE = 'SERVICE', super_product = 'n',

    available = 'Y', default_bill_method = 'TIPS', default_prorate = 'Y', gl_code = '00000',.

    service_type = "COMPLEMENTARY", partner_code is "oman", used_service_code = "VOIP."

    I can't believe that's what you intend to update an entire table every time that a row is inserted.

    The second problem I see is that you try to use v_x and you aren't anything to assign to this variable.  Whence 'rownum '?  ROWNUM is generated when choosing and assigned to the rows in a result set.  Looking at a rewrite of your code that actually works now:

    SQL > declare
    2
    3 v_sku TMP_TABLE. Type % SKU;
    v_DESCRIPTION 4 tmp_table. DESCRIPTION of % type;
    5 v_MSRP TMP_TABLE. Type of MSRP %;
    6 v_BILLING_FREQUENCY TMP_TABLE. Type of BILLING_FREQUENCY %;
    7 v_ALLOW_PRICE_CHANGE TMP_TABLE. Type of ALLOW_PRICE_CHANGE %;
    8 v_status TMP_TABLE. % OF STATUS TYPE.
    v_x 9 varchar2 (20);
    10
    11 tmp_product of CURSOR IS
    12. SELECT "p" | status of prod_id, SKU, LTrim (to_char(rowNum,'0999999')), ALLOW_PRICE_CHANGE, BILLING_FREQUENCY, advised, DESCRIPTION retail price
    13 FROM tmp_table
    14 where sku is not null;
    15
    BEGIN 16
    17
    18 open tmp_product;
    19
    loop 20
    21
    22 extract tmp_product in v_x, v_SKU, v_status, v_DESCRIPTION, v_MSRP, v_BILLING_FREQUENCY, v_ALLOW_PRICE_CHANGE;
    23 when the output tmp_product % notfound;
    24
    25 INSERT INTO PRODUCTS (product_code, product_name, description, available, DEFAULT_BILL_FREQ, APPLY_SPECIAL_RATES)
    26 values (v_x, v_SKU, v_DESCRIPTION, v_status, v_BILLING_FREQUENCY, v_ALLOW_PRICE_CHANGE);
    27
    28 END LOOP;
    29 close tmp_product;
    30
    31 products update
    32 set service_code = 'VOIP', Charge_type = 'FIXED', PRODUCT_TYPE = 'SERVICE', super_product = 'n',
    33 available = 'Y', default_bill_method = 'TIPS', default_prorate = 'Y', gl_code = '00000',.
    34 service_type = 'SUPPLEMENTARY', partner_code = 'oman', used_service_code is "VOIP."
    35
    36 commit;
    END 37;
    38.

    PL/SQL procedure successfully completed.

    SQL >
    SQL > select *.
    2 from products
    3 where rownum<>

    PRODUCT_CODE PRODUCT_NAME DESCRIPTION AVAILABLE SERVER PRODUCT_TYPE CHARGE_T DEFAULT_BILL S DEFAULT_BILL D GL_CO PARTNER_ USED_SER APP SERVICE_TYPE
    -------------------- ---------------------------------------- -------------------------------------------------------------------------------- ------------ ------------ -------- -------- ------------ - ------------ - ----- -------------------- -------- -------- ---
    p0000095 Plerkle213 Plerkle Best Ever!                                                               Y QUARTERLY VOIP FIXED SERVICE N TIPS Y 00000 ADDITIONAL oman VOIP YES
    p0000096 Plerkle214 Plerkle Best Ever!                                                               Y QUARTERLY VOIP FIXED SERVICE N TIPS Y 00000 ADDITIONAL oman VOIP YES
    p0000097 Plerkle215 Plerkle Best Ever!                                                               Y QUARTERLY VOIP FIXED SERVICE N TIPS Y 00000 ADDITIONAL oman VOIP YES
    p0000098 Plerkle216 Plerkle Best Ever!                                                               Y QUARTERLY VOIP FIXED SERVICE N TIPS Y 00000 ADDITIONAL oman VOIP YES
    p0000099 Plerkle217 Plerkle Best Ever!                                                               Y QUARTERLY VOIP FIXED SERVICE N TIPS Y 00000 ADDITIONAL oman VOIP YES
    p0000100 Plerkle218 Plerkle Best Ever!                                                               Y QUARTERLY VOIP FIXED SERVICE N TIPS Y 00000 ADDITIONAL oman VOIP YES
    p0000101 Plerkle219 Plerkle Best Ever!                                                               Y QUARTERLY VOIP FIXED SERVICE N TIPS Y 00000 ADDITIONAL oman VOIP YES
    p0000102 Plerkle220 Plerkle Best Ever!                                                               Y QUARTERLY VOIP FIXED SERVICE N TIPS Y 00000 ADDITIONAL oman VOIP YES
    p0000103 Plerkle221 Plerkle Best Ever!                                                               Y QUARTERLY VOIP FIXED SERVICE N TIPS Y 00000 ADDITIONAL oman VOIP YES
    p0000104 Plerkle222 Plerkle Best Ever!                                                               Y QUARTERLY VOIP FIXED SERVICE N TIPS Y 00000 ADDITIONAL oman VOIP YES

    10 selected lines.

    The update has been moved out of the loop, the useless '<>null' condition has been changed to "is not null" and v_x is generated by the cursor query itself.

    David Fitzjarrell

  • inserting data into a table from another table

    Hello

    I have a to insert a data in the other table.

    My requirement is I field Date_effect_date in the departments, I would copy the details field in dept_effect_date of employees.

    I used the query

    Insert in the dept_effect_date of certain employees (dept_effect_date) departments;

    and the result is:

    SQL error: ORA-01400: cannot insert NULL into ('HR'. "'"' EMPLOYEES'."" EMPLOYEE_ID')

    01400 00000 - "impossible to insert a NULL value in (%s)."

    MY DB: oracle 10g XE

    Sainaba

    You can do this by UPDATE not INSERT.

    Sudheeryekkala wrote:

    Hello

    I have a to insert a data in the other table.

    My requirement is I field Date_effect_date in the departments, I would copy the details field in dept_effect_date of employees.

    I used the query

    Insert in the dept_effect_date of certain employees (dept_effect_date) departments;

    and the result is:

    SQL error: ORA-01400: cannot insert NULL into ('HR'. "'"' EMPLOYEES'."" EMPLOYEE_ID')

    01400 00000 - "impossible to insert a NULL value in (%s)."

    MY DB: oracle 10g XE

    Sainaba

    INSERT the results of will by adding new lines to the table so you have the above error. In your case, you must update the value of the existing column

    (or, if the volume is large, then fill the data -

    join the table two in a new table CREATE TABLE EMP_NEW AS SELECT * FROM EMPLOYEES, DEPARTMENTS .

    fall of ;

    Rename emp_new to ;

    * constraints/indexes if necessary be supported...

    )

    E employees update

    Set e.dept_effect_date = (select d.dept_effect_date

    departments d

    where e.dept_id = d.dept_id);

    Concerning

    Biju

  • Inserting data from one table to another table

    Hello

    I have the following SQL where I am updating a table by adding new data from another table, but without success.

    INSERT INTO
    () TOP_PROSPECTS
    COMMON_ID
    DATE_ADDED
    REVIEW_RANK
    EVAL_DATE
    PM_ASSIGN
    WHY_NOTES)
    SELECT
    t.COMMON_ID
    t.DATE_ADDED
    t.REVIEW_RANK
    t.EVAL_DATE
    t.PM_ASSIGN
    t.WHY_NOTES
    Of
    TEMP_IVAN_MARY t
    WHERE
    COMMON_ID <>t.COMMON_ID

    Any suggestions?

    Thank you.

    Published by: user13822709 on August 14, 2012 09:14

    Published by: user13822709 on August 14, 2012 09:15

    Is that what you're trying to do with the insert. I think there may be a sign {noformat}<{noformat}{noformat}>{noformat} missing in the where clause. This site eat those, so you need to use the equivalent! = post here.

    If I'm wrong about the missing trader, then it looks like you want to insert rows in temp_ivan_mary that are not already in top_prospects. If Yes, then you need something like:

    insert into top_prospects
       (common_id, date_added, review_rank, eval_date, pm_assign,
        why_notes)
    select t.common_id, t.date_added, t.review_rank, t.eval_date,
           t.pm_assign, t.why_notes
    from temp_ivan_mary t
    where t.common_id not in (select common_id from top_prospects
                              where common_id is not null)
    

    Function index and data available volumnes etc. then a mergr can be more effective. Something like:

    merge into top_prospects p
       using (select common_id, date_added, review_rank, eval_date,
                     pm_assign, why_notes
              from temp_ivan_mary) t
       on (p.common_id = t.common_id)
       when not matched then
          insert (common_id, date_added, review_rank, eval_date, pm_assign,
                  why_notes)
          values (t.common_id, t.date_added, t.review_rank, t.eval_date,
                  t.pm_assign, t.why_notes)
    from temp_ivan_mary t
    

    John

  • How to copy columns from one table to another

    Hai All


    How to copy the contents of the array to another

    For example, first name of the table is T1 and I have 10 columns and data are here and I need to create a table T2

    But I don't need the header, but not the values of all the 10 columns of T1 to T2, but not values


    Thanks and greetings

    Srikkanth.M

    Why not?

    create table test1
    as
       select * from emp
       where 1 = 2;
    

    Kind regards.

    LOULOU.

  • Insert data from one table to another

    I have two tables SALES_MASTER and SALESMAN_MASTER which is described below.

    SQL > desc SALES_MASTER;
    Name Null? Type
    ----------------------------------------- -------- ----------------------------
    NO VARCHAR2 (6)
    NAME VARCHAR2 (20)
    PIN NUMBER (8)
    CITY VARCHAR2 (20)
    VARCHAR2 (20) STATE



    SQL > desc SALESMAN_MASTER;
    Name Null? Type
    ----------------------------------------- -------- -----------------------
    SALESMANNO VARCHAR2 (6)
    SALESMANNAME VARCHAR2 (20)
    ADDRESS1 VARCHAR2 (30)
    ADDRESS2 VARCHAR2 (30)
    CITY VARCHAR2 (20)
    PIN NUMBER (8)
    VARCHAR2 (20) STATE
    SALAMT NUMBER (8.2)
    TGTTOGET NUMBER (6.2)
    YTDSALES NUMBER (6.2)
    REMARKS VARCHAR2 (60)

    I want to insert data from SALESMAN_MASTER (2nnd table) to SALES_MASTER(first table). I want to insert only two columns NO, NAME and PIN code. All of these columns are compatible. I tried this command. But it's not working. Help me.

    SQL > insert into SALES_MASTER
    2 (NO., NAME, PIN CODE)
    3 values
    4. Select SALESMANNO, SALESMANNAME, PIN code
    5 SALESMAN_MASTER;
    Select SALESMANNO, SALESMANNAME, PIN code
    *
    ERROR on line 4:
    ORA-00936: lack of expression
    INSERT INTO SALES_MASTER
       ( NO
       , Name
       , PINCODE )
       SELECT SALESMANNO
            , SALESMANNAME
            , PINCODE
         FROM SALESMAN_MASTER;
    

    Kind regards
    Christian Balz

  • Insert values into a table from another table without duplicates

    Hello

    I have a table with a field called ID; This field has duplicate values of ID.

    Then I have an empty table B (with the same fields of the table A) and I want to insert the values of the ID (on the table) without duplicates.

    Can you help me?


    Thank you much in advance.

    Hello

    If your table has duplicate values, then you cannot add a UNIQUE constraint. In this case, you will need to use a roundabout way or remove duplicates before imposing the constraint. Hope it answers your question.

    see you soon

    VT

  • transfer of some columns from one table to another table...?

    I had 2 table... .one is PAYMAST n other TBL... In PEXMAST & TBL 10 collar each, I had and I want to transfer 4 columns of TBL to PEXMAST...

    How do I do this. ???

    A table must be regarded as line and column.

    When you say a column, it should be associated with a line.

    Here is an example

    Let's say I have two table T1 (ID, NAME) and T2 (ID, Name1)

    Now if I say I want to spend for T2 T1 name1, what I will do?

    1 create a column name1 in T1.

    alter table t1 add name1 varchar2(50)
    

    2. put up-to-date T1 by joining T1.ID and T2.ID like that.

    update t1
       set t1.name1 = (select t2.name1 from t2 where t2.id = t1.id)
    

    As you can see you need a column ID to define the relationships between the two table T1 and T2. If you have one, you can do the same with yours.

  • need help to trigger to update the change of columns of a table

    Hi all
    I need help in the manufacture of change update trigger in the columns from one table to another table.
    For example, table (col1 col 2 col 3 col 4 col 5 samplea
    .. .Col 20

    Now if I do any change in one of the data column must be changed to
    sample_copya... table that contains duplicate column

    So for this I thought to create a trigger with the following logic



    If updating (col1) then
    Update sample_copya set col1: =: new.col1 where n ° 1 =: new.no1;
    Otherwise, if the update (col2) then
    Update sample_copya set col2: =: new.col2 where n ° 1 =: new.no1;
    Otherwise, if the update (col3) then
    Update sample_copya set col3: =: new.col3 where n ° 1 =: new.no1;

    end if;
    But how doi handle if all columns are changed or say 2 columns record the number of columns is more than 20...
    I would like to know if there is a simpler method to achieve...
    Thank you

    susf wrote:
    Hi all
    I need help in the manufacture of change update trigger in the columns from one table to another table.
    For example, table (col1 col 2 col 3 col 4 col 5 samplea
    .. .Col 20

    Now if I do any change in one of the data column must be changed to
    sample_copya... table that contains duplicate column

    So for this I thought to create a trigger with the following logic

    If updating (col1) then
    Update sample_copya set col1: =: new.col1 where n ° 1 =: new.no1;
    Otherwise, if the update (col2) then
    Update sample_copya set col2: =: new.col2 where n ° 1 =: new.no1;
    Otherwise, if the update (col3) then
    Update sample_copya set col3: =: new.col3 where n ° 1 =: new.no1;

    end if;
    But how doi handle if all columns are changed or say 2 columns record the number of columns is more than 20...
    I would like to know if there is a simpler method to achieve...
    Thank you

    What is the purpose of this trigger?
    How can you be sure that ' where n ° 1 =: new.no1 "is true?
    How does line in the SAMPLE_COPYA table at the start?
    only the last modified value will lie in SAMPLE_COPYA than the previous values is written more

  • Insert data into the table without using the insert or select the command

    Hello

    Is there anyway to insert data from one table to another table, without using insert, and then select the command in the same pattern.
    Note: the two tables have the same structure.

    ALTER table... Swap partition...

Maybe you are looking for