Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2007

    Unanswered: Loading tables from other tables

    Could you please help me in this, In a script if I want to do following

    I have two set of tables.


    Table_T2_1, Table_T2_2, Table_T2_4, Table_T2_5,Table_T2_6

    Each table in table set Table_T2_* contain data for one month only whereas table table_T1 contain data for multiple months.

    I want to select Year & month from each of Table_T2_* & check if any record for that year month in Table T1

    If yes then Insert those record in that table by load from cursor into respective table Table_T2_* . I want to do that in loop.


    Suppose Table_T2_1 contain data for May-2005 so I need to load all May 2005 data from table Table_T1 to Table_T2_1, similarly if Table_T2_2 contain data for Nov-2005 then pick all records for Nov_2005 from Table_T1 & insert in Table_T2_2.

    Thanks in advance

  2. #2
    Join Date
    Jan 2003
    Provided Answers: 5
    I am not sure I got exactly what you are after, but the select for the cursor might look like: (this is assuming that your month and year ae separate column named amonth and ayear).

    select * from table_t1 where (ayear,amonth) in (select ayear,amonth from table_t2_1)

    You would have a similiar statement fore each table table_t2_*.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts