× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Unfortunately that confuses a CASE statement with a CASE expression. The former is a /SQL control statement/ whereas the latter is an expression that effectively evaluates to a scalar value based upon WHEN predicates; i.e. the CASE expression is an effective arithmetic expression or string expression, according to the type of data into which the expression evaluates.

http://pic.dhe.ibm.com/infocenter/iseries/v7r1m0/topic/db2/rbafzcasestmt.htm
IBM i 7.1 Information Center -> Database -> Reference -> SQL reference -> SQL control statements
_i CASE statement i_
"The CASE statement selects an execution path based on multiple conditions.
..."

http://pic.dhe.ibm.com/infocenter/iseries/v7r1m0/topic/db2/rbafzcaseexp.htm
IBM i 7.1 Information Center > Database > Reference > SQL reference > Language elements > Expressions
_i CASE expression i_
"CASE expressions allow an expression to be selected based on the evaluation of one or more conditions.
..."

Regards, Chuck

On 17 Apr 2013 06:28, Michael Schutte wrote:
You can use NULL.

From SQL Reference manual.

"CASE expressions allow an expression to be selected based on the
evaluation of one or more conditions. In general, the value of the
case-expression is the value of the result-expression following the
first (leftmost) when-clause that evaluates to true. If no
when-clause evaluates to true and the ELSE keyword is present then
the result is the value of the ELSE result-expression or NULL. If no
when-clause evaluates to true and the ELSE keyword is not present
then the result is NULL. Note that when a when-clause evaluates to
unknown (because of nulls), the when-clause is not true and hence is
treated the same way as a when-clause that evaluates to false."

On Wed, Apr 17, 2013 at 9:01 AM, Vernon Hamberg wrote:

Thanks for this - I didn't think I could use NULL - it is not
documented as a statement that I could find, while it is in Oracle
and maybe other RDBMS.

On 4/17/2013 7:45 AM, Michael Schutte wrote:
Vern if you are using DECLARE GLOBAL. Then put a WITH REPLACE at
the end to replace the existing table.

Also for the else. I using put ELSE NULL


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.