PL/SQL (MOSC)

MOSC Banner

How to use IF-THEN-ELSE statement for a sub-query of my main select statement

edited Jan 13, 2021 6:15PM in PL/SQL (MOSC) 5 commentsAnswered

Hi Gurus

I have an interesting problem that I am battling to resolve. I have written a sql query that spans multiple sub-queries in the from section of the main query. i.e.

Select ax.a,

by.b

from table z

(select 1 a,

2 b

from table x) ax,

(select 2 b

2 c

from table y) by

where ax.b = z.b

and by.c = z.b

and z.assignment_id = 180

Now if each sub-query returns rows the query will return data, however let us say the first sub has not data for assignment 180 but the second sub-query does have data for assignment 180 then the complete query will return no rows.

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center