This is a discussion on Prepared Statment, Decimal(12,6) and Update Issue within the DB2 forums, part of the Database Server Software category; --> I am trying to update a column Decimal(12,6) in DB2 (7.1 fix pack 3 and tried it on 8.1) ...
| |||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| I am trying to update a column Decimal(12,6) in DB2 (7.1 fix pack 3 and tried it on 8.1) using prepared statement. When i do the update to that column e.g 12.499 using prepared statement, all that gets updated is 12.000000. That only happens when i do Update, insert works fine. any idea why? Thanks for help! |
| |||
| "farhan" <fshah01@hotmail.com> wrote in message news:81fe0b7a.0307200736.738c4b0b@posting.google.c om... > I am trying to update a column Decimal(12,6) in DB2 (7.1 fix pack 3 > and tried it on 8.1) using prepared statement. > > When i do the update to that column e.g 12.499 using prepared > statement, all that gets updated is 12.000000. That only happens > when i do Update, insert works fine. any idea why? > > Thanks for help! I would say there is probably something wrong with the host variable, but you need to post all those details for anyone to know for sure. |
| |||
| "Mark A" <ma@switchboard.net> wrote in message news:<s5ASa.388$Ks2.25863@news.uswest.net>... > "farhan" <fshah01@hotmail.com> wrote in message > news:81fe0b7a.0307200736.738c4b0b@posting.google.c om... > > I am trying to update a column Decimal(12,6) in DB2 (7.1 fix pack 3 > > and tried it on 8.1) using prepared statement. > > > > When i do the update to that column e.g 12.499 using prepared > > statement, all that gets updated is 12.000000. That only happens > > when i do Update, insert works fine. any idea why? > > > > Thanks for help! > > I would say there is probably something wrong with the host variable, but > you need to post all those details for anyone to know for sure. How will i do that? |
| |||
| > > > I am trying to update a column Decimal(12,6) in DB2 (7.1 fix pack 3 > > > and tried it on 8.1) using prepared statement. > > > > > > When i do the update to that column e.g 12.499 using prepared > > > statement, all that gets updated is 12.000000. That only happens > > > when i do Update, insert works fine. any idea why? > > > > > > Thanks for help! > > > > I would say there is probably something wrong with the host variable, but > > you need to post all those details for anyone to know for sure. > > How will i do that? Post the exact SQL statement (or statements). If this in embedded in a program, function, etc, post the details of the program code including definition of host variables. |
| |||
| farhan <fshah01@hotmail.com> wrote: > I am trying to update a column Decimal(12,6) in DB2 (7.1 fix pack 3 > and tried it on 8.1) using prepared statement. > > When i do the update to that column e.g 12.499 using prepared > statement, all that gets updated is 12.000000. That only happens > when i do Update, insert works fine. any idea why? What does the relevant code look like? In particular, how do you pass the 12.499 to DB2? -- Knut Stolze Information Integration IBM Germany / University of Jena |
| |||
| Knut Stolze <stolze@de.ibm.com> wrote in message news:<bfg8h7$hcb$5@fsuj29.rz.uni-jena.de>... > farhan <fshah01@hotmail.com> wrote: > > > I am trying to update a column Decimal(12,6) in DB2 (7.1 fix pack 3 > > and tried it on 8.1) using prepared statement. > > > > When i do the update to that column e.g 12.499 using prepared > > statement, all that gets updated is 12.000000. That only happens > > when i do Update, insert works fine. any idea why? > > What does the relevant code look like? In particular, how do you pass the > 12.499 to DB2? Following is prepared statement: SPF_ATB_ORD_APE_NO is Decimal(12,6) update ELMS.ELE SET SPF_ATB_ORD_APE_NO = ? WHERE ELE_ID=1234 I am passing 12.499 from Java application using jdbc drivers. I also tried ODBC drivers (mainly using Access Database with Link db2 table) if i do: update ELMS.ELE SET SPF_ATB_ORD_APE_NO =12.499 WHERE ELE_ID=1234, Updates works. So i am thinking i am losing some kind of formatting |
| ||||
| farhan <fshah01@hotmail.com> wrote: > Knut Stolze <stolze@de.ibm.com> wrote in message > news:<bfg8h7$hcb$5@fsuj29.rz.uni-jena.de>... >> farhan <fshah01@hotmail.com> wrote: >> >> > I am trying to update a column Decimal(12,6) in DB2 (7.1 fix pack 3 >> > and tried it on 8.1) using prepared statement. >> > >> > When i do the update to that column e.g 12.499 using prepared >> > statement, all that gets updated is 12.000000. That only happens >> > when i do Update, insert works fine. any idea why? >> >> What does the relevant code look like? In particular, how do you pass >> the 12.499 to DB2? > > Following is prepared statement: > > SPF_ATB_ORD_APE_NO is Decimal(12,6) > > update ELMS.ELE SET SPF_ATB_ORD_APE_NO = ? WHERE ELE_ID=1234 Ok, back to the first part of the question: how do you pass the 12.499 to DB2 when you execute the prepared statement? What does the code look like? -- Knut Stolze Information Integration IBM Germany / University of Jena |