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!

view with case expression in where statement

Roger25Mar 23 2011 — edited Mar 23 2011
Hello,

I want to create a view like:
create or replace view oferte_la_culegere_vw(pcod_lucrare  varchar2, pcod_tipprodso varchar2) is
 select ol.cod_oferta from oferte_lucrare ol 
    join oferte o on o.cod_oferta = ol.cod_oferta
   where ol.cod_tip_lucrare = pcod_lucrare
     and (ol.activ = 'D' or 
 case when ol.activ = 'I' then
    if os_util.are_atributie(o.atributie_exceptie) then  ... -- add condition or ol.activ = 'N' to the query    
)
 intersect
 select t.cod_oferta from tipinstprodso_oferta
   where t.cod_tipprodso = pcod_tipprodso
 order by 1;

show errors view oferte_la_culegere_vw;
So in the 1st select i have to filter only for ol.activ = 'D', but i can select records with ol.activ = 'N', only if that condition matches (os_util.are_atributie...).
How can i specify this in a view?

Thanks
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 20 2011
Added on Mar 23 2011
3 comments
103 views