Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2004
    Location
    India
    Posts
    191

    Question Unanswered: PLSQL / SQL QUERY Problem

    Hello Everyone,

    I have Problem writing SQL or PL/SQL programme.
    I have two tables say table1 and table2
    Columns in table1 and table2:

    Table1

    db_code
    Item_id
    Item_number
    Region_code
    Part_number

    Table2

    db_code
    Item_id
    Item_number
    Error_code
    Region_code
    Part_number


    I want to update table2 with db_code,item_id and item_number from table1 .The link between table1 & table2 is

    table1.region_code=table2.region_code
    table1.Part_number=table2.Part_number


    case1

    If only one record is retrieved from table1. Then directly assign db_code,item_id & item_number to table2; i.e.
    table2.db_code=table1.db_code
    table2.Item_id=table1.Item_id
    table2.Item_number=table1.Item_number

    case2

    More than one record is retrieved and if the record is available for default db_code (default db_code
    for America- 3100 & Europe- 4130)
    Assign db_code,item_id and item_number from the default db_code


    case3
    More than one record is retrieved and if no record is available for default db_code (default db_code
    for America- 3100 & Europe- 4130)
    Assign db_code,item_id and item_number from the from the first record

    case3
    If No records are retrieved assign error code=1


    Is it possible to do with SQL Query or have to write PLSQL program?

    Thanks,
    paginit
    Pagnint
    (No need to search web before posting new question)

  2. #2
    Join Date
    Nov 2003
    Location
    Bangalore, INDIA
    Posts
    333

    Thumbs up

    Hi,

    GO with PL\SQL .
    SATHISH .

  3. #3
    Join Date
    Sep 2003
    Posts
    6
    Hi,

    I think PL/SQL will be fine and will be easy for analysis.

    Regards,
    Forum

Posting Permissions

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