Background Image

FORUM

조회 수 43 추천 수 0 댓글 1
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄


* 질문 등록 시 다음의 내용을 꼭 기입하여 주세요.

OS
Window 64
CUBRID Ver.
11.0.2.0291
CUBRID TOOL Ver.
[도움말]-[버전정보] 확인
응용 환경(API)
java, jsp, mybatis, spring


* CUBRID 응용 오류, SQL 오류 또는 SQL 튜닝 관련된 문의는 반드시 다음의 내용을 추가해 주세요. 비밀글이나 비밀 댓글도 가능합니다.
* 저희가 상황을 이해하고, 재현이 가능해야 알 수 있는 문제들이 많습니다. 가능한 정보/정황들을 부탁합니다.

 

에러 내용 및 재현 방법 재현 가능한 Source와 SQL
관련 테이블(인덱스, 키정보 포함) 정보 CUBRID 홈 디렉토리 아래 log 디렉토리 압축


-------------- 아래에 질문 사항을 기입해 주세요. ------------------------------------------------------------------------
 

 

컬럼들 타입

 

CREATE TABLE "statistics_member" (
    "insertdate" bigint NOT NULL,
    "domainUid" bigint NOT NULL,
    "totalcount" bigint DEFAULT 0 NOT NULL,
    "usecount" bigint DEFAULT 0 NOT NULL,
    "sleepcount" bigint DEFAULT 0 NOT NULL,
    "stopcount" bigint DEFAULT 0 NOT NULL,
    "newcount" bigint DEFAULT 0 NOT NULL,
    
    CONSTRAINT PRIMARY KEY("insertdate","domainuid")
    
);

CREATE INDEX idx_statistics_member_domainuid ON statistics_member("domainUid");

 

 

 

--------------------------------------------------------------------------------------------------------------------

 

 

* (#{item} 에 들어가는 수=> 20211020, 20211019 )

 

쿼리문 

<select id="getMemberStatistics" parameterType="StatisticsForm" resultType="MemberStatistics">
        SELECT     dt.insertDate, 
                sm.totalCount, sm.usecount, sm.sleepcount, sm.stopcount
        FROM (
            <foreach collection="dates" item="item" separator="UNION" >
                SELECT #{item} AS insertDate 
            </foreach> 
        ) dt
        LEFT JOIN (
            SELECT (useCount+ sleepCount+stopCount) AS totalCount, TT.* FROM (
                SELECT     insertDate, 
                        SUM(usecount)             AS useCount, 
                        SUM(sleepcount)         AS sleepCount, 
                        SUM(stopcount)             AS stopCount
                FROM     statistics_member
                WHERE     domainUid = 1
                GROUP BY insertDate
            ) TT
        )sm ON (dt.insertDate = sm.insertDate)
        ORDER BY dt.insertDate DESC
    </select>

 

 

-------------------------------------------------------------------------------------------------------------------

 

오류 메시지

 

SQL: SELECT  dt.insertDate,      sm.totalCount, sm.usecount, sm.sleepcount, sm.stopcount   FROM (           SELECT ? AS insertDate      UNION      SELECT ? AS insertDate          ) dt   LEFT JOIN (    SELECT (useCount+ sleepCount+stopCount) AS totalCount, TT.* FROM (     SELECT  insertDate,        SUM(usecount)    AS useCount,        SUM(sleepcount)   AS sleepCount,        SUM(stopcount)    AS stopCount     FROM  statistics_member           WHERE  domainUid = 1           GROUP BY insertDate    ) TT   )sm ON (dt.insertDate = sm.insertDate)   ORDER BY dt.insertDate DESC   LIMIT ?, ?
### Cause: cubrid.jdbc.driver.CUBRIDException: Cannot coerce value of domain "bigint" to domain "*variable*".[CAS INFO-localhost:30000,1,16148],[SESSION-90990],[URL-jdbc:cubrid:localhost:30000:cmTest:cmTest:********:?charset=UTF-8].
; uncategorized SQLException for SQL []; SQL state [null]; error code [-181]; Cannot coerce value of domain "bigint" to domain "*variable*".[CAS INFO-localhost:30000,1,16148],[SESSION-90990],[URL-jdbc:cubrid:localhost:30000:cmTest:cmTest:********:?charset=UTF-8].; nested exception is cubrid.jdbc.driver.CUBRIDException: Cannot coerce value of domain "bigint" to domain "*variable*".[CAS INFO-localhost:30000,1,16148],[SESSION-90990],[URL-jdbc:cubrid:localhost:30000:cmTest:cmTest:********:?charset=UTF-8].
    at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:90)
    at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:82)
    at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:82)
    at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:73)
    at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:446)
    at com.sun.proxy.$Proxy19.selectList(Unknown Source)
    at org.mybatis.spring.SqlSessionTemplate.selectList(SqlSessionTemplate.java:230)
    at com.crinity.webapps.statistics.dao.StatisticsDAO.getMemberStatistics(StatisticsDAO.java:253)
    at com.crinity.webapps.statistics.dao.StatisticsDAO$$FastClassBySpringCGLIB$$eef7d971.invoke(<generated>)
    at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
    at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:736)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
    at org.springframework.aop.framework.adapter.MethodBeforeAdviceInterceptor.invoke(MethodBeforeAdviceInterceptor.java:56)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:168)
    at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
    at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:671)
    at com.crinity.webapps.statistics.dao.StatisticsDAO$$EnhancerBySpringCGLIB$$264888fc.getMemberStatistics(<generated>)
    at com.crinity.webapps.admin._.statistics.service.StatisticsMemberStatusManager.getMemberStatus(StatisticsMemberStatusManager.java:107)
    at com.crinity.webapps.admin._.statistics.StatisticsManage.memberStatus(StatisticsManage.java:162)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205)
    at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:133)
    at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:97)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:854)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:765)
    at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:967)
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:901)
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)
    at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:650)
    at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at com.crinity.webapps.servlet.filter.SecurityHeaderFilter.doFilter(SecurityHeaderFilter.java:38)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:218)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:958)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:452)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1087)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:637)
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:318)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Thread.java:748)
Caused by: cubrid.jdbc.driver.CUBRIDException: Cannot coerce value of domain "bigint" to domain "*variable*".[CAS INFO-localhost:30000,1,16148],[SESSION-90990],[URL-jdbc:cubrid:localhost:30000:cmTest:cmTest:********:?charset=UTF-8].
    at cubrid.jdbc.jci.UConnection.createJciException(UConnection.java:2178)
    at cubrid.jdbc.jci.UInputBuffer.<init>(UInputBuffer.java:112)
    at cubrid.jdbc.jci.UConnection.send_recv_msg(UConnection.java:1751)
    at cubrid.jdbc.jci.UConnection.send_recv_msg(UConnection.java:1763)
    at cubrid.jdbc.jci.UStatement.executeInternal(UStatement.java:780)
    at cubrid.jdbc.jci.UStatement.execute(UStatement.java:847)
    at cubrid.jdbc.driver.CUBRIDStatement.executeCoreInternal(CUBRIDStatement.java:906)
    at cubrid.jdbc.driver.CUBRIDStatement.executeCore(CUBRIDStatement.java:871)
    at cubrid.jdbc.driver.CUBRIDPreparedStatement.execute(CUBRIDPreparedStatement.java:486)
    at org.apache.commons.dbcp2.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.java:197)
    at org.apache.commons.dbcp2.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.java:197)
    at org.apache.ibatis.executor.statement.PreparedStatementHandler.query(PreparedStatementHandler.java:63)
    at org.apache.ibatis.executor.statement.RoutingStatementHandler.query(RoutingStatementHandler.java:79)
    at org.apache.ibatis.executor.ReuseExecutor.doQuery(ReuseExecutor.java:60)
    at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:326)
    at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:156)
    at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:136)
    at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:148)
    at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:141)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:433)
    ... 59 common frames omitted\

 

 

위의 전제조건하에 쿼리 실해잇 오류가 나는데 어떤이유에서 발생하는지 모르겠습니다,

답변 부탁드립니다,

 

  • ?
    김병욱 2021.10.21 16:59
    안녕하세요, 큐브리드를 이용해 주셔서 감사합니다.

    작성하신 쿼리 중, "SELECT ? AS insertDate UNION SELECT ? AS insertDate" 이 부분을 아래와 같이 작성하면 에러가 발생하지 않습니다.

    SELECT CAST(? AS BIGINT) AS insertDate UNION SELECT CAST(? AS BIGINT) AS insertDate

    이렇게 쿼리를 작성해야 하는 이유는, 이후 쿼리에서 JOIN을 수행할 때, 타입을 일치시켜야 하기 때문입니다.

List of Articles
번호 제목 글쓴이 날짜 조회 수
공지 SQLGate for CUBRID 영구 무료 라이선스 제공 file admin 2020.04.09 1577
3544 CUBRID Migration Toolkit JDBC 드라이버 마이 2021.12.06 8
3543 뷰 내보내기 시 ddl 짤림 코딩쟁이 2021.12.03 13
3542 대용량 테이블 내보내기 코딩쟁이 2021.12.03 12
3541 외래키 제약사항 생성 시. 1 열쓰 2021.11.30 31
3540 cubrid manager 실행이 안됨 4 file 푸른호랑이 2021.11.28 55
3539 테이블 파티션나눈후 조회시 에러가 발생합니다. 2 연습용 2021.11.25 28
3538 JSP JDBC 관련해서 문의드립니다. 1 수야돌고래 2021.11.25 31
3537 log4jdbc 지원문의 1 dudley74 2021.11.19 49
3536 존재하지 않는 대상조회시 결과값이 나오는 현상 문의 5 file hajun 2021.11.16 95
3535 SQLGate Developer 업데이트 후 오류 1 문태환 2021.11.15 30
3534 CUBRID에서 node.js Sequelize 적용 가능한가요? 1 prayccc 2021.11.11 24
3533 큐브리드 매니저 사용시 복구가 안되요 1 file 개발자1 2021.11.05 50
3532 VARCHAR 컬럼의 길이가 -1인 경우 1 zeroradish 2021.11.04 42
3531 큐브리드 테이블 생성 시 자동 용량 늘리기 1 조던 2021.11.02 41
3530 큐브리드 조인 문의 드립니다(모바일 작성) 1 hjh394 2021.11.02 37
3529 (python)centOS7 docker 연결 문의입니다. 리얼비 2021.11.01 31
3528 INSERT INTO 사용 시, 여러개의 VALUES 입력 오류 1 큐브리드봇 2021.10.30 38
3527 큐브리드 DB 트랜잭션 정보 질문하겠습니다. 1 연습용 2021.10.29 33
3526 큐브리드  매니저 버전 문의 3 대청 2021.10.29 48
3525 union 관련 문의입니다. 2 file Eline 2021.10.26 40
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 ... 178 Next
/ 178

Contact Cubrid

대표전화 070-4077-2110 / 기술문의 070-4077-2147 / 영업문의 070-4077-2112 / Email. contact_at_cubrid.com
Contact Sales