This content has been marked as final. Show 5 replies
SELECT CAST(COUNT(*) AS NUMBER(8,0)) AS CNT FROM tablename
Thanks, I will try it.
However, I'm looking for a solution in the client configuration so I don't have to change the > 100 different occurrences within my application where I use SELECT COUNT.
Plus using NUMBER(8,0) or NUMBER(12,0) is specific to Oracle, and since I have an ODBC Interface, which doesn't have code for specific backend database types, using that on SQL Server won't work. This would mean specific checks throughout the code for each database type that requires a different SELECT COUNT statement.
Edited by: wehnerr on Sep 7, 2012 3:00 PM
That change made it work, but I fear making the change over 100 times in my code to be specific to Oracle client or anything else.
I still hope there is an Oracle Client Configuration change that would help this, or perhaps something programmatic that I can set once ODBC Environment is acquired, that would force the ODBC SQL AGGREGATE function COUNT to return LONG (4-byte integer) rather than whatever else it is defaulting to.
Thanks for the suggestion.
Edited by: wehnerr on Sep 7, 2012 11:58 AM
That's alot if counting!!!
If these count values are something you can store in a LOOKUP table and refresh on a schedule, like each night or whatever,
then you can likely reduce front end code overburden by having one routine to fetch the row counts for a given table.
Understood. These 'COUNT' routines do it on various tables. It is a database with over 250 tables, and counts are intentionally dynamic and have very little consequence in the overall scheme of the user experience.
Can anyone help me with this?
There MUST be a method in the Oracle Client API that allows a setting to return all of these calls as LONG like they used to do.
RE: MAX, MIN, COUNT etc. when performed on a Long Integer / Number(10) column. I understand doing this on a Double would produce a double.