Re: Oracle Precompilers and Nulls

From: Tim Woodward <twood_at_windward>
Date: 4 Sep 92 14:32:46 GMT
Message-ID: <1992Sep4.143246.9870_at_advtech.uswest.com>


In article <Bu0zGv.941_at_mentor.cc.purdue.edu> coghawks_at_mentor.cc.purdue.edu (john) writes:
>I recently happened into a problem using Pro-C with embedded SQL with
>Nulls and comparison differences between = and IS (NOT) NULL.
>It was when I had built a cursor which selected into a host variable,
>which was then used as part of a selection criteria on the next
>SQL statement. What occured was that when using the where clause
>for ex. WHERE EMPD.DESCRIPT = :host_emp, if either value was null
>then this never would return true or if they both were null
>it still wouldn't be true. So either I had to have 2 versions and check
>explicitly if and when things were NULL before I use them in a WHERE
>clause, or set them to a default value. Which in oracle is syntactily
>supported, but not implemented when declaring a table. Another problem
>with setting things to a default value is then building indexes etc..
>those values are all grouped. I am new at this and am looking forward
>to any replies.
>
>Thank you
>John Hawkins.
>

	Use indicator variables to test for NULLS. 
	Ex: WHERE (EMPD.DESCRIPT = :host_emp) OR ((EMPD.DESCRIPT is NULL)
		AND (:host_emp:ind_host_emp IS NULL));
		

 See Testing for NULLS in the MANUAL.

 Tim Woodward Received on Fri Sep 04 1992 - 16:32:46 CEST

Original text of this message