Re: [GENERAL] Referencing function value inside CASE..WHEN

2011-06-19 Thread F. BROUARD / SQLpro
Hi Le 19/06/2011 04:27, lover boi a écrit : > SELECT >MY_FUNCTION(...) AS my_function, >CASE WHEN my_function = '...' THEN '...' ELSE '...' END > ... > ... WITH T AS (SELECT MY_FUNCTION(...) AS my_function, ... ) SELECT CASE WHEN my_function = '...' THEN '...' ELSE '...' END ... ... A +

Re: [GENERAL] Referencing function value inside CASE..WHEN

2011-06-19 Thread kleptog
This message has been digitally signed by the sender. Re___GENERAL__Referencing_function_value_inside_CASE__WHEN.eml Description: Binary data Hi-Tech Gears Ltd, Gurgaon, India Sent using "PostMaster" by QuantumLink Communications G

Re: [GENERAL] Referencing function value inside CASE..WHEN

2011-06-19 Thread Martijn van Oosterhout
On Sun, Jun 19, 2011 at 10:45:12AM +0800, lover boi wrote: > In the following statement, does the custom function get executed twice? > > SELECT > MY_FUNCTION(...), > CASE WHEN MY_FUNCTION(...) = '...' THEN '...' ELSE '...' END Yes > If so, is there a way I can make it execute once? I tried

Re: [GENERAL] Referencing function value inside CASE..WHEN

2011-06-19 Thread Pavel Stehule
Hello 2011/6/19 lover boi : > Hi, > > In the following statement, does the custom function get executed twice? > > SELECT >   MY_FUNCTION(...), >   CASE WHEN MY_FUNCTION(...) = '...' THEN '...' ELSE '...' END > ... > ... > > > If so, is there a way I can make it execute once?  I tried this but it

Re: [GENERAL] Referencing function value inside CASE..WHEN

2011-06-18 Thread David Johnston
You can try using a CTE/With clause. Failing that use a function with SELECT INTO... On Jun 18, 2011, at 22:45, lover boi wrote: > Hi, > > In the following statement, does the custom function get executed twice? > > SELECT > MY_FUNCTION(...), > CASE WHEN MY_FUNCTION(...) = '...' THEN '..

[GENERAL] Referencing function value inside CASE..WHEN

2011-06-18 Thread lover boi
Hi, In the following statement, does the custom function get executed twice? SELECT MY_FUNCTION(...), CASE WHEN MY_FUNCTION(...) = '...' THEN '...' ELSE '...' END ... ... If so, is there a way I can make it execute once? I tried this but it gave me a "Column my_function does not exist" e

[GENERAL] Referencing function value inside CASE..WHEN

2011-06-18 Thread lover boi
Hi, In the following statement, does the custom function get executed twice? SELECT MY_FUNCTION(...), CASE WHEN MY_FUNCTION(...) = '...' THEN '...' ELSE '...' END ... ... If so, is there a way I can make it execute once? I tried this but it gave me a "Column my_function does not exist" e