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 -> Checking for empty string in a query

Checking for empty string in a query

From: D. Alvarado <laredotornado_at_zipmail.com>
Date: 23 Mar 2004 11:34:33 -0800
Message-ID: <9fe1f2ad.0403231134.2aa9725c@posting.google.com>


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

Original text of this message

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