insert with update......
DBAsupport.com Forums - Powered by vBulletin
Results 1 to 4 of 4

Thread: insert with update......

  1. #1
    Join Date
    Jul 2002
    Posts
    228

    insert with update......

    Hi,
    I've this table:

    desc TAB1
    DESCRIPTION VARCHAR2(20);
    QUANTITY NUMBER;


    DESCRIPTION........QUANTITY
    APPLE............. 10
    COFFEE............ 7

    I'd like to insert into TAB1 a new record, but if the value of description exist, It update quantity without
    insert a new record.
    Is it possible do it with just one statement sql without any control structure??

    thanks
    Raf

  2. #2
    Join Date
    Dec 2000
    Location
    Ljubljana, Slovenia
    Posts
    4,439
    MERGE. Check SQL Manuals for syntax.
    Jurij Modic
    ASCII a stupid question, get a stupid ANSI
    24 hours in a day .... 24 beer in a case .... coincidence?

  3. #3
    Join Date
    Jul 2002
    Posts
    228
    my oracle version is 8.1.7.0

    Is it possible with this version??


    Thanks

  4. #4
    Join Date
    Dec 2000
    Location
    Ljubljana, Slovenia
    Posts
    4,439
    No, in this case you need 2 sql statements (update + insert).
    Jurij Modic
    ASCII a stupid question, get a stupid ANSI
    24 hours in a day .... 24 beer in a case .... coincidence?

Posting Permissions

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


Click Here to Expand Forum to Full Width