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!

Working with nested case statement

SmileNov 25 2014 — edited Nov 25 2014

Hi , I tried the below sql statement to the max dates but encountering the Not a single group error when executing

select case

            when f.rv = 'AMER' then

             (case

                when (m.sc = 'A' and str_name = 'ST_DT1')

                     or (m.sc = 'B' and str_name = 'ST_DT2')

                     or (m.sc = 'C' and str_name = 'ST_DT3') then

                 max(m.stdt)

                when (mc.sc = 'C' and str_name = 'ST_DT4')

                     or (mc.sc = 'K' and str_name = 'ST_DT5') then

                 max(mc.eddt)

                else

                 null

             end)

            else

             null

         end

    from memo_con mc

        ,baro_uy  b

        ,fin      f

        ,ped      pe

   where mc.id = b.id

     and pe.id = mc.mid

     and pe.id1 = 1234

     and b.cd = f.cd

     and f.id = 93;

Could you please suggest me the correct way on this.

Thank You

This post has been answered by Sven W. on Nov 25 2014
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 23 2014
Added on Nov 25 2014
3 comments
1,185 views