[ORACLE] 오라클 ORA-01400: NULL을 ("USER_DATA"."ID") 안에 삽입할 수 없습니다.
### The error occurred while setting parameters
### Error updating database. Cause: java.sql.SQLIntegrityConstraintViolationException: ORA-01400: NULL을 ("USER_DATA"."ID") 안에 삽입할 수 없습니다
테이블에 NOT NULL이 잡혀있는경우
INSERT 나 UPDATE시 NOT NULL이 잡혀있는 컬럼에 NULL을 넣을시 에러가 발생합니다.
-해결방법은 컬럼의 NOT NULL 체크를 해주시면됩니다.
아래는 위와같은 케이스를 발생시켜보겠습니다.
create table USER_DATA(
ID varchar2(10) NOT NULL,
NAME varchar2(10) NOT NULL,
ADDRESS varchar2(10)
);
아래 USER_DATA 테이블이 있습니다.
ID,NAME 같은경우 NOT NULL이 체크되어있습니다.
NAME 컬럼은 NOT NULL 설정되어있습니다.
NAME에 NULL값을 입력해보겠습니다.
INSERT INTO USER_DATA(ID,NAME,ADDRESS)
VALUES('1','','서울')
아래와 같이 에러가 발생합니다.
org.springframework.dao.DataIntegrityViolationException:
### The error occurred while setting parameters
### Error updating database. Cause: java.sql.SQLIntegrityConstraintViolationException: ORA-01400: NULL을 ("USER_DATA"."NAME") 안에 삽입할 수 없습니다
### SQL: INSERT INTO USER_DATA( ID,NAME,ADDRESS) VALUES('1','','서울')
### Cause: java.sql.SQLIntegrityConstraintViolationException: ORA-01400: NULL을 ("USER_DATA"."NAME") 안에 삽입할 수 없습니다
### The error may involve kr.co.shop.lib.bl.service.theshop.user.insertUsertTb-Inline
### The error occurred while setting parameters
]
### SQL: INSERT INTO USER_DATA( ID,NAME,ADDRESS) VALUES('1','','서울')
### Cause: java.sql.SQLIntegrityConstraintViolationException: ORA-01400: NULL을 ("USER_DATA"."NAME") 안에 삽입할 수 없습니다
; SQL []; ORA-01400: NULL을 ("USER_DATA"."NAME") 안에 삽입할 수 없습니다
; nested exception is java.sql.SQLIntegrityConstraintViolationException: ORA-01400: NULL을 ("USER_DATA"."NAME") 안에 삽입할 수 없습니다
at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:243)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:73)
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:73)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:371)
at com.sun.proxy.$Proxy37.insert(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:240)
at kr.co.shop.lib.bl.service.theshop.user.UserDAO.insertUsertTb(UserDAO.java:143)
at kr.co.shop.lib.bl.service.theshop.user.UserDAO$$FastClassBySpringCGLIB$$2a25fbc2.invoke(<generated>)
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:738)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:85)
at kr.co.shop.lib.database.aspect.ExecutionDataSourceAspect.doServiceProfiling(ExecutionDataSourceAspect.java:58)
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.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:629)
at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:618)
at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:70)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
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:673)
at kr.co.shop.lib.bl.service.theshop.user.UserDAO$$EnhancerBySpringCGLIB$$1dc78101.insertUsertTb(<generated>)
at kr.co.shop.lib.bl.service.theshop.user.UserServiceImpl.insertUsertTb(UserServiceImpl.java:495)
at kr.co.shop.lib.bl.service.theshop.user.UserServiceImpl.insertUser(UserServiceImpl.java:295)
at kr.co.shop.lib.bl.service.theshop.user.UserServiceImpl$$FastClassBySpringCGLIB$$45c786a5.invoke(<generated>)
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:738)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:282)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:673)
at kr.co.shop.lib.bl.service.theshop.user.UserServiceImpl$$EnhancerBySpringCGLIB$$cf7c046a.insertUser(<generated>)
at kr.co.shop.client.web.front.api.theshop.user.UserApiController.regUser(UserApiController.java:1056)
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:827)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738)
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:963)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:897)
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:661)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
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:192)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:478)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:80)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:624)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:341)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:783)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:798)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1441)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.sql.SQLIntegrityConstraintViolationException: ORA-01400: NULL을 ("DWB2B"."USER_TB"."USER_KEY") 안에 삽입할 수 없습니다
'데이터베이스 > Oracle' 카테고리의 다른 글
[ORACLE] 오라클 에러 모음 ORA-00000 ~ ORA-00899 (0) | 2020.05.08 |
---|---|
[ORACLE] 오라클 ORA-12899 열에 대한 값이 너무 큼 해결방법 (1) | 2020.05.07 |
[ORACLE] 오라클 ORA-00942: 테이블 또는 뷰가 존재하지 않습니다 원인해결 (0) | 2020.04.28 |
[ORACLE] 오라클 ORA-00001: 무결성 제약 조건에 위배됩니다 원인해결 (0) | 2020.04.27 |
[ORACLE] Group by / having 절 이해하기(+Distinct) (0) | 2020.04.25 |