Re: OCI Functions for C

From: Scott Urman <surman_at_dlsun338.us.oracle.com>
Date: 1996/10/09
Message-ID: <53gt9d$nd6_at_inet-nntp-gw-1.us.oracle.com>#1/1


In article <01bbb5cd$7e4b2e40$3c4c5ac0_at_thierry.citb.bull.net>, "Thierry Merlin" <T.Merlin_at_citb.bull.net> writes:
|>
|> Hi,
|>
|> I have a query like this :
|> "SELECT ename FROM emp";
|> I use ofen( ) to fetch one or multiple rows but I don't know the length of
|> string returned.
|> How I can obtain this information, in which OCI functions ?
|> Example :
|> Column ename (dbsize=10).
|> When I fetch, data='SMITH '
|> How I can obtain length=5 ?

It depends on the datatype you use in your odefin() call. In this case, I bet you are using type 96 (CHAR) which will blank pad the output. I recomend using type 5 (STRING). This way you will get null-terminated data. Be sure to allocate an extra byte for the null in your output buffer, and include this byte in the length you pass in odefin(). In your example, you would want a buffer size of 11 and the returned data would be 'SMITH\0 '.

|> ============================================
|> Thierry Merlin Tel: 56.43.78.86
|> CITB BULL Fax: 56.43.79.78
|> 207 cours du Medoc E-mail :T.Merlin_at_citb.bull.net
|> 33000 BORDEAUX TATOO: 04.23.29.72
|> ============================================



Scott Urman Oracle Corporation surman_at_us.oracle.com

Author of _Oracle PL/SQL Programming_ ISBN 0-07-882176-2 Published by Oracle Press - http://www.osborne.com/oracle/index.htm

"The opinions expressed here are my own, and are not necessarily that of  Oracle Corporation"
Received on Wed Oct 09 1996 - 00:00:00 CEST

Original text of this message