I have a simple select query like below which has only 2 columns:
SELECT a, b FROM table;
I have some mapping data with me like below:
if a=1 and b=1 then c=100
if a=1 and b=2 then c=200
if a=2 and b=1 then c=300
and so on.
Now, I need to create a query so that I can get output like:
1,1,100
1,2,200
2,1,300
and so on
Here I don't want to create a table and store the mapping data. I can create any data structures in PL/SQL to store it.
How can I achieve this?
PS: I tried to create this mapping data using a PL/SQL table and using INNER JOIN. But I realized PL/SQL tables can not be used in SQL queries.
I am using Oracle 11g.
PL/SQL tables can not be used in SQL queriesyes they can. You only need to have the global types creation privilege