Capture from Two Tables and Apply in one Table

Hi All,
Is it possible to capture from two tables (master and child table) and apply in one table?
For example,
1. DEPT and EMP tables in source database with relation
DEPT table structure is like DEPT_ID, DEPT_NAME, LOC_NAME
EMP table structure is like EMP_ID, EMP_NAME, EMP_DOJ, EMP_SAL, DEPT_ID
2. EMP_DEPT_STAGING in destination database
EMP_DEPT_STAGING table structure is like EMP_ID, EMP_NAME, EMP_DOJ, EMP_SAL, DEPT_ID. DEPT_NAME, LOC_NAME
if there is any update in DEPT table, EMP_DEPT_STAGING should get populated with Department and its employee details. Similarly, if there is any update in EMP table EMP_DEPT_STAGING table should get populated with Employee details and along with department detail.
Is it possible to accomplish this? If yes, could you please provide me some examples?
Thanks & Regards
Thiyagu
Edited by: mt**** on Sep 4, 2011 11:22 PM

like this
INSERT @PlantNew  (PlantID, PlantName, PlantDirExists, PlantAssistantDirID, PlantDirID) 
SELECT p.PlantID,
p.PlantName,
CASE WHEN pd.PlantID IS NULL THEN 0 ELSE 1 END,
PlantAssistantDirID,
PlantDirID
FROM @Plant p
LEFT JOIN (SELECT PlantID,
MAX(CASE WHEN Assistant = 1 THEN PlantDirectorID END) AS PlantAssistantDirID,
MAX(CASE WHEN Assistant = 0 THEN PlantDirectorID END) AS PlantDirID
@PlantDirector
GROUP BY PlantID)pd
ON pd.PlantID = p.PlantID
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs
You're missing a FROM
insert into @PlantNew
SELECT p.PlantID,
p.PlantName,
CASE WHEN pd.PlantID IS NULL THEN 0 ELSE 1 END,
PlantAssistantDirID,
PlantDirID
FROM @Plant p
LEFT JOIN (SELECT PlantID,
MAX(CASE WHEN Assistant = 1 THEN PlantDirectorID END) AS PlantAssistantDirID,
MAX(CASE WHEN Assistant = 0 THEN PlantDirectorID END) AS PlantDirID
from @PlantDirector
GROUP BY PlantID)pd
ON pd.PlantID = p.PlantID

Similar Messages

  • Fetch data from two tables and insert into one table

    I have similar to the following data in two tables (@Plant, @PlantDirector) and need to consolidate into one table (@PlantNew) as follows.
    DECLARE @Plant TABLE (PlantID INT, PlantName VARCHAR(100))
    INSERT INTO @Plant (PlantID, PlantName) VALUES (1, 'Name One'),(2, 'Name Two'),(3, 'Name Three'),(4, 'Name Four'),(5, 'Name Five'),(6, 'Name Six')
    Director data for the Plants exist in the following table. Assistant value 1 means Assistant Director and 0 means Director. 
    Data exists only for subset of plants and a Plant may have one or both roles.
    DECLARE @PlantDirector TABLE (PlantID INT, PlantDirectorID INT, Assistant bit)
    INSERT INTO @PlantDirector (PlantID, PlantDirectorID, Assistant) VALUES (2, 111, 1),(2, 222, 0),(4, 333, 0),(6,444,1)
    The above data needs to be inserted into one table (@PlantNew) as follows: 
    PlantID in @Plant table is IDENTITY value and needs to be inserted as-is into this table.
    PlantDirExists will get a value of 1 if at least one record exists in @PlantDirector table for a PlantID. PlantAssistantDirID and PlantDirID should be set to the corresponding PlantDirID or NULL appropriately depending on the data.
    DECLARE @PlantNew TABLE (PlantID INT, PlantName VARCHAR(100), PlantDirExists bit, PlantAssistantDirID INT, PlantDirID INT)
    INSERT INTO @PlantNew (PlantID, PlantName, PlantDirExists, PlantAssistantDirID, PlantDirID)
    VALUES (1, 'Name One', 0, NULL, NULL),(2, 'Name Two', 1, 111, 222),(3, 'Name Three', 0, NULL, NULL),(4, 'Name Four', 1, NULL, 333),(5, 'Name Five', 0, NULL, NULL),(6, 'Name Six',1, 444, NULL)
    How do I achieve the above using SQL ? Thanks.

    like this
    INSERT @PlantNew  (PlantID, PlantName, PlantDirExists, PlantAssistantDirID, PlantDirID) 
    SELECT p.PlantID,
    p.PlantName,
    CASE WHEN pd.PlantID IS NULL THEN 0 ELSE 1 END,
    PlantAssistantDirID,
    PlantDirID
    FROM @Plant p
    LEFT JOIN (SELECT PlantID,
    MAX(CASE WHEN Assistant = 1 THEN PlantDirectorID END) AS PlantAssistantDirID,
    MAX(CASE WHEN Assistant = 0 THEN PlantDirectorID END) AS PlantDirID
    @PlantDirector
    GROUP BY PlantID)pd
    ON pd.PlantID = p.PlantID
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs
    You're missing a FROM
    insert into @PlantNew
    SELECT p.PlantID,
    p.PlantName,
    CASE WHEN pd.PlantID IS NULL THEN 0 ELSE 1 END,
    PlantAssistantDirID,
    PlantDirID
    FROM @Plant p
    LEFT JOIN (SELECT PlantID,
    MAX(CASE WHEN Assistant = 1 THEN PlantDirectorID END) AS PlantAssistantDirID,
    MAX(CASE WHEN Assistant = 0 THEN PlantDirectorID END) AS PlantDirID
    from @PlantDirector
    GROUP BY PlantID)pd
    ON pd.PlantID = p.PlantID

  • Fetching data from one internal table and populating into other table

    hi
    i am working on a report program.
    here,i have my data in a internal table(having only one field) i.e. only one column in the table.
    now i want to populate this data into other internal internal table that has 13fields i.e. 13 columns.
    so could anyone let me know how can i work on this.
    i am looping the internal table with one field into a work area from there i am not able to proceed ahead.
    thanks in advance

    hi
    i would like to clear one point here i.e. my internal table into which i want to populate data is a dynamic internal table....so i cant give the fieldnames here..
    here i am pasting the code..so that u may get some idea...
    "generating dynamic internal table :
    ref_descr ?= cl_abap_typedescr=>describe_by_data( it_itab ).
    it_details[] = ref_descr->components[].
    loop at it_details into wa_comp.
    cnt = cnt + 1.
    wa_fcat-col_pos = cnt.
    wa_fcat-fieldname = wa_comp-name.
    append wa_fcat to t_fcat.
    endloop.
    CALL METHOD CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE
      EXPORTING
        I_STYLE_TABLE             =
        IT_FIELDCATALOG           = t_fcat
        I_LENGTH_IN_BYTE          =
      IMPORTING
       EP_TABLE                  = lo_table
        E_STYLE_FNAME             =
      EXCEPTIONS
        GENERATE_SUBPOOL_DIR_FULL = 1
        others                    = 2
    so lo_table is my dynamic internal table.
    ASSIGN lo_table->* TO <f_tab>.
    using the GUI_UPLOAD i have uploaded the data file(separated by semicolon)  from presentation server and its in the table itab.
    with the following logic i am capturing the data in between the semicolon's.
    LOOP AT itab INTO wa_itab.
    find all occurrences of c_semicolon in wsg_string results result_tab.
    loop at result_tab into wa_reslt.
    if sy-tabix = 1.
    str1 = wsg_string+0(wa_reslt-offset).
    wa_prev_offset  = wa_reslt-offset.
    wa_prev_offset = wa_prev_offset + 1.
    clear str1.
      else.
       count = wa_reslt-offset - wa_prev_offset.
       count = count.
    str2 = wsg_string+wa_prev_offset(count).
    clear str2.
    wa_prev_offset  = wa_reslt-offset.
    wa_prev_offset = wa_prev_offset + 1.
    enddo.
    endif.
    endloop.
    data is there in the fields str1 and str2.now i want to populate this data into dynamic internal table row-wise.
    could anyone suggest me how can i do this

  • How to read LONG RAW data from one  table and insert into another table

    Hello EVERYBODY
    I have a table called sound with the following attributes. in the music attribute i have stored some messages in the different language like hindi, english etc. i want to concatinate all hindi messages and store in the another table with only one attribute of type LONG RAW.and this attribute is attached with the sound item.
    when i click the play button of sound item the all the messages recorded in hindi will play one by one automatically. for that i'm doing the following.
    i have written the following when button pressed trigger which will concatinate all the messages of any selected language from the sound table, and store in another table called temp.
    and then sound will be played from the temp table.
    declare
         tmp sound.music%type;
         temp1 sound.music%type;
         item_id ITEM;
    cursor c1
    is select music
    from sound
    where lang=:LIST10;
    begin
         open c1;
         loop
              fetch c1 into tmp; //THIS LINE GENERATES THE ERROR
              temp1:=temp1||tmp;
              exit when c1%notfound;
         end loop;
    CLOSE C1;
    insert into temp values(temp1);
    item_id:=Find_Item('Music');
    go_item('music');
    play_sound(item_id);
    end;
    but when i'm clicking the button it generates the following error.
    WHEN-BUTTON-PRESSED TRIGGER RAISED UNHANDLED EXCEPTION ORA-06502.
    ORA-06502: PL/SQL: numeric or value error
    SQL> desc sound;
    Name Null? Type
    SL_NO NUMBER(2)
    MUSIC LONG RAW
    LANG CHAR(10)
    IF MY PROCESS TO SOLVE THE ABOVE PROBLEM IS OK THEN PLESE TELL ME THE SOLUTION FOR THE ERROR. OTHER WISE PLEASE SUGGEST ME,IF ANY OTHER WAY IS THERE TO SOLVE THE ABOVE PROBLEM.
    THANKS IN ADVANCE.
    D. Prasad

    You can achieve this in many different ways, one is
    1. Create another VO based on the EO which is based on the dest table.
    2. At save, copy the contents of the source VO into the dest VO (see copy routine in dev guide).
    3. commiting the transaction will push the data into the dest table on which the dest VO is based.
    I understand that if we attach VO object instance to region/page, we only can pull and put data in to only one table.
    if by table you mean a DB table, then no, you can have a VO based on multiple EOs which will do DMLs accordingly.Thanks
    Tapash

  • How to join  fields from different internal tables and display into one int

    hai i have one doubt...
    how to join  fields from different internal tables and display into one internal table..
    if anybody know the ans for this qus tell me......

    hii
    you can read data as per condition and then can join in one internal table using READ and APPEND statement..refer to following code.
    SELECT bwkey                         " Valuation Area
             bukrs                         " Company Code
        FROM t001k
        INTO TABLE i_t001k
       WHERE bukrs IN s_bukrs.
      IF sy-subrc EQ 0.
        SELECT bwkey                       " Valuation Area
               werks                       " Plant
          FROM t001w
          INTO TABLE i_t001w
           FOR ALL ENTRIES IN i_t001k
         WHERE bwkey = i_t001k-bwkey
           AND werks IN s_werks.
        IF sy-subrc EQ 0.
          LOOP AT i_output INTO wa_output.
            READ TABLE i_t001w INTO wa_t001w WITH KEY werks = wa_output-werks.
            READ TABLE i_t001k INTO wa_t001k WITH KEY bwkey = wa_t001w-bwkey.
            wa_output-bukrs = wa_t001k-bukrs.
            MODIFY i_output FROM wa_output.
            CLEAR wa_output.
          ENDLOOP.                         " LOOP AT i_output
        ENDIF.                             " IF sy-subrc EQ 0
    regards
    twinkal

  • Loading consolodated data from two excel files / cube into one infocube

    Hi Friends,
    I am receiving data from two sources:
    Source 1:
    Customer Product  Location                          Keyfig(Budget)
    C1            P1          L1                                     100
    C2            P1         L1                                      200
    C1           P2          L1                                      300
    Source 2:
    Product     Location                        KeyFig (Actual)
    P1               L1                                           320
    P2               L1                                           350
    I want to combinedata from two sources (or cubes) into one cube as follows:
    Customer      PRoduct       location          Budget            Actual
    C1                 P1                 L1                  100                 320
    C2                 P1                L1                   200                 320
    C1                P2                L1                   300                   350
    I tried by creating multiple data sources / infosources / transformations / updates rules and also tried with both DSO and cube. But the records are always getting updated as follows:
    Customer      PRoduct       location          Budget            Actual
    C1                 P1                 L1                  100                 320
    C2                 P1                L1                   200                 320
    C1                P2                L1                   300                   350
                        P1               L1                                           320
                       P2               L1                                           350
    Can you help me figure out if this is possible? If yes, how can I do it.
    Thanks a lot in advance.

    Hi,
    Please use the below approach.
    Load the budget data in ODS1.
    Load the actual data in ODS2.
    Create a ODS3 with same structure as ODS1 with additional key figure for Actuals,which will get data from ODS1. Here add a look up based product and location to populate actuals.
    Start Routine
    SELECT * FROM ODS2 into ITAB
    FOR ALL ENTRIES in SOURCE_PACKAGE.
    Transformation Routine:
    Read table ITAB  into WATAB
    with key location = <source_fields>-Location
    product =  <source_fields>-Product.
    If sy-subrc = 0.
    RESULT = WATAB-ACTUAL.
    ENDIF.
    -Vikram

  • How to read the data from excel file and store into the table?

    Hi All,
    I have table with BLOB datatype contains a excel file. I have to read that data from excel and store into one table with all the fields in excel.
    All the excel fields and my table columns are same.
    Can you share with me how can acheive this using LOB's?
    Thanks

    Hi OraSuirya,
    you can try with external tables .
    syntax as follows
    create table ext_table_csv (
    i Number,
    n Varchar2(20),
    m Varchar2(20)
    organization external (
    type oracle_loader
    default directory ext_dir
    access parameters (
    records delimited by newline
    fields terminated by ','
    missing field values are null
    location ('file.csv')
    reject limit unlimited;
    For this you need to create directory
    Directory Creation syntax:
    create or replace directory ext_dir as 'D:\oracle\user_dir\ext_dir';
    grant read, write on directory ext_dir to <User>;
    please paste the excel file in the particular directory .
    I hope this will help you.
    Please correct me if I am wrong anywhere .
    Thanks,
    Tippu.

  • How to force BI Server to pick from the Agg table and not the Fact table?

    Hi All,
    I have 3 tables as the Sources in the Key measures. 2 are fact tables and the other one is the agg table.
    E.g.
    Fact 1 at A,B,C,D and E level
    Fact 2 at A,B,C level
    Agg at A,B,C level which contains the measures from the Fact1 and Fact2
    So when I select the measures from the Agg which are coming from Fact1 the Agg table get fired and when I select measures from Agg which are coming from Fact2, the Fact2 table gets fired in the SQL Query.
    Now my question here is there anyway to tell BI Server that when I select Fact2 measures fire the Agg table and not the Fact2 table. The reason being the Agg and Fact2 tables are at the same level.
    But I need to keep the Agg table as it is one level higher than the Fact1 tables.
    Any pointers would be helpful.

    hi,
    you explain us your situation really good.but you forgot to tell us the most import,the measures in aggregate table and the aggregated dimensions.
    meaning,you have 7 measures aggregated in some levels of your dimensions tables?if yes,there is no possibility Bi goes anywhere else..(by choosing only these measures and the defined levels at your dimensions..)
    One more thing,if you choose a combination of your 2 fact data sources,bi goes?where???
    hope i helped...
    http://greekoraclebi.blogspot.com/

  • Capturing From Two Different Sources

    Hello, how reliable is it to capture from two different sources using the following sceario:
    1. Powerbook G4 15" Using the digital optical audio input for sound and using the DV 1394 Input for DV video
    2. In FCP, selecting "Digital Optical Input" for AUDIO and DV for video
    3. Hit capture now since it is going to be recorded live
    Any thoughts folks?
    Trying to avoid bying the firestore $8,000 solution

    Hi,
    I don't see any problems in that scenario - if your disc is fast enough, that is! I've never worked with a G4 Powebook but in theory, it all comes down to the spped of the storage you have. The safest scenariio, az suggested above, would be to try it beforehand. You should also considerthe length of the live recording as opposed to the disc space you have. I don't know about the "firestore" solution but a firewire "LaCie" external disc is a cheap solution and it works fine with the G4 Powebook. Another issue is what FCP compressor to use during capture! Try it!

  • Find a specific paragraph style within a table and apply a specific cell style?

    I'm a total beginner when it comes to scripting, but I would like to create a script that finds the paragraph style "resultsUL" within a large table and applies the cell style "female". Sure wish the find/replace was able to account for cell styles as well as paragraph and character styles. Is anyone willing to help me with this? Thank you!

    Hi,
    I do it quickly defining a simple research on the "resultsUL" para style and using a loop with QuicKeys as:
    Cmd-0 is a shortcut associated to the "female" cell style.
    So, What I do: search the para style (Cmd-option-F) and apply the cell style, then search again…
    As easy to do with QuicKeys, I think that can be easily done with a [JS] (faster process!).

  • I have two apple ids somehow, probably from two mobile and two computers - how do I merge them into one account so they all work with iCloud?

    Somewhere, somehow, between two mobile and two macs, I ended up with two apple ids. I figured that this was the root of my problem to syncing. So, I am syncing Mail, Contacts, etc through the one account that I bought storage on this year in iCloud. I want to merge the two accounts, since many of my apps were purchased with my other id. Apparently, Keynote will not merge files since the app was bought with the second id, not the id I am using for icloud.
    What to do??? I read, in the forums, that I am definitely not alone. I always had the id I used for the Apple Store to buy iTunes items, and then apps. The other id, that I am using for iCloud was based on my iDisk id, and apparently I set up as a separate account. The much failed iDisk account appears to be the one that I wish I never got involved with. Should I feel the same way about iCloud. If I cannot merge the two APPLE accounts from the same person (ME!!!), then many dropbox really is the answer for my file sharing needs.
    Please help me decide.

    To begin with, I would like to try to explain Apple's confusing nomenclature in regard to iCloud.
    Apple have called the whole cloud thing iCloud, there are a number of features under the iCloud umbrella, some of which require their own login. iTunes is one of these, another is what Apple have unfortunately also called iCloud too.
    You can use the same Apple ID (account) to login to both iCloud and iTunes, but you don't need to and often users will login to each service using a different ID.
    The part that you need to remember is that the services available when you log into iCloud are completely different and unrelated to those when you log in to iTunes. Your iCloud login enables mail, contacts, calendars, find my phone, Back to My Mac, Documents & Data sharing and photostream, it does not affect any of your iTunes services.
    To avoid confusion when discussing your problem, when I mention iCloud, I am referring to the services under the iCloud login, Whereas I will refer to the whole cloud thing as The Cloud.
    To go back to your question; you cannot merge accounts, but perhaps using one account for iCloud and the other for iTunes will resolve the majority of the reasons you needed to merge to begin with.

  • How to get the data from one table and insert into another table

    Hi,
    We have requirement to build OA page with the data needs to be populated from one table and on save data into another table.
    For the above requirement what the best way to implement in OAF.
    I understand that if we attach VO object instance to region/page, we only can pull and put data in to only one table.
    Thanks

    You can achieve this in many different ways, one is
    1. Create another VO based on the EO which is based on the dest table.
    2. At save, copy the contents of the source VO into the dest VO (see copy routine in dev guide).
    3. commiting the transaction will push the data into the dest table on which the dest VO is based.
    I understand that if we attach VO object instance to region/page, we only can pull and put data in to only one table.
    if by table you mean a DB table, then no, you can have a VO based on multiple EOs which will do DMLs accordingly.Thanks
    Tapash

  • BI - ABAP To pick the field from One table and link with 2nd table

    Hello, I am stuck to write the correct abap code. Requirement is that My Client BMW  California require the below:
    <b>1.</b>  list of invoices (BELNR) that a has tcode = FB01 and FBVB" from Table BKPF.  Account Number field (BELNR) is there in 0fiap_4 Data source
    <b>2.</b> Now Link the above invoice Number (BELNR)  that a has tcode = FB01 and FBVB" from Table BKPF to BMW Custom Table I_BMW_WI. - Field "PAT ID" which is the cocatenation of OBJNR (Object Number), Invoice Number and Purchase Year.  where PICK only thos PAT ID where "TYPEID"  Value = "BMW" in table I_BMW_WI.
    To solve Number 1 Please fix my abap code and help me to write the Code to Solve Number 2 and Link #1 AND #2.
    Please help me soon
    Code # 1
    case I_datasource.
    WHEN '0FI_AP_4'.
    loop at C_t_data into l_s_DTFIAP_3.
    l_tabix = sy-tabix.
    clear I_BMW_WI.
    if sy-subrc = 0.
    select single * from BKPF into I_BKPF where BELNR = l_s_DTFIAP_3-BELNR.
    LOOP AT I_BKPF into I_FINAL WHERE
    Code below is not working
    (I_BKPF-TCODE = ‘FV50’) OR (I_BKPF-TCODE = ‘FB01’)
    I_FINAL-BELNR = I_BKPF-BELNR
    modify I_FINAL.
    endloop
    modify C_t_data from l_s_DTFIAP_3  index l_tabix.
    endif.
    endloop.
    endcase
    Code # 2 -
    Please help with templates.
    Thanks
    Soniya Kapoor

    Hi,
    Ad Code #1
    First of all the key for BKPF consists of:
    BUKRS, BELNR and GJAHR so I think you should use all key fields in your SELECT statement:
    select single * from BKPF into I_BKPF
    where BUKRS = l_s_DTFIAP_3-BUKRS and
          BELNR = l_s_DTFIAP_3-BELNR and
          GJAHR = l_s_DTFIAP_3-GJAHR.
    And why do you test SY-SUBRC after CLEAR ?
    Your IF statement should be after SELECT...
    And last but not least when you are using SELECT SINGLE you always get only one record so what is the purpose of LOOP statement ?
    Try following code:
    case I_datasource.
    WHEN '0FI_AP_4'.
      loop at C_t_data into l_s_DTFIAP_3.
        l_tabix = sy-tabix.
        select single * from BKPF into I_BKPF
          where BUKRS = l_s_DTFIAP_3-BUKRS and
                BELNR = l_s_DTFIAP_3-BELNR and
                GJAHR = l_s_DTFIAP_3-GJAHR.
        if sy-subrc = 0.
          if (I_BKPF-TCODE = ‘FV50’) OR
             (I_BKPF-TCODE = ‘FB01’).
            I_FINAL-BELNR = I_BKPF-BELNR
            modify I_FINAL.
          endif.
          modify C_t_data from l_s_DTFIAP_3 index l_tabix.
        endif.
      endloop.
    endcase.
    regards
    Krzys

  • IGNORE - Fixed Single-Database Capture and Apply Example, multiple tables

    I ran the demo setup for , "Single-Database Capture and Apply Example" ( http://download.oracle.com/docs/cd/B28359_01/server.111/b28321/capappdemo.htm#BCGBIEDJ )
    Everything works fine. I now want to capture changes to another table in the HR schema, using the same DML handler.
    I am uncertain of what to use for the stream name in the following (and related calls). I want the captures for the new table, "job_History" to go to the same queue. Do I use the same stream name, or do you have to create a new stream for each table capture? Thanks.
    BEGIN
    DBMS_STREAMS_ADM.ADD_TABLE_RULES(
    table_name => 'hr.job_history,
    streams_type => 'capture',
    streams_name   => 'capture_emp', queue_name => 'strmadmin.streams_queue',
    include_dml => TRUE,
    include_ddl => FALSE,
    inclusion_rule => TRUE);
    END;
    Edited by: user614224 on Nov 15, 2010 6:54 AM

    Please edit the subject of this post and change it to "Please Ignore." Then post your question, with full version information, to the Streams forum.

  • How to select data from one nested table and into another nested table

    create or replace
    TYPE ctxt_code_rec as object
    ctxt_header varchar2(10),
    header_description varchar2(300),
    status varchar2(30),
    adjacent_code varchar2(300),
    adjacent_desc Varchar2(400),
    adjacent_flag varchar2(4000),
    adjacent_text_href varchar2(4000)
    create or replace
    type ctxt_code_table as table of CTXT_CODE_REC
    d_table ctxt_code_table ;
    v_tab ctxt_code_table ;
    Iam trying to select data from d_table to v_tab
    using and bulk collect into
    select m.*
    bulk collect into p_code_result
    from table(l_loop_diag_code_table1)m
    order by 1;
    Receiving error:
    ora 94007 : not enoughvalues
    Could you please let me know how to solve it?
    Thanks,
    in advance

    >
    create or replace
    TYPE ctxt_code_rec as object
    ctxt_header varchar2(10),
    header_description varchar2(300),
    status varchar2(30),
    adjacent_code varchar2(300),
    adjacent_desc Varchar2(400),
    adjacent_flag varchar2(4000),
    adjacent_text_href varchar2(4000)
    create or replace
    type ctxt_code_table as table of CTXT_CODE_REC
    d_table ctxt_code_table ;
    v_tab ctxt_code_table ;
    Iam trying to select data from d_table to v_tab
    using and bulk collect into
    select m.*
    bulk collect into p_code_result
    from table(l_loop_diag_code_table1)m
    order by 1;
    Receiving error:
    ora 94007 : not enoughvalues
    Could you please let me know how to solve it?
    >
    Not unless you provide the code you are actually using.
    There is no definition of 'p_code_result' in your post and you say you 'trying to select data from d_table' but there is no code that loads 'd_table' in what you posted.
    And the SELECT query you posted actuall selects from an object named 'l_loop_idag_code_table1' which isn't mentioned in your code.
    Post the actual code you are using and all of the structures being used.
    Also explain why you even need to use nested tables and PL/SQL for whatever it is you are really doing.

Maybe you are looking for