1 Reply Latest reply: Jul 19, 2013 3:42 AM by Pacmann RSS

    Problem with CASE statement


      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


          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