DBAsupport.com Forums - Powered by vBulletin
Results 1 to 9 of 9

Thread: Update

  1. #1
    Join Date
    Feb 2002
    Location
    belgium
    Posts
    14

    Update

    hi !
    how can i do next update ? :
    update Table1 set cl001d=cl001d+(select AMOUNT from table2)
    *
    ERROR at line 1:
    ORA-00936: missing expression

  2. #2
    Join Date
    Mar 2001
    Location
    Reading, U.K
    Posts
    598
    "update Table1 set cl001d=cl001d+(select AMOUNT from table2)"
    ???

    can u explain clearly?
    Cheers!
    OraKid.

  3. #3
    Join Date
    Dec 2000
    Location
    Ljubljana, Slovenia
    Posts
    4,439
    update Table1 set cl001d=
    (select table1.cl001d+AMOUNT from table2 where ......);
    Jurij Modic
    ASCII a stupid question, get a stupid ANSI
    24 hours in a day .... 24 beer in a case .... coincidence?

  4. #4
    Join Date
    Feb 2002
    Location
    belgium
    Posts
    14
    Here is exact update :

    Update t_client a
    set cl001D = cl001D + (select sum(amount)
    from t_fh_fs b
    where a.clnbr = b.clnbr
    and b.department = 2
    )
    ;

    Table T_FH_FS has 1 to n transactions for each row of t_client.

  5. #5
    Join Date
    Dec 2000
    Location
    Ljubljana, Slovenia
    Posts
    4,439
    So what's wrong with the suggested update?

    update t_client a
    set cl001D =
    (select sum(amount)+a.cl001D
    from t_fh_fs b
    where a.clnbr = b.clnbr
    and b.department = 2);
    Jurij Modic
    ASCII a stupid question, get a stupid ANSI
    24 hours in a day .... 24 beer in a case .... coincidence?

  6. #6
    Join Date
    Feb 2002
    Location
    belgium
    Posts
    14

    UPDATE

    Hi,

    Like i just said on first request....

    1 Update t_client a
    2 set cl001D = cl001D + (select sum(amount)
    3 from t_fh_fs b
    4 where a.clnbr = b.clnbr
    5 and b.department = 2
    6* )
    SQL> /
    set cl001D = cl001D + (select sum(amount)
    *
    ERROR at line 2:
    ORA-00936: missing expression

  7. #7
    Join Date
    Dec 2000
    Location
    Ljubljana, Slovenia
    Posts
    4,439

    Re: UPDATE

    Originally posted by Antonio
    Hi,

    Like i just said on first request....

    1 Update t_client a
    2 set cl001D = cl001D + (select sum(amount)
    3 from t_fh_fs b
    4 where a.clnbr = b.clnbr
    5 and b.department = 2
    6* )
    SQL> /
    set cl001D = cl001D + (select sum(amount)
    *
    ERROR at line 2:
    ORA-00936: missing expression
    Gosh! Can you please run my update statement. It's not the same as yours, syntax is different and will not raise ORA-0093
    Jurij Modic
    ASCII a stupid question, get a stupid ANSI
    24 hours in a day .... 24 beer in a case .... coincidence?

  8. #8
    Join Date
    Feb 2002
    Location
    belgium
    Posts
    14
    That 's O.K.
    thanks a lot !

    hasta luego !

  9. #9
    Join Date
    Nov 2000
    Location
    Baltimore, MD USA
    Posts
    1,339

    Re: Re: UPDATE

    Originally posted by jmodic
    Gosh! Can you please run my update statement. It's not the same as yours, syntax is different and will not raise ORA-0093
    "Gosh"??

    Why Jurij, I've never seen you get so emotional

    - Chris
    Christopher R. Long
    ChrisRLong@HotMail.Com
    But that's just my opinion. I could be wrong

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