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: SQLT_CHR and null-values in OCI

Re: SQLT_CHR and null-values in OCI

From: Amit <jindal_at_roguewave.com>
Date: Tue, 2 Sep 2003 15:49:04 -0600
Message-ID: <bj36j8$vi8$1@tux.cvo.roguewave.com>


Actually its more than that.

SQLT_CHR    -  N character string for VARCHAR2
SQLT_STR     -  N+1 character NULL terminated string for VARCHAR2
SQLT_AFC    -  N character string for CHAR columns (so it enforces N
characters)
SQLT_AVC - N+1 character string for CHAR columns with NULL termination. (again, it enforces N characters).

You may find that trailing spaces are truncated when you use SQLT_CHR or SQLT_STR. So if you only have spaces in your string, boom they are gone. By using SQLT_AFC you are forcing the driver/server to say that this string is 'N' characters long and DO NOT truncate it. ;-)

Oracle defines empty string to be equal to NULL. However you may find other databases have even weird behavior.
For e.g. I think Sybase has empty string as 1 byte space character and NULL is not same as empty string.

HTH,



Amit Jindal, Development Engineer

Want ease of development or performance? Why not get both! http://www.roguewave.com/products/sourcepro/db/

[Disclaimer: All views expressed here are my personal views

             and they can be incorrect at times]


"Tommi Mäkitalo" <t.maekitalo_at_epgmbh.de> wrote in message news:ubvuib.4te.ln_at_192.168.31.31...
> Amit wrote:
>
> > Try using SQLT_AFC.
> >
> >
> Yes - that worked.
>
> The difference between SQLT_CHR and SQLT_AFC seems to be, that SQLT_AFC
> works and SQLT_CHR not, isn't it?
> Does the same difference apply to SQLT_STR and SQLT_AVC?
>
> Tommi Mäkitalo
Received on Tue Sep 02 2003 - 16:49:04 CDT

Original text of this message

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