Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Pivot Rules with Main Table

user1083268Jan 4 2019 — edited Jan 4 2019

Pivot the rules and apply in Main table query.

Table_a

Table a

Table b (contains column value that will be used and the corresponding value is stored for filter records)

tableb

Table C (contains actual data)

Table C should join with the above rule table and filter the records. Also possible to join with tablea.columna and tablea.columnb also as filter from the final table

Rule 1 will be fired and get all the data that contains data with

select rule_id,rule_name,c.* from tablec c where abc in (ab,pq) and pqr in (123);

Rule 2 will have condition

select rule_id,rule_name,c.*  from tablec where pqr in (345) and xyz in (abc);

Rule 3 will have condition:

select rule_id,rule_name,c.*  from tablec where abc in (zz) ; 

Like to have query that only fetch all the data in the final table based on the rule filter driven by column and corresponding values values are in rows multiple or single values possible so in condition can have comma seperated values from the child table.

If no data based on the rule , that rule will not be there in the final data.

Comments
Post Details
Added on Jan 4 2019
1 comment
76 views