Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: How to get count using OCI?

Re: How to get count using OCI?

From: Joerg Lanzinger <lanzinge_at_in.tum.de>
Date: Fri, 16 Jul 1999 13:02:40 +0200
Message-ID: <378F1150.40F5ABC5@in.tum.de>


Hello,

with OCIExecute, the first fetch is always implicit. Integer (SQLT_INT) should be ok for reasonable results.

Hth
  Joerg

Tee Parham wrote:
>
> I am using OCI 7 on a 7.3.4 server. I can't figure out the best way to
> simply get a count of the number of rows in a table-- all I want to do
> is duplicate the "select count(*) from table_x" sql string.
>
> What I am currently doing looks like this:
>
> 1. Parse the SQL statement "select count(*) from table_x"
> 2. Define an output variable by position (1). I have tried numeric,
> float, & character.
> 3. Execute
> 4. Fetch 1 row
>
> All of this works without an error, but the output variable I have
> defined does not contain the correct data-- it looks like the first 4
> bytes are '' and the rest contain junk. It looks like the rpc of the
> cursor is 1, so I would think the fetch worked.
>
> What data type should I use for the define variable? Any other ideas?
>
> -tee
>
> <<<remove the underscores (_) to reply to my email address>>>
Received on Fri Jul 16 1999 - 06:02:40 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US