CodeCharge Studio
search Register Login  

Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> Archive -> GotoCode Archive

 IBM/DB2 doesn't understand "field=null" notation

Print topic Send  topic

Author Message
Gianni
Posted: 08/23/2002, 2:06 AM

I sadly discovered this converting my database from MySQL to IBM/DB2.

For instance, take this query string, generated by CC (stored in the sWhere variable of the jsp source):
select *
from TBLDIDASCALIE
where NR='06'
and INGUSC=Null
and CARREGGIATA=Null
and SEQUENZA=Null

(NR is a CHAR field)

MySQL executes the query correctly, while DB2 raises the error "The data types of the operands for the operation "=" are not compatible".

Infact it appears to me that the notation "field=null" isn't standard, when "field IS NULL" is.

I hope that this problem will be corrected in future releases of CC.
In the meantime, any help will be appreciated.

I'm using CC 2.0.5, with JSP 1.1+templates.

Thanks for your suggestions.

Gianni
Nicole
Posted: 08/23/2002, 4:27 AM

Gianni,
you should use custom replace code in form Open event in order to insert "is null" instead "= null" into sWhere variable.
Thomas
Posted: 08/26/2002, 6:50 AM

My solution -
Compile this Java class:

public final class UString
{
public static String replace ( String myStr, String myTok, String mySub )
{
if (myStr.indexOf(myTok) == -1) return myStr ;
int start = 0 ;
int offset = 0 ;
StringBuffer sb = new StringBuffer() ;
while (myStr.indexOf(myTok, start) != -1)
{
offset = myStr.indexOf(myTok, start) ;
sb.append (myStr.substring(start, offset) ) ;
sb.append (mySub) ;
start = offset + myTok.length() ;
}
return sb.toString() ;
}
}


In "custom includes" add:
<%@ page import="UString" %>
In form "open event" add:
sWhere = UString.replace (sWhere, "=Null", " IS NULL") ;

Et voila, les jeux sont faites!
This is a workaround hoping that YES SOFTWARE will fix this BUG implementing STRICT SQL STANDARD.
Salut!

   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Web Database

Join thousands of Web developers who build Web applications with minimal coding.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.