ORA-01861 : 누락된 표현식 원인 : 표현식에 문제가 있을 때 발생. 주 원인은 오타 해결 : 이런경우, 작성한 SQL문을 하나씩 천천히 다시 보자. 예시) -- , 가 들어가있는 경우 select em.no, em.name, from EMP em -- ,이 들어가야하는데 .가 들어가있는 경우 select em.no. em.name from EMP em -- 표현식을 두번 선언한 경우 select em.no, em.name from EMP em where em.no = 123 and and em.name = '홍길동' 해당 예시는 제가 격은 사례이며, 다른 원인이 있을 수도 있습니다. :)
Programming/SQL
ORA-01861 : literal does not match format string (리터럴이 형식 문자열과 일치하지 않음) 원인 : 값을 string으로 넘길 때, DB에 날짜와 관련해서 string type과 date type 두개가 있는데 type을 착각해서 에러 발생. 해결 : 비교하는 양쪽의 type을 확인하고 동일하게 맞춰준다. 예시) -- date는 string type으로 20230316 을 넘긴다면 --1. JOIN_DT가 string type일 경우 select * from EMP em where em.JOIN_DT = #{date} --2. JOIN_DT date type일 경우 select * from EMP em where em.JOIN_DT = TO_DATE(#{date}, ..
ibatis - iterate 태그 사용 property : 파라미터명prepend : 쿼리로 쓰일 문자열open : 태그 시작 시 들어가는 문자열close : 태그 종료 시 들어가는 문자열conjunction : 반복 중간에 들어가는 문자열 **예제 select * from EMP em #empNoList# MyBatis - foreach 태그 사용collection : 전달받는 값. List / Array item : 전달받은 값을 별칭으로 만들 때open : 태그 시작 시 들어가는 문자열close : 태그 종료 시 들어가는 문자열separator : 반복 중간에 들어가는 문자열 **예제 selec..
*문제 cast로 timestamp 형변환 후 avg값을 구하려고 했는데 2day 28:40:00 처럼 시간값이 이상하게 나오는 문제가 발생함. *예시 select avg(A) from ( select (cast( start_time as timestamp) - cast( end_time as timestamp)) as A from table_name ) as example *해결 justify_interval(interval) justify_interval을 사용해서 시간값으로 계산하게 해서 해결 select justify_interval(avg(A)) from ( select (cast( start_time as timestamp) - cast( end_time as timestamp)) as A f..