1 Reply Latest reply on Sep 5, 2012 4:49 PM by 960196

    select count(*) returns double?

      I have executed a 'select count(*) from ...' statement through ODBC against Oracle9i and I am very supprised that the returned ODBC type is a 'double' and not an 'int' (or a 'numeric').

      Is this really correct?
        • 1. Re: select count(*) returns double?
          Did you ever get a response or figure this out?
          My problem is fairly simliar, but specific to an and onward release of the Oracle Client.
          Current C++ Application using ODBC API calling Oracle Client 10g (all versions), 11gR1 (v11.1.0.6) returns a LONG (4-byte integer) for "SELECT COUNT(*) from tablename"

          Change Oracle client to 11gR1 (v11.1.0.7) or higher (11.2.x.y etc) and that same statement returns a DOUBLE (8-byte floating value equivalent to oracle NUMBER data type).

          Since the backend DB is the same version, there must be a client side setting (I presume) that has changed the default behaviour of this Aggregate SQL function to return a double rather than a long. I'm hoping to find such a setting that I can either set programmatically through an ODBC API call, or in the Oracle Client configuration itself.

          I even tried using SQL CAST to make it an INT SELECT CAST(COUNT(*) AS INT) FROM tablename but that still returns a DOUBLE (8-byte floating NUMBER).

          Note: given that I use ODBC, I've written alot of generic C++ code supporting the return value as LONG, as that is how it's been for 10 years via ODBC. I'd like to maintain that if possible without having to write ORACLE specific code within my applications.