Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Checking for empty string in a query
I'm running Oracle 8.1.7 for Solaris.
I'm having a problem with NULL and empty string equivalence. Here are some rows from my table:
SITE ACCESS_TYPE ---- ----------- NULL 3 webstats 4 temp 3
but if I run the following query, I get no result:
SELECT * FROM A WHERE SITE = '' however if I run
SELECT * FROM A WHERE SITE IS NULL I get the proper row. The problem is, I would like to have a single statement for my JDBC call. Right now, that statement is
SELECT * FROM A WHERE SITE = ? but because of the first reason I mentioned, this doesn't work when the "?" is an empty string. Other than creating an "if-else" conditional, is there any single query I can write that will encompass all possible values for SITE? Thanks - Dave Received on Tue Mar 23 2004 - 13:34:33 CST
![]() |
![]() |