Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2005

    Unanswered: 2 tables Insert via dblink

    I have 2 tables
    a and b

    std: std_id, std_name, notes_id
    notes : pguid, notes_id

    std : std_id,std_name,pguid

    Iam supposed to get the table std from another database and insert into the
    present database using the dblink but I want the Pguid coulmn data too when both notes_id matches.

    execute immediate ' insert into std(std_id,std_name,pguid)
    select std_id,std_name,notes.pguid
    from std'@'dblink,notes'@'dblink
    where std.notes_id = notes.notes_id

    but when i do this, Its only inserting the ones when notes_id condition is met,
    but I want to insert all the records into the 9.0 student table and if it got any pguid, get it from the notes table and insert it and if it does not have any pguid, just leave the pguid column as null ?

    How to Handle this.

    Please any help would be great.

    Thanks in advance

  2. #2
    Join Date
    Jan 2004
    Croatia, Europe
    Provided Answers: 5
    Try using outer join - slightly modify the last line of your query:

    WHERE std.notes_id = notes.notes_id (+)

Posting Permissions

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