Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: CASE expression
April wrote:
> As part of a somewhat simple SELECT statement, I am attempting the case
> expression below on an Oracle server and am getting an Oracle error
> stating "Error signaled in parallel query server. Invalid number".
> Here's the expression:
>
> CASE
> WHEN VARIABLE_A = 'R' THEN 0
> WHEN VARIABLE_A = 'C' THEN
> NVL(NUMBER_1,0)+NVL(NUMBER_2,0)
> END AS TOTAL
>
>
> The idea is I only want to sum numbers 1 and 2 when variable A = 'C'.
> If its 'R' then I want TOTAL to be 0. Am I missing something?
If you replace the CASE statement above with this equivalent DECODE statement, do you receive the same error message? DECODE(VARIABLE_A, 'C', (NVL(NUMBER_1,0)+NVL(NUMBER_2,0)), 0) TOTAL If the above produces the same error, describe the table to make certain that you are comparing numbers to numbers, and VARCHAR2 (CHAR) to string constants. If your table is named MY_TABLE, then the following should describe the table in SQL*Plus: DESC MY_TABLE VARIABLE_A should be listed as a VARCHAR2 (or CHAR), NUMBER_1 and NUMBER_2 should be listed as a NUMBER.
Charles Hooper
PC Support Specialist
K&M Machine-Fabricating, Inc.
Received on Tue Dec 05 2006 - 19:41:49 CST