1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

  2. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

java.sql.SQLException: ORA-00932: inconsistent datatypes: expected NUMBER got BINARY

Discussão em 'Outras Linguagens' iniciado por Stack, Janeiro 21, 2021.

  1. Stack

    Stack Membro Participativo

    I have a method in Dao Class that returns List<Object[]> back and I am using named Query

    public List<Object[]> getListByCustomer(Session session, int customerId, List<Integer> strIds) {
    Query namedQuery = session.createSQLQuery(QueryConstants.EXPORT);
    namedQuery.setParameter("customer", customerId);
    namedQuery.setParameter("stringId", strIds);
    List<Object[]> objects = namedQuery.list();
    return objects;
    }


    I want to pass List<Integer> strIds in stringId into the named query as follows :

    public class QueryConstants {
    public static final String EXPORT =
    "SELECT sv.NAME, sv.TYPE, sv.CLIENT_ADDRESS, sv.NAME_REDUNDANT, sv.DEPARTURE_DATE, s1.CODE,sv.STATE, sv.CODE "
    + "FROM VIEW sv, PROCESS p1, SET s1 "
    + "WHERE sv.R_ID = p1.R_ID and p1.ISSUER_ID = s1.USER_ID and sv.CUSTOMER_ID = :customer and sv.R_ID IN :)stringId)";
    }


    But I get ORA-00932: inconsistent datatypes: expected NUMBER got BINARY.

    Also when I remove sv.R_ID IN :)stringId) from the query it works fine and when I pass Integer(strIds) instead of List<Integer> strIds into the query it works fine.

    I'm using Oracle 10g.

    Continue reading...

Compartilhe esta Página