Unix Technical Forum

Prepared Statment, Decimal(12,6) and Update Issue

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) ...


Go Back   Unix Technical Forum > Database Server Software > DB2

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-26-2008, 10:01 AM
farhan
 
Posts: n/a
Default Prepared Statment, Decimal(12,6) and Update Issue

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!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-26-2008, 10:01 AM
Mark A
 
Posts: n/a
Default Re: Prepared Statment, Decimal(12,6) and Update Issue

"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.


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-26-2008, 10:01 AM
farhan
 
Posts: n/a
Default Re: Prepared Statment, Decimal(12,6) and Update Issue

"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?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 02-26-2008, 10:01 AM
Mark A
 
Posts: n/a
Default Re: Prepared Statment, Decimal(12,6) and Update Issue

> > > 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.


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 02-26-2008, 10:02 AM
Knut Stolze
 
Posts: n/a
Default Re: Prepared Statment, Decimal(12,6) and Update Issue

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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 02-26-2008, 10:02 AM
farhan
 
Posts: n/a
Default Re: Prepared Statment, Decimal(12,6) and Update Issue

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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 02-26-2008, 10:02 AM
Knut Stolze
 
Posts: n/a
Default Re: Prepared Statment, Decimal(12,6) and Update Issue

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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 09:13 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com