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

Home -> Community -> Usenet -> c.d.o.server -> Re: ProC fills varchar2 with blanks ???

Re: ProC fills varchar2 with blanks ???

From: John Strange <jstrange_at_imtn.dsccc.com>
Date: 1997/06/27
Message-ID: <5p0a2n$b29@camelot.dsccc.com>#1/1

Yes, you get the feature, but, you are supposed to use the length value to locate the end of the string.

try
EXEC SQL BEGIN DECLARE SECTION ;
        static varchar junk [128] ;
EXEC SQL END DECLARE SECTION ;         exc sql fetch whatever into :junk ;

        junk.arr[junk.len] = '\0' ; /* set C text terminator */

        fprintf (stdout, "-%s-\n", (char *)junk.arr) ;

and you will see -Bas- (no trailing spaces)

Bas Ven (ven_at_ats.nld.alcatel.nl) wrote:
: I declared a column as follows:
: name varchar2(128)
: and added a name to it : 'Bas'.
 

: When I get into sqlplus and retrieve the value of this column
: it displays is correctly -Bas- (no trailing spaces).
 

: When I fetch the same column using ProC, my C variable
: (declared as char name[128], initialized with:
: for (i=0;i<128;i++) name[i]=0; ) is filled with trailing spaces!
 

: Is this a ProC 'feature' or is it possible to tell ProC not to do
: this by setting some variable ?
: --
: -----------------------------------------------------------------
: J.B. Ven | Alcatel Telecom Nederland
: Phone: +31 (70) 3079130 | P.O. Box 3292
: Fax: +31 (70) 3079191 | NL-2280 GG Rijswijk
: Work: mailto:ven_at_ats.nld.alcatel.nl | The Netherlands
: Home: mailto:basven_at_xs4all.nl |
: -----------------------------------------------------------------

--
This posting represents the personal opinions of the author. It is not the
official opinion or policy of the author's employer. Warranty expired when you
opened this article and I will not be responsible for its contents or use.
Received on Fri Jun 27 1997 - 00:00:00 CDT

Original text of this message

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