It depends on the application. Say it makes a small number of queries like this then not a big deal. In my app where I used this technique, that was the case.
However, if an app makes 1000's of queries like this, then you are absolutely right... We'd both expect the prepare time goes through the roof. On the other hand if the database does not support a dynamic null checking feature, then a developer may be no choice. Lately, I've been working with an Informix, and have found no equivalent feature... but I'm not an Expert with Informix-isms at this point either. -----Original Message----- From: Reidy, Ron [mailto:[EMAIL PROTECTED] Sent: Friday, April 30, 2004 1:18 PM To: CAMPBELL, BRIAN D (BRIAN); [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: RE: Selecting a record froma table where a column might be null The OP's problem was specific to Oracle and as such, he should use the DB facilities that available. While on the surface, the below solution looks elegant, from an Oracle performance perspective, it is horrific. By building the SQL statement dynamically in this manner, statement reuse is almost assuredly eliminated. It is better (IMHO) to use the DB facilities available (in this case Oracle's NVL() or DECODE() functions) than to try to write something that will be portable across all RDBMSs. -
Brian Campbell.vcf
Description: Binary data
