views:

323

answers:

1

Can we use a select query in embedded sql (pro C) as the first argument in Decode() function.

+1  A: 

I'm not sure about embedded sql, but I guess it should work:

SELECT DECODE( ( SELECT 1 FROM dual ), 1, 'Yes', 'No' ) FROM dual

Yes

You need to put the SELECT in brackets.

Peter Lang
I have edited the question, my intention is to use this in ProC (Embedded sql in C)
Sachin Chourasiya
What happens when you try that?
Tony Andrews
I am getting compilation errors
Sachin Chourasiya
There's a lot of modern SQL constructs (eg introduced since 8.0) the precompilers can't use directly. You can use dynamic SQL or hide the SQL in a view.
Gary