From: | Hiroshi Inoue <Inoue(at)tpf(dot)co(dot)jp> |
---|---|
To: | Keith Gray <keith(at)heart(dot)com(dot)au> |
Cc: | ODBC <pgsql-odbc(at)postgresql(dot)org> |
Subject: | Re: BUG - possible UPDATE bug in multi-record? |
Date: | 2001-10-18 06:07:32 |
Message-ID: | 3BCE71A4.7863BB4C@tpf.co.jp |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-odbc |
Keith Gray wrote:
>
> Using this style of command through an SQL tool it
> decrements each row in the list by 1 cent.
>
> UPDATE GeneralLedger
> SET CBalPer0 = CBalPer0 + (-0.01),
> PBalPer0 = PBalPer0 + (-0.01)
> WHERE AccountSequence IN (56,54,3,2)
>
> (I only use the brackets to handle sign of amount
> as in next example)
>
> Trying to execute it through ODBC...
Please start the postmaster with -d option and
see what queries are issued at backend ?
>
> Amount = -0.01
> AccountSequence = "(56,54,3,2)"
Isn't it * AccountSequenceList = "(56,54,3,2)" * ?
regards,
Hiroshi Inoue
> SQL= "UPDATE GeneralLedger " & _
> "SET CBalPer0 = CBalPer0 + (" & Amount & "), " & _
> "PBalPer0 = PBalPer0 + (" & Amount & ") " & _
> "WHERE AccountSequence IN " & AccountSequenceList
>
> myConnection.Execute(SQL)
>
> ...causes movements in other accounts and incorrect balances!
>
> I am trying with 2 separate UPDATE statements...
>
> SQL= "UPDATE GeneralLedger " & _
> "SET CBalPer0 = CBalPer0 + (" & Amount & "), " & _
> "WHERE AccountSequence IN " & AccountSequenceList
>
> myConnection.Execute(SQL)
>
> SQL= "UPDATE GeneralLedger " & _
> "SET PBalPer0 = PBalPer0 + (" & Amount & ") " & _
> "WHERE AccountSequence IN " & AccountSequenceList
>
> myConnection.Execute(SQL)
>
> ...and yes this does work.
>
> --
> Keith Gray
From | Date | Subject | |
---|---|---|---|
Next Message | Raymond Leung | 2001-10-18 11:30:53 | Support for Special Big5 double-byte characters |
Previous Message | Fábio Sato | 2001-10-18 05:53:52 | ODBC Performance |