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: Use of varchar2 - please help!

Re: Use of varchar2 - please help!

From: <shiling_at_math.wayne.edu>
Date: Tue, 15 Jun 1999 12:28:40 GMT
Message-ID: <7k5gtg$knu$1@nnrp1.deja.com>


One possible reason is that the variables are defined as char in your table. When you compare varchar2 with char, you may have trouble without use rtrim function.

To see this,

SQL> desc t1

 Name                            Null?    Type
 ------------------------------- -------- ----
 UNAME                                    VARCHAR2(15)
 USERNAME                                 CHAR(20)

SQL> select * from t1;

UNAME USERNAME
--------------- --------------------

john john

SQL> select * from t1
  2 where uname=username;

no rows selected

SQL> select * from t1
  2 where uname=rtrim((username));

UNAME USERNAME
--------------- --------------------

john john

SQL> select * from t1
  2 where username='john';

UNAME USERNAME
--------------- --------------------

john john

SQL> select * from t1
  2 where uname='john';

UNAME USERNAME
--------------- --------------------

john john

Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't. Received on Tue Jun 15 1999 - 07:28:40 CDT

Original text of this message

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