db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Frank Rivera <frank.riv...@HoudiniESQ.com>
Subject How best to handle null in cast of column subquery
Date Wed, 12 Feb 2014 15:38:18 GMT
How best to handle null in cast of column subquery?
There are five records each with data in every column but when we run this statement below
only some of the columns are returned. 
If we remove the cast statement then all columns are returned. The Age column is null in the
records not being returned.

Embedded Derby 10.1.1

SELECT 
( SELECT 
first_name ||'|'||
last_name ||'|'||
GENDER ||'|'||
CAST(AGE AS varchar(3)) ||'|'||
MARITAL_STATUS
FROM esq.contact WHERE esq.contact.guid=esq.contact_list.contact_guid) AS "name"
FROM esq.contact_list WHERE esq.contact_list.link_table='mat' AND esq.contact_list.link_guid=78360;

println to Apache Tomcat Log 


  Record: 1
   name: 			Jane | Doe | F | 46 | Married 

  Record: 2
   name: 			

  Record: 3
   name: 

  Record: 4
   name: 

  Record: 5
   name: 


Sincerely,

 	 - Frank
	
Mime
View raw message