This discussion is archived
1 Reply Latest reply: Jul 19, 2013 1:42 AM by Pacmann RSS

Problem with CASE statement

Rajat Newbie
Currently Being Moderated

Dear Experts,

 

I am facing the below problem while executing the query. Could you please help me to correct me.

 

 

  SELECT  a.cust_code cust_code,

      a.cust_typ  cust_typ,

      a.post_code post_code,

      a.country   country,

          CASE b.ref_no

            WHEN b.ref_qual LIKE 'EORI%' THEN b.ref_no

            ELSE NULL

          END

    FROM  bl_cust a,

      bl_ref b

    WHERE a.bl_no_uid = b.bl_no_uid(+)

    AND   a.ca_seq    = b.ca_seq(+)

    AND   a.cust_typ  = b.cust_typ(+)

    AND   a.cust_typ IN ('SHP','CNS','N1P')

    AND   a.bl_no_uid = 980001166724

    AND   a.ca_seq    = 0

    AND   a.cust_code IS NOT NULL;

 

 

It is giving the below message

        WHEN b.ref_qual LIKE 'EORI%' THEN b.ref_no
                        *

ERROR at line 6:

ORA-00905: missing keyword

 

 

 

 

Regards

Rajat

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points