Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2003
    Posts
    12

    Question Unanswered: Using a float variable in SQL statement problem

    HI,

    I am having problems getting a row returned when using a variable defined as a float in a SQL statement. This is SQL embedded in C.

    I have variable defined as:

    float fTotalCharge

    The column in the Oracle table I'm trying to get a hit on is defined as Number 18,2.

    The SQL has a line in the where statement like:

    Select Blah blah
    From Blah blah
    WHERE blah blah and
    ORACLETABLE.Cost = :fTotalCharge;

    Cost has a value of 100.25 stored and a printf of fTotalCharge returns 100.250000.

    This one line in the where clause causes the row not to return. IF I hardcode it as ORACLETABLE.Cost = 100.25 or ORACLECOST.Cost = 100.250000 the row returns fine.

    Does anyone know why using the variable is causing me problems? Thanks for any help.

  2. #2
    Join Date
    Oct 2004
    Posts
    145
    I believe this is precision of c program or os.

    If possible try ROUND(:fTotalCharge,2) in your code.

Posting Permissions

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