Re: varchar2 behaviour

From: N Prabhakar <prabhs_at_po.pacific.net.sg>
Date: 1996/11/16
Message-ID: <56j4od$d0m_at_newton.pacific.net.sg>#1/1


Werner Menges <wernerm_at_hpbbn.bbn.hp.com> wrote:
>Hello erverybody,
>
> I want to insert or update an emtpy string into a column defined
> as varchar2(n) ( Oracle 7.1.6 or 7.2.3 ).
> If there is no NOT NULL constraint then it works fine (insert/update)
> but if I execute a query the db returns a null value for this column.
>
> In our application we have to distinguish between null and ''
> therefore I should have a solution to get back an empty string.
>
> We use the C-interface from Oracle ( Pro*C/C++ 2.1 ).
>
> Regards
>
> Werner
> wernerm_at_hpbbn.bbn.hp.com

Hi there,

To my knowledge, the VARCHAR2 datatype does not entertain trailing blanks in a string. Ie. if you have a value "employee name ", varchar2 datatype stores as "employee name".

To avoid this, you can change the datatype of the field as CHAR.

I hope the CHAR datatype can differentiate between NULL and BLANKS.

Try this solution in a temporary table and if it works please let me know.

Regards

N.Prabhakar Received on Sat Nov 16 1996 - 00:00:00 CET

Original text of this message