Insert data from 3 tables of diff with some transpose logic

Hi all

I need to create a MS which will have three settings:

Mast_report_id number, posted_on_date date, number of redord_id

I have four tables which one is the destination and reset three source tables:

The source tables:

1 - mast_report

create the table MAST_REPORT

(

MAST_REPORT_ID Number (38) not null,

ANNUAL NUMBER (38),

TITLE VARCHAR2 (500),

STATUS VARCHAR2 (10),

DATE OF POSTED_ON,

NO_OF_PAGES NUMBER (8).

BILLABLE_PAGES NUMBER (8).

MAST_LANGUAGE VARCHAR2 (20).

CONTRIBUTOR VARCHAR2 (80).

CRAWL_DATE TIMESTAMP (6) default sysdate,.

FILE_NAME VARCHAR2 (30),

PAGE_PRICE NUMBER (10,2).

DOC_PRICE NUMBER (10,2).

CONTRIBUTOR_ID NUMBER (20)

);

2 - report_details:

create the table REPORT_DETAILS

(

RECORD_ID Number (38) not null,

DOC_ID Number not null, (38)

ATTRIBUTE_TYPE VARCHAR2 (10),

ATTRIBUTE_VALUE VARCHAR2 (200),

REPORT_TYPE VARCHAR2 (100),

ATTRIBUTE_ID VARCHAR2 (80)

);

3 - filters_for_docid:

create the table FILTERS_FOR_DOCID

(

FILTER_ID Number not null, (38)

CONTRIBUTOR VARCHAR2 (100),

AUTHOR VARCHAR2 (100) default not null, "No. FILTERS".

COUNTRY VARCHAR2 (100) default not null, "No. FILTERS".

VARCHAR2 (100) region "No. FILTERS" not null default,

COMPANY VARCHAR2 (100) default not null, "No. FILTERS".

INDUSTRY VARCHAR2 (100) default not null, "No. FILTERS".

VARCHAR2 (100) of the default OBJECT not null, "No. FILTERS".

CREATED_DATE TIMESTAMP (6) SYSTIMESTAMP not null default,

REPORT_TYPE VARCHAR2 (100) default not null, "No. FILTERS".

NOM_FLUX VARCHAR2 (200),

CHANNEL_ID NUMBER (8).

NUMBER OF CU_ID

);

Destination table: filtered_document

database version:

BANNER
1Oracle Database 11 g Release 11.2.0.1.0 - 64 bit Production
2PL/SQL Release 11.2.0.1.0 - Production
3CORE11.2.0.1.0Production
4AMT for Linux: Version 11.2.0.1.0 - Production
5NLSRTL Version 11.2.0.1.0 - Production

As I menteioned above the user will pass three parameters: Mast_report_id, posted_on_date, redord_id

Here, I need to take more condition (>) to the three parameters.

For the extraction of data, the logic is below:

Mast_report table has two columns mast_report_id and posted_on, we need to take a larger than the condition as:

"Select * from mast_report where and mast_report_id > 7326280 and posted_on > 25 may 2015;

It will show many recordings roughly 10,000 with all the columns including annual column, this annual column is card with doc report_details of the table

Now report_details table, we need recover data with annual report_details = (all the table of mast_report annual that we extract our first query) and record_id > settings of this sp record id.

lets assume he'll again get 10000 files with all the columns.

Now the main logic is to extract the data of using our highest performance and the third table FILTERS_FOR_DOCID.

Assume that this is the result of our query above:

RECORD_IDANNUALATTRIBUTE_TYPEATTRIBUTE_VALUEREPORT_TYPEATTRIBUTE_ID
17057411269222703COMPANYTGS NOPEC GEOPHYSICAL COMPANY ASASOCIETY REPORT100203621
27112370469222704COMPANYVOLVO ABSOCIETY REPORT100062389
37096287469222713COMPANYPARTNERRE LTD.SOCIETY REPORT100037448
47056915069222713COMPANYPARTNERRE LTD.SOCIETY REPORT100037448
57056788869222729COMPANYVITAMIN SHOPPE INC.SOCIETY REPORT108008193
67038574869222749COMPANYABB LTD.SOCIETY REPORT100096991
77096286569222756COMPANYMETTLER-TOLEDO INTERNATIONAL INC.SOCIETY REPORT100081108
87056897869222756COMPANYMETTLER-TOLEDO INTERNATIONAL INC.SOCIETY REPORT100081108
97038576169222777COMPANYSUNCOR ENERGY INC.SOCIETY REPORT100063497
107056938969222784COMPANYSYMANTEC CORP.SOCIETY REPORT100043382
117112676469222786COMPANYARROW ELECTRONICS INC.SOCIETY REPORT100084937

here if using separate attribute_type of report_details, we have:

Select distinct report_details attribute_type;

ATTRIBUTE_TYPE
1Object
2INDUSTRY
3COUNTRY
4REGION
5AUTHOR
6COMPANY

Here you can see over the structure of the third table table FILTERS_FOR_DOCID where above these distinct values of the second table are the columns of the third:

And you can see the output of the query above to report_details table, including the attribute_type and attribute_type value.

Here, we need to find in the third table with each attribute_type and values of his attribute_type_value with the topic of the third table columns, industry,... He values.

as: consider attribute_type values 'COMPANY' and its "TGS NOPEC GEOPHYSICAL COMPANY ASA" attribute_value now we need to find

in SOCIETY the third table cloumn with value "TGS NOPEC GEOPHYSICAL COMPANY ASA"... same for others...

I must now go look for these lines of the third table which all combinations get matched, need us compare with like operator between the attribute_type column value and the value of the columns in the third diff table.


Thanks in advance

I have impleted above the requirement using pivot, CTE, and cases in where clause.

Thanks for all the help

Tags: Database

Similar Questions

  • How can I insert data from another table into a table containing a timestamp column

    How you insert data from another table in a table if the target table contains a timestamp column. I tried to set the default value of GETDATE() column in the target table, but it does not work.


    I use MS SQL

    Sorry, I managed to get around this by inserting null as the value

  • 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

  • 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 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...

  • How to export data from the table with the colouring of cells according to value.

    Hi all

    I use jdeveloper 11.1.1.6

    I want to export data from the table with a lot of formatting. as for color cells based on value and so much. How to do this?

    You can find us apache POI-http://poi.apache.org/

    See this http://www.techartifact.com/blogs/2013/08/generate-excel-file-in-oracle-adf-using-apache-poi.html

  • data from 3 tables with later dates

    Hello
    Need help with the PL/SQL code, I need to write a code that will get the data from 3 tables with the most recent date.

    For an individual ACT_CODE the output of the SQL query should display the data including the last dates back to 3 tables, if there is no
    Date of the table, it should show the remaining data (think that the left join will do here)

    Names of tables:
    Institution_UPDT aiu
    AC ASQ_CONTACT
    GR_AUTHORIZE gr

    All 3 tables have ACT_Code in common

    Column names

    INSTITUTION_UPDT IAU - IAU. ACT_CODE, AIU.project_id as proj, IAU. UPDT_TYPE_ID, IAU. User_id, IAU. UPDT_DATE

    ASQ_CONTACT ac - ac. ACT_CODE as contact_code, ac.project_id, ac.first_name, ac.middle_initial, ac.last_
    Name, AC.title, AC. Status, AC.status_date

    GR_AUTHORIZE gr - GR ACT_CODE as grad_code, gr.name, gr.title AS grad_title, gr.submit_date


    Are the names of the columns date
    AC.status_date,
    IAU. UPDT_DATE and
    Gr.submit_date

    Thanks to you all
    appreciate your help

    Jesh

    Hi, Ngoumba,

    If a given ACT_Code couldn't miss from any of the tables, then you will use better full outer joins, not a join left outer.

    Perhaps it would be more effective to make a UNION of the three tables, then rotate the results in three datecolumns.

    You can use the GROUP BY aggregation to get the last date for each ACT_Code in each table.
    If you need other columns in the row which is the last date, you can use the ROW_NUMBER analytic function, like this:

    SELECT  ACT_Code
    ,     updt_date
    ,     ROW_NUMBER () OVER ( PARTITION BY  ACT_Code
                              ORDER BY          updt_date     DESC
                      ) AS r_num
    FROM    institution_updt
    

    The lines with r_num = 1 are the most recent

    This is a technique of ot the UNION-PIVOT example:

    WITH     union_data     AS
    (
         SELECT    ACT_Code
         ,       MAX (updt_date)     AS last_date
         ,       1                  AS table_id
         FROM       institution_updt
         GROUP BY  ACT_Code
    UNION ALL
         SELECT    ACT_Code
         ,       MAX (status_date)     AS last_date
         ,       2                  AS table_id
         FROM       ASQ_Contact
         GROUP BY  ACT_Code
    UNION ALL
         SELECT    ACT_Code
         ,       MAX (submit_date)     AS last_date
         ,       3                  AS table_id
         FROM       GR_Authorize
         GROUP BY  ACT_Code
    )
    SELECT       ACT_Code
    ,       MAX (CASE WHEN table_id = 1 THEN last_date END)     AS aiu_updt_date
    ,       MAX (CASE WHEN table_id = 2 THEN last_date END)     AS ac_status_date
    ,       MAX (CASE WHEN table_id = 3 THEN last_date END)     AS gr_submit_date
    FROM       union_data
    GROUP BY  ACT_Code
    ORDER BY  ACT_Code
    ;
    

    Published by: Frank Kulash, on September 16, 2009 15:02
    Added UNION-pivot example

  • How to insert the data from the table file?

    I need to know that how can I insert data into multiple columns by file. I can simply insert data into a table of columns, but could not find a way to put the data in the column all.

    My data in a file store
    ************************************************text.txt***************
    133, nanny, nagina, 14 mph, 45637, 9156729863

    **************************************************************my_data(table)**********
    try to insert into table below...

    Name, ID, last_name, add, PIN. Mob

    *********************************************

    Let me know if you need anything else... :))

    Hey nanny.

    In fact, in SQL Developer, you can open a connection to the target schema, right-click on the Tables node in the Navigator tree, select import the data, then use the data import wizard. It is extremely flexible. Looks like you have a file of comma-separated variables, so if you select Format: csv and import method: Insert it will probably work fine.

    To minimize the risk of errors during import, choose a limit value of preview so that the wizard can review the data type and the size of all columns in several lines of data as possible, and then examine the size/type of data for each column on the next page of the wizard and replace if necessary. For date columns, it is also important to choose the appropriate format mask.

    Hope this helps,
    Gary
    SQL development team

  • a simple way to insert data in a table

    Hello

    I need to know in a simple way on how to transfer data from one table to the other...

    First xx_inv_tab1 table has three columns col1, col2, col3 and where as the second xx_inv_tab2 table has five columns col1, col2, col3, col4 col5.

    Here col2, col3, col4 are the same columns in table1 xx_inv_tab1...

    Now I want to transfer the first data in table in second table... first column of the second table holds a sequence, followed by the first three columns of table data and followed with col4 col5 which will contain NULL values...

    In my scenario, I have 70-75 columns in my first table that I want to move to the second table including three new columns (one is the sequence with two other null values)...

    All ideas, if do us it in a simpler way, saying rather insert into xx_inv_tab2 (col1, col2, col3, col75) values (seq, col1, col2,... col75, null, null)


    Help appreciated...

    Thank you

    Easy

    not tested

    insert into xx_inv_tab2 t2 (col1,col2,col3,col4)
    select yourSequence.nextval, t1.col1, t1.col2, t1.col3
    from xx_inv_tab1 t1
    ;
    

    Note that col5 must not be used, since you want to fill with a NULL value.

    Use excel or sql developer write you a list of the column names, if you are lazy to write all the columns of 75 by yourself.

    Which might also work:

    not tested

    insert into xx_inv_tab2 t2
    select yourSequence.nextval, t1.*, null
    from xx_inv_tab1 t1
    ;
    

    Published by: Sven w. on August 31, 2012 16:41

  • Insert data into the table particular

    Hello

    I have a requirement to insert data from table from Oracle 10 g to Oracle 9i table.
    The pom_code table should be filled with gr_product table based on a specific schema of codes - i.e. If POM Code corresponds to a specific model, then it must belong to a specific company.
    FROM :: Oracle 10g database
    
    gr_product
    pr_code varchar2(20 byte)
    pr_desc varchar2(80 byte)
    To :: Oracle 9i database
    
    pom_code
    code      varchar2(12 byte)
    desc      varchar2(100 byte)
    companyid Number
    1. All gr_product.pr_code with following pattern should go to pom_code.code and companyid =10
    
    a. <one digit><.><two digit><alphabet> ex code:  1.01A
    b. <one digit><.><two digit><alphabet><space><two alphabet> ex code: 1.01B ZF  
    
    2. All gr_product.pr_code with following pattern should go to pom_code.code and companyid =20
    a. <two digit><.><one digit><alphabet> ex code: 10.1A         
    b. <two digit><.><one digit><alphabet><space><two alphabet> ex code: 10.5A HR    
    
    3. All gr_product.pr_code with following pattern should go to pom_code.code and companyid =30
    a. <alphabet><.><two digit><alphabet>  ex code: B.42A
    b. <alphabet><.><two digit><alphabet><space><two alphabet> ex code: N.10B AT 
    Thank you
    Sandy

    Hello

    The CASE expression I posted earlier does what you want?
    If so, please mark the thread as "answered".
    If this isn't the case, after a complete script that people can run to recreate the problem and test their ideas. Includes TABLE of CASH and INSERT statements for some examples of data for all the tables, the results you want from these sample data and your request (or INSERT statement) using the CASE expression. Report where the code you posted does not have what you need and explain how to get good results in these places.

  • Doubt about inserting data into a table

    Hi all, when I try to insert data into a table through an anonymous block, the pl/sql block runs successfully, but the data are not get inserted. Can someone please tell me where I am doing wrong?
    SQL> DECLARE
      2
      3  V_A NUMBER;
      4
      5  V_B NUMBER;
      6
      7  v_message varchar2(25);
      8
      9
     10  BEGIN
     11
     12
     13  select regal.regal_inv_landed_cost_seq.NEXTVAL into V_A from dual ;
     14
     15  select regal.regal_inv_landed_cost_seq.currval into V_B from dual ;
     16
     17  INSERT INTO rcv_transactions_interface
     18  (
     19               INTERFACE_TRANSACTION_ID,
     20               HEADER_INTERFACE_ID,
     21               GROUP_ID,
     22               TRANSACTION_TYPE,
     23               TRANSACTION_DATE,
     24               PROCESSING_STATUS_CODE,
     25               PROCESSING_MODE_CODE,
     26               TRANSACTION_STATUS_CODE,
     27               QUANTITY,
     28               LAST_UPDATE_DATE,
     29               LAST_UPDATED_BY,
     30               CREATION_DATE,
     31               CREATED_BY,
     32               RECEIPT_SOURCE_CODE,
     33               DESTINATION_TYPE_CODE,
     34               AUTO_TRANSACT_CODE,
     35               SOURCE_DOCUMENT_CODE,
     36               UNIT_OF_MEASURE,
     37               ITEM_ID,
     38               UOM_CODE,
     39               EMPLOYEE_ID,
     40               SHIPMENT_HEADER_ID,
     41               SHIPMENT_LINE_ID,
     42               TO_ORGANIZATION_ID,
     43               SUBINVENTORY,
     44               FROM_ORGANIZATION_ID,
     45               FROM_SUBINVENTORY
     46  )
     47
     48  SELECT
     49       regal.regal_inv_landed_cost_seq.nextval,      --Interface_transaction_
    id
     50       V_A,                                          --Header Interface ID
     51       V_B,                                          --Group ID
     52       'Ship',                                       --Transaction Type
     53       sysdate,                                      --Transaction Date
     54       'PENDING',                                    --Processing Status Code
    
     55       'BATCH',                                      --Processing Mode Code
     56       'PENDING',                                    --Transaction Status Cod
    e
     57       lc.quantity_received,                          --Quantity
     58       lc.last_update_date,                          --last update date
     59       lc.last_updated_by,                           --last updated by
     60       sysdate,                                      --creation date
     61       lc.created_by,                                --created by
     62       'INVENTORY',                                  --Receipt source Code
     63       'INVENTORY',                                  --Destination Type Code
     64       'DELIVER' ,                                    --AUT Transact Code
     65       'INVENTORY',                                  --Source Document Code
     66        msi.primary_uom_code ,                       --Unit Of Measure
     67        msi.inventory_item_id,                        --Item ID
     68        msi.primary_unit_of_measure,                  --UOM COde
     69        fnd.user_id,
     70        V_A,                                         --Shipment Header ID
     71        V_B,                                         --SHipment Line ID
     72        82,                                           --To Organization ID
     73        'Brooklyn',                                     --Sub Inventory ID
     74        81,                                            --From Organization
     75        'Vessel'                                       --From Subinventory
     76
     77    FROM
     78       regal.regal_inv_landed_cost_tab lc,
     79       fnd_user fnd,
     80       mtl_system_items msi
     81
     82    WHERE
     83       lc.organization_id = msi.organization_id
     84       AND  lc.inventory_item_id = msi.inventory_item_id
     85       AND  lc.created_by = fnd.created_by;
     86
     87  commit;
     88  v_message := SQL%ROWCOUNT;
     89  dbms_output.put_line('v_message');
     90  END;
     91  /
    v_message
    
    PL/SQL procedure successfully completed.
    SQL> select * from rcv_transactions_interface;
    
    no rows selected
    Thanks in advance!

    There is no problem with inserting data!
    Only there is no data! This means that your select statement retrieves no rows.
    You can see the output of your program (0). This means that there where no line in the result set.

    Please check the output of your tax return independently:

    SELECT
    --        regal.regal_inv_landed_cost_seq.nextval,      --Interface_transaction_id
     --       V_A,                                          --Header Interface ID
    --        V_B,                                          --Group ID
            'Ship',                                       --Transaction Type
            sysdate,                                      --Transaction Date
            'PENDING',                                    --Processing Status Code
            'BATCH',                                      --Processing Mode Code
            'PENDING',                                    --Transaction Status Code
            lc.quantity_received,                          --Quantity
            lc.last_update_date,                          --last update date
            lc.last_updated_by,                           --last updated by
            sysdate,                                      --creation date
            lc.created_by,                                --created by
            'INVENTORY',                                  --Receipt source Code
            'INVENTORY',                                  --Destination Type Code
            'DELIVER' ,                                    --AUT Transact Code
            'INVENTORY',                                  --Source Document Code
             msi.primary_uom_code ,                       --Unit Of Measure
             msi.inventory_item_id,                        --Item ID
             msi.primary_unit_of_measure,                  --UOM COde
             fnd.user_id,
      --       V_A,                                         --Shipment Header ID
    --         V_B,                                         --SHipment Line ID
             82,                                           --To Organization ID
             'Brooklyn',                                     --Sub Inventory ID
             81,                                            --From Organization
             'Vessel'                                       --From Subinventory
         FROM
            regal.regal_inv_landed_cost_tab lc,
            fnd_user fnd,
            mtl_system_items msi
         WHERE
            lc.organization_id = msi.organization_id
            AND  lc.inventory_item_id = msi.inventory_item_id
            AND  lc.created_by = fnd.created_by;
    

    Published by: hm on 13.10.2011 23:19

    I removed the references of the sequence and the variables V_A and YaeUb.
    BTW: Why do you want to include V_A and YaeUb in two different columns?

    The use of sequences in your code seems a bit strange to me. But this has nothing to do with your question.

  • Insert data from a particular region.

    I have two region report...

    I use apex item to insert data into a table. When I try to insert the data from the 2nd report region, region 1 data get insert instead of the 2nd region report data.

    How to distinguish the point of apex from one region to another region?

    This is my 2nd region (doc) report
    insert into doc values(apex_application.g_f02(i),apex_application.g_f03(i),apex_application.g_f04(i));
    How to solve this problem?

    SKUD.

    Hello

    Make sure that the columns of report 2 region should not have same value p_idx.
    Example-

    Report 1 query
    
    select apex_item.text(1 , null);
    
    Report 2 query
    
    select apex_item.text(1, null);
    

    In the example above if you see the both the query have same p_idx value in 1...

    In this case, if you try to save the data in the second report it will save the data in the first report.

    To avoid this, you must make sure that the p_idx value is different... This is... If you the first query has five columns with p_idx the value 1, 2, 3, 4, 5... so for next report make sure that the value of p_idx must be greater than 5... for example... 6, 7, etc.

    Kind regards
    Shijesh

  • inserting data into the table

    Hi all
    I use forms [32 bit] Version 6.0.8.24.1 (Production)
    Oracle Database 10g Release 10.2.0.1.0 - Production
    I have settings such as the (optional) emp_code and the year (mandatory field - four digits).
    Based on the setting that I have to get the detail of a table and these must be inserted at the other table with columns of additions (to hardcode the additional columns).
    To achieve this, I intend to get a cursor by selecting the required fields in the table by the way the where clause of the cursor parameters.
    by making a loop through the cursor I will insert the records in the other table.
    Here, the thing is that the data is going to be huge (since the year is the parameter).
    so my approach causes the performance issue.
    I heard that there is a different method of insetions
    can anyone suggest me the best way (performance wise) other than what I mentioned (if you are aware of)...

    Thank you...

    user13329002 wrote:
    Thanks for everyone.
    I have to take the data from the table as e_name, e_code, of the table and insert it into another table with some other values such as
    e_name, e_code, as well as I add 'n', 'o'.
    its something like

    insert into e_emp(emp_name,emp_code,emp_add,emp_status,emp_type)
    select e_name,e_code,e_add,'O','N')
    from e_table
    where e_date = Parameter.
    

    in other words, the values for Emp_status, emp_type I have no values in the e_table.so table and enter in e_table I have to hard code it.
    CAL I hard code as I mentioned in my statement example

    can someone clear me of the foregoing.

    Thank you...

    Published by: user13329002 on February 15, 2011 20:11

    Yes... You can hardcode the values for Emp_status, emp_type.

    SQL> CREATE TABLE e_emp(emp_code NUMBER(10),emp_status VARCHAR2(1),emp_type VARCHAR2(1));
    
    Table created.
    
    SQL> create table e_table as (select * from e_emp);
    
    Table created.
    
    SQL> INSERT INTO e_table(emp_code) VALUES('1111');
    
    1 row created.
    
    SQL> insert into e_table(emp_code) values('2222');
    
    1 row created.
    
    SQL> select * from e_table;
    
      EMP_CODE E E
    ---------- - -
          1111
          2222
    
    SQL> insert into e_emp(emp_code,emp_status,emp_type) (select emp_code,'0','N' from e_table);
    
    2 rows created.
    
    SQL> select * from e_emp;
    
      EMP_CODE E E
    ---------- - -
          1111 0 N
          2222 0 N
    
    SQL> 
    

    I hope this helps.

    Kind regards
    Claudy

  • Migration of data from a table to another table

    have a table1 that includes the existing data in the format.

    ~@!%~X1~@!%~Y1 in three different coulmns

    creates a new empty table and the need to migrate the data above, which is present in 3 different columns in a column in the new table, as shown in the example below.

    table 1 existing data (| separator of columns for formatting)
    ------------------------------------------------------------------------------------------------------------------------------------
    ID name1 | Name2. Name3
    123 ~@!%~X1~@!%~Y1 | ~@!%~X2~@!%~Y2 | ~@!%~X3~@!%~Y3
    234 ~@!%~X4~@!%~Y4 | ~@!%~X5~@!%~Y5 | ~@!%~X6~@!%~Y6
    456 ~@!%~X7~@!%~Y7 | ~@!%~X8~@!%~Y8 |     ~@!%~X9~@!%~Y9


    Table 2, which will initially be empty and after migration, it should look as follows.

    ID name1
    ----------------------------------------------------------------------------------------------------------------------------
    123 ~@!%~X1~@!%~Y1 & & ~@!%~X2~@!%~Y2 & & ~@!%~X2~@!%~Y2
    234 ~@!%~X4~@!%~Y4 & & ~@!%~X5~@!%~Y5 & & ~@!%~X6~@!%~Y6
    456 ~@!%~X7~@!%~Y7 & & ~@!%~X7~@!%~Y7 & & ~@!%~X7~@!%~Y7

    as shown in the example above

    Name1 column has ~@!%~X1~@!%~Y1
    Column name2 has ~@!%~X2~@!%~Y2
    Name3 column has ~@!%~X3~@!%~Y3

    Once the data is migrating from table 1 for id - 123 looks like below, before joining data from 3 tables, I need apopend & & for each for the token I read of the tabl1 of name1 to end ii should be added "& &" also when I read the name2 I add "& &" at the end of the string before the concatination.

    Here's the sample that deals with data for id - 123 with & & (only & & other symbols are part of the data)

    ~@!%~X1~@!%~Y1 & & ~@!%~X2~@!%~Y2 & & ~@!%~X2~@!%~Y2

    need help in writing a note of migate

    Published by: [email protected] on April 2, 2010 15:42

    Hello

    You are looking for something like this

    CREATE TABLE table_new
    AS
       (SELECT id, name1 || '&&' || name2 || '&&' || name3 name1
        FROM table1);
    

    or if you have the table ready

    INSERT INTO table_new
       (SELECT id, name1 || '&&' || name2 || '&&' || name3 name1
        FROM table1);
    

    Thank you

    Alen

  • Load data from one table into another table of 2 different schemes

    Hello

    We have a requirement to insert data into a table in a schema of a table that is in other schemas in ODI.

    We are able to do so by creating interfaces and mappings. But we now expect to do using SQL instead of ODI interfaces.

    Is it possible to do this using the SQL statements we have source and target data sources defined in ODI.

    should be like "Insert into src.table select * from tar.table'"

    Thank you...

    Hello

    If you try to load a db to another db using sql (sql free hand) instead of interfaces instructions.

    It is possible using procedures odi too.

    1. Select the project (designer navigator) odi mode

    2. create the new procedure. Then add the command.

    in this command on the source command on the tabs of the target.

    Enter the sql statements. See the screenshots below...

    I think this will help for you,

    Thank you best regards &,.

    A.Kavya

Maybe you are looking for

  • Add File Path as a Spotlight comment to several files using Automator and AppleScript

    Hello I would like to add the path of the current directory of files as a comment of built-in projector in each of them, so when I move I know where they where originally. I am trying to use the script below: the term {parameters} Tell application "F

  • Cannot change the wireless Lan through the Client Manager

    I currently have a series of Satellite Pro 6100 running Windows 2000. The user is uable to select another wireless thanks to the future connection manager Client unless he is logged on as administrator.We run Customer Manager V2.58. This problem is n

  • Add the windows firewall with the security log for windows 2008 Event Viewer

    Hi all I would like to see weather which is turn on the Windows or turn OFF firewall and at what time on Windows 2008. As what I had checked, I could see this on Windows 7 (Event Viewer/Applications and Services/Logs/Microsoft/Windows/Windows Firewal

  • With the help of WAP54G connected to BEFSR41

    I have a desktop connected to my BEFSR41 Vista Home Edition. My WAP54G is also connected to the BEFSR41, providing access for two portable Vista Home Edition. All machines have Internet access. The problem is that portable computers cannot access the

  • laptop computer cd/dvd drive

    Hello I have a problem with my cd player, indeed when I insert a disc the player starts and then more nothing. I searched my drive in disk management, my drive appears, but without the letter, I tried him in assigned one but she if poster and s "remo