Unix Technical Forum

extracting value of select(count) in the API

This is a discussion on extracting value of select(count) in the API within the Informix forums, part of the Database Server Software category; --> Hi, I'm trying to access the value of select(count) in an API program, passing this query to mi_exec. It's ...


Go Back   Unix Technical Forum > Database Server Software > Informix

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-19-2008, 09:01 PM
Steven Kurlander
 
Posts: n/a
Default extracting value of select(count) in the API

Hi,

I'm trying to access the value of select(count) in an API program,
passing this query to mi_exec. It's not an integer, as I retrieve the
wrong value. Its type may be a varchar but converting the varchar to
a string doesn't seem to print the correct value.

Thanks,
Steven
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-19-2008, 09:01 PM
Paul Watson
 
Posts: n/a
Default Re: extracting value of select(count) in the API

what version of the engine/sdk etc???
I'd guess it's returning a decimal/float of some description try casting
it to an int in the sql


Steven Kurlander wrote:
>
> Hi,
>
> I'm trying to access the value of select(count) in an API program,
> passing this query to mi_exec. It's not an integer, as I retrieve the
> wrong value. Its type may be a varchar but converting the varchar to
> a string doesn't seem to print the correct value.
>
> Thanks,
> Steven


--
Paul Watson #
Oninit Ltd # Growing old is mandatory
Tel: +44 1436 672201 # Growing up is optional
Fax: +44 1436 678693 #
Mob: +44 7818 003457 #
www.oninit.com #
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-19-2008, 09:02 PM
Art S. Kagel
 
Posts: n/a
Default Re: extracting value of select(count) in the API

On Fri, 23 Jan 2004 08:58:24 -0500, Steven Kurlander wrote:

> Hi,
>
> I'm trying to access the value of select(count) in an API program, passing
> this query to mi_exec. It's not an integer, as I retrieve the wrong value.
> Its type may be a varchar but converting the varchar to a string doesn't
> seem to print the correct value.

Steven,

All versions of IDS beginning with 6.0 return DECIMAL type for numeric
aggregates, that is the problem. If you BIND the column to an integer host
variable the engine SHOULD make the conversion automatically assuming the
value does not overflow since DECIMAL supports up to 32digits and INTEGER only
9.2 digits (ie not quite 10) of decimal precision. If you must have a 'C'
datatype and integer is too small you can use double to get up to 15+ digits.

You do not specify, but if you are using IDS 9.xx you can use explicit
conversions (not supported in 7.xx) in your SELECT also:

SELECT COUNT(*) :: INT
FROM ...

Art S. Kagel
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 09:07 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com