Results 1 to 15 of 15
  1. #1
    Join Date
    May 2003
    Posts
    28

    Unanswered: cannot insert zero in to numeric field

    hi all
    i am usig postgres with VB (ADO using ODBC). when i try to update a numeric field in a table with zero an error occurs "ERROR: Bad numeric input format '.' " . this happends when i call recordset.update() after assigning 0 to the field. a sample is given bellow

    rs!Opening=0
    rs.Update

    this code works fine if we assign any value other than zero to the field.is there a solution. or is it a bug?

    pls help

    thanks

  2. #2
    Join Date
    Apr 2003
    Location
    Tunisia
    Posts
    192

    Wink Null

    You could make it with a NULL wich is a cool 0
    Open up
    Take a look to my Blog http://www.rundom.com/karim2k

  3. #3
    Join Date
    Sep 2001
    Location
    Vienna
    Posts
    400

    numeric fields

    what version?

    what exactly do you insert 0, 0.0 ???

    is there maybe a constraint running on the field?
    http://www.postgresql.org
    --Postgresql is the only kind of thing--

  4. #4
    Join Date
    Apr 2003
    Location
    Tunisia
    Posts
    192

    Thumbs up Hope..

    Hope that it's just a really numeric field (char my life)
    Open up
    Take a look to my Blog http://www.rundom.com/karim2k

  5. #5
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    i don't have the answer for Jinujose (sorry)

    i just wanted to point out to karim2k that null and 0 are not the same thing at all


    rudy

  6. #6
    Join Date
    Apr 2003
    Location
    Tunisia
    Posts
    192

    Thumbs up WOW

    Hey man got further explanations about the Null 0 ??
    Open up
    Take a look to my Blog http://www.rundom.com/karim2k

  7. #7
    Join Date
    Sep 2001
    Location
    Vienna
    Posts
    400

    NULL - 0

    0 >1 and 0 < -1

    and NULL is nothing
    http://www.postgresql.org
    --Postgresql is the only kind of thing--

  8. #8
    Join Date
    Apr 2003
    Location
    Tunisia
    Posts
    192

    Thumbs up Ok

    Got it , thank u , Danke Schon !
    Open up
    Take a look to my Blog http://www.rundom.com/karim2k

  9. #9
    Join Date
    May 2003
    Posts
    28
    thanks all
    but i don't got the solution. the field cannot be null. it is a non nullable field and i need the value zero. in the query log the value in the corresponding position is displayed as "." not as zero(0). any one to help. i am using postgres 7.2 and the latest ODBC driver.

    jinujose
    Last edited by Jinujose; 05-23-03 at 00:19.

  10. #10
    Join Date
    Apr 2003
    Location
    Tunisia
    Posts
    192

    Smile Wow

    I found an article talking about NULL , that could help you :
    http://www.varlena.com/GeneralBits/14.html if you found a solution tell me please.
    Open up
    Take a look to my Blog http://www.rundom.com/karim2k

  11. #11
    Join Date
    Sep 2001
    Location
    Vienna
    Posts
    400

    information needed

    enable in postgresql.conf that postgres logs the queries
    and then lokk into the log
    what the odbc-driver does insert into the dbserver

    then copy this statement and try it with psql db -c "query"

    now you can see whether the odbc has the problem or the server itlself

    may update your odgbc-driver
    there is a new one available
    http://www.postgresql.org
    --Postgresql is the only kind of thing--

  12. #12
    Join Date
    May 2003
    Posts
    28
    i already check the query log and find that it is listed as
    Update Trans set opening=.
    the actual query should be
    Update Trans set opening=0
    (value in the corresponding position is displayed as "." not as zero(0).)
    i am using the latest availabe ODBC driver. i did not get a solution from the NULL article.
    the problem occurs only if i use recordset.update from VB

    pls help

  13. #13
    Join Date
    Apr 2003
    Location
    Tunisia
    Posts
    192

    Arrow Wow

    You may be able to insert 0 as string '0', or to get the numeric value of that string ...
    Open up
    Take a look to my Blog http://www.rundom.com/karim2k

  14. #14
    Join Date
    May 2003
    Posts
    28

    Smile

    hope all r fine...
    i tried all the solutions here. but the problem still exist. the problem is of ODBC and it is still there in the latest version. but this error is not in the ODBC plus driver. i think it is a bug in ODBC.

    any one to help

  15. #15
    Join Date
    Nov 2003
    Posts
    1

    Talking

    Originally posted by Jinujose
    hope all r fine...
    i tried all the solutions here. but the problem still exist. the problem is of ODBC and it is still there in the latest version. but this error is not in the ODBC plus driver. i think it is a bug in ODBC.

    any one to help

Posting Permissions

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