Database query string null handling

At 20:22:26 on May 3, 2018, in today's task, I encountered a database query problem. When the Chinese name of the user saved in the database is available, I use name = ? arrive.

Special handling is required, in PostgreSQL you can use

  SELECT user_namecn,uid FROM oa_user WHERE user_state=0 and REPLACE(user_namecn,' ','') = REPLACE(' 某某 ',' ','') ; 
It is to query after replacing the content. The perfect solution to the string is not empty processing.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325230532&siteId=291194637