Background Image

FORUM

조회 수 23177 추천 수 0 댓글 2
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
select case
            when to_number(to_char(sysdate, 'd')) between 4 and 7 then sysdate + (10 - to_number(to_char(sysdate, 'd')))
            else sysdate +(3-to_number(to_char(sysdate, 'd'))) end
from db_root


화요일이 지났으면 다음 주 화요일을 조회하고, 화요일이 지나지 않았으면 이번 주 화요일을 출력하는 쿼리입니다.
쿼리에는 이상이 없는 것 같은데, "Semantic: '+' operator is not defined on types date and numeric. " 이라는 오류를 발생시키네요.
오라클에서는 이상이 없이 조회가 되는데요.
오라클 만의 특별한 명령어를 쓴 것도 아닌데...
무엇이 문제일까요?
  • ?
    시난 2009.07.29 20:47

    음.. 이 문제는 numeric과 date 형의 오퍼레이터(+,-) 연산이 호환되지않아서 나타나는 것 같습니다.
    date형과 integer는 잘 되므로..

    다음과 같이 수정하시면 해결됩니다.. (더 좋은 의견 있으시면 댓글 부탁드려요!)
    장기적으로는 CUBRID에서 지원하게 수정해야겠네요.

    select case
                when to_number(to_char(sysdate, 'd')) between 4 and 7 then sysdate + CAST(10 - to_number(to_char(sysdate, 'd')) AS int)
                else sysdate +CAST(3-to_number(to_char(sysdate, 'd')) AS int) end
    from db_root


    select sysdate + 3 from db_root -- OK

    select sysdate + to_number('3') from db_root -- ERROR

    select sysdate + CAST(to_number('3') AS int) from db_root -- OK

    select sysdate + CAST('3' AS int) from db_root -- OK

  • ?
    웁쓰 2009.07.29 21:02
    현재 버전에서 CUBRID 묵시적 형변환 (Implicit Type Conversion) 이 다른 DBMS 보다 좀 더 strict  합니다.
    개선되어야 하는 부분이 맞구요. 계속 사용하실때 Oracle에서 되던 연산이 수행되지 않을수도 있습니다.

    아래 링크를 통해서 확인 가능 합니다.

    CUBRID Data Type 형변환 matrix
    http://www.cubrid.com/online_manual/cubrid_814/syntax/syntax_operator_cast.htm
    Oracle Data Type 형변환 matrix
    http://download.oracle.com/docs/cd/B28359_01/server.111/b28286/sql_elements002.htm#i55214

  1. CUBRID 사용자를 위한 DBeaver 도구 출시 안내

    Date2024.04.23 Byadmin Views51
    read more
  2. SQLGate for CUBRID 영구 무료 라이선스 제공

    Date2020.04.09 Byadmin Views4458
    read more
  3. 큐브리더 관련 문의 드려요^^

    Date2009.07.17 By김트리 Views12
    Read More
  4. 자바초본데요... 톰켓에서 설정하는법좀알려주세요

    Date2009.07.23 By배우자.. Views8861
    Read More
  5. 사용자 비밀번호 문의입니다

    Date2009.07.23 By삽질쟁이 Views9022
    Read More
  6. 쿼리의 결과를 비동기적으로 알 수 있나요.

    Date2009.07.23 By초보대왕 Views10753
    Read More
  7. connect by 에 관한 질문드리겠습니다.

    Date2009.07.24 By쫑구 Views11907
    Read More
  8. ibatis 시 설정 질문입니다.

    Date2009.07.24 Byrogah Views14342
    Read More
  9. 큐브리드 매니저 대한 에러 문의

    Date2009.07.25 By느티나무 Views9500
    Read More
  10. 트랜잭션 관련 문의입니다.

    Date2009.07.25 By메이커스 Views9313
    Read More
  11. CUBRID Service Tray 실행이 안됩니다.

    Date2009.07.25 By얀들 Views10809
    Read More
  12. 해당 ip에만 접속 권한을 주는 기능은 없나요?

    Date2009.07.27 By얀들 Views9083
    Read More
  13. DB / PW 자릿수를 늘려주세요.

    Date2009.01.16 By윤희서 Views35846
    Read More
  14. CUBRID 7.3 + zeroboard XE 관리자 로그인 에러

    Date2009.01.17 By윤희서 Views62130
    Read More
  15. 업데이트 보완 문제 해결요청

    Date2009.01.20 By가라 가라~ Views17592
    Read More
  16. 설치 및 삭제의 편의성 증대 요청

    Date2009.01.20 By윤희서 Views21699
    Read More
  17. 서버컴 접속이 안되요

    Date2009.07.28 By경아 Views10308
    Read More
  18. [초보문의] 질의편집기 접속 오류

    Date2009.07.29 By삽질중 Views9742
    Read More
  19. DB 페이지 스페이스 늘이는 방법 문의입니다.

    Date2009.07.29 By재홍 Views7
    Read More
  20. 날짜 계산관련 문의드립니다.

    Date2009.07.29 By치푸 Views23177
    Read More
  21. 자바 프로시저 작성 문의입니다.

    Date2009.07.30 By제발좀 Views12313
    Read More
  22. php 모듈 설치 에러입니다

    Date2009.07.30 By터프키드 Views9431
    Read More
Board Pagination Prev 1 ... 9 10 11 12 13 14 15 16 17 18 ... 200 Next
/ 200

Contact Cubrid

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