Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2009

    Unanswered: sum aggregated field divided by 100 when inserted into temp table


    I have been working for the last two hours trying to figure out why this was happening in Pervasive 8.

    table employee (simplified table)

    ID salary
    A 100
    A 100
    A 100

    simplified version of stored procedure

    my stored proc:

    select ID, sum(salary) Total from
    group by ID

    The resultset from this stored proc returns:

    ID Total
    A 300

    However, if I take this simplified stored proc and insert the results of that into a temp table before displaying,
    it provides a resultset divided by exactly 100.

    stored proc that divides by 100 incorrectly:

    select ID, sum(salary) Total
    into "#table1"
    from employee
    group by ID

    select ID, TOTAL from "#table1"

    Resultset is as follows:

    ID Total
    A 3.00

    The example I'm providing is absolutely simplified and the stored proc actually does a lot more. But if I take the results and insert into a temp table before displaying the temp table contents, the results are always divided by 100.

    has anyone else seen this problem?

  2. #2
    Join Date
    Dec 2001
    Provided Answers: 4
    I've not heard of this behavior. What version of V8 are you using? Also, what tool are you using (PCC, ODBC Test, etc)? Do you see the behavior using ODBC Test? WHat's the data type of "salary"?
    Mirtheil Software
    Certified Pervasive Developer
    Certified Pervasive Technician
    Custom Btrieve/VB development
    I do not answer questions by email. Please post on the forum.

  3. #3
    Join Date
    Dec 2009
    I have seen this with some data types. Try patching to PSQLV8.7 (a free update) to see if that takes care of it. Be sure to patch both the client AND the server.

    Another thing to try is cCASTing the value to an INTEGER first, which should eliminate the decimal point placement issue.

Posting Permissions

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