On Oct 23, 4:33 am, Vlad <[EMAIL PROTECTED]> wrote:
> Is it possible to have a conditional from statement:-
>
No.
> E.g.
>
> Select * from
> (
> select case
> WHEN TypeTBL.Type = 'TypeA' then select make,model from CarInfo
> Else Select Area,Colour from HouseInfo
> END
> )
> TypeTBL
>
> I know there are other ways of writing this (by putting the case
> statement into the select part of the query) but this method would be
> better in my situation if possible.
Why would this be better?
>
> TIA
It isn't possible:
SQL> create table carinfo(
2 make varchar2(40),
3 model varchar2(40),
4 color varchar2(20)
5 );
Table created.
SQL> create table houseinfo(
2 area varchar2(40),
3 color varchar2(20),
4 sq_ft number
5 );
Table created.
SQL> create table typetbl(
2 ttype varchar2(10)
3 )
4 /
Table created.
SQL> insert into typetbl values('TypeA');
1 row created.
SQL> commit;
Commit complete.
SQL> Select * from
2 (
3 select case
4 WHEN TypeTBL.Type = 'TypeA' then select make,model from CarInfo
5 Else Select Area,Color from HouseInfo
6 END
7 )
8 TypeTBL ;
WHEN TypeTBL.Type = 'TypeA' then select make,model from CarInfo
*
ERROR at line 4:
ORA-00936: missing expression
SQL>
What, in 'your situation', cries out for such a construct?
David Fitzjarrell
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Oracle PL/SQL" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/Oracle-PLSQL?hl=en
-~----------~----~----~----~------~----~------~--~---