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: Pro*C 2.0 "char" bug

Re: Pro*C 2.0 "char" bug

From: Ken Denny <kdenny_at_interpath.com>
Date: 1997/06/06
Message-ID: <3398079A.3BF@interpath.com>#1/1

Rick Wiggins wrote:
>
> We've noticed an erroneous behavior with Pro*C 2.0 that doesn't seem to
> be present in versions 1.6 or 2.2. In version 2.0, if a CHAR(1)
> database column is SELECTed into a "plain old char" variable that's not
> an array (e.g. char one_char_var;), no error occurs, but the variable's
> contents ARE NOT REPLACED with what was (supposedly) pulled from the
> database! In version 1.6 and 2.2 things seem to work as expected; the
> character from the database ends up in the variable in the C program.

I experienced a similar problem when I went from 1.6 to 2.0. I was constructing a string in some PL/SQL code in a Pro*C program and trying to concatenate newline characters into the string.

EXEC SQL BEGIN DECLARE SECTION;
char newline = '\n';
. . .
EXEC SQL END DECLARE SECTION;
. . .
EXEC SQL EXECUTE
BEGIN
   :stringvar := :stringvar || :newline; END;
END-EXEC; The newline character was not being appended to the string. To get it to work I had to change the definition of newline:

char newline[2] ="\n";
EXEC SQL VAR newline IS STRING;

I hope this helps
Ken Denny
kdenny_at_interpath.com

> +================+========================================+
> | Rick Wiggins | Phone: (910)279-2270 |
> | Lead Developer | FAX: (910)697-8021 |
> | AT&T HRISO | Internet: mailto:rickwiggins_at_att.com |
> | Greensboro, NC | CompuServe: rick_wiggins |
> +================+========================================+
Received on Fri Jun 06 1997 - 00:00:00 CDT

Original text of this message

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