PHP datatype vs Oracle Varchar2
| From: | Victoria Zhou | Date: | Thu, 26 Jul 2001 22:08:42 +0000 |
| Subject: | PHP datatype vs Oracle Varchar2 | ||
| Groups: | php.install | ||
| Request: | Send a blank email to php-install+get-3717@lists.php.net to get a copy of this message | ||
Hi,
The comparison between Oracle VARCHAR2 and a PHP string doesn't seems to
work. Detail as follows:
I have one PHP variable and one Oracle column:
. $form_user_id: a PHP string obtained from web form input, such as 'user1'.
. Username: an oracle table column of type VARCHAR2(20).
The following sql statement failed:
"select * from mytable where Username='$form_user_id'"
It failed because Username has a strlen of 20, where $form_user_id has a
strlen of 5. If I changed the Username from VARCHAR2(20) to CHAR(20), then
this sql worked fine. But I think with Oracle VARCHAR2, the strlen of
Username in this case should be 5 instead of 20.
Victoria Zhou