简体   繁体   English

db2 忽略 where 子句中的大小写

[英]db2 ignore case in where clause

Normally we perform the ignore case as follow:通常我们按如下方式执行忽略情况:

select * from user where UPPER(username) = UPPER('maker1');

Is this any way to do it in where clause condition?这是在 where 子句条件下可以做到的任何方法吗?

I understand that we can do as follow:我知道我们可以这样做:

select * from user where UPPER(username) in ( UPPER('maker1'), UPPER(maker2) );

But how about do it in preparedStatement ?但是如何在preparedStatement做呢?

For example:例如:

sb.append( "AND functionType IN (:functionType) " );
        map.put( "functionType",
                command.getListValues( command.getAllNonTradeFunctionsList( ) ) );
    query.setProperties( map );

what is the issue you are facing here is the simple example demonstrating your problem您在此处面临的问题是展示您的问题的简单示例

String query = 
                "SELECT agent.familyname, agent.givenname"
                + " FROM agent"
                + " WHERE agent.agentid = ?"
                + " AND (" 
                + " familyname ilike ? OR givenname ilike ?" 
                + ") " 
                + " ORDER by familyname";


        pst.setInt(1, piececreation.agentid);
        pst.setString(2, agent_lastname.toLowerCase());
        pst.setString(3, agent_name.toLowerCase());

let't me know if any other help needed让我知道是否需要任何其他帮助

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM