5 Replies Latest reply on Jan 23, 2003 7:54 AM by Gianluca Chini

    Alternative about LIKE in EJBQL

    Rafael Ubiratam Clemente Afonso Newbie

      Hello,

      I would like ues clause LIKE in my EJB-QL query. Like this: SELECT OBJECT(sc) FROM StateCity sc WHERE sc.stateCityName LIKE ?1%. But it doesn´t works. Reading other posts, I perceived that it is not possible use LIKE with parameter, only with constants.
      So I tried other alternative. I wrote my query this: SELECT OBJECT(sc) FROM StateCity sc WHERE SUBSTRING(sc.stateCityName, 0, LENGTH(?1)) = ?1. It works!
      Now, I want your opinion. Is this a acceptable alternative? Or this is a ugly patch?

      Thanks,

      Rafael U. C. Afonso