TY blog

Oracle SQL 본문

기타

Oracle SQL

주짓수하는 개발자 2023. 2. 12. 23:44
1. SQL Exception - 부적합한 열 유형:1111

 

1. DB null을 허용하지 않는 칼럼에 null 값이 Insert 된 경우 발생

2. 올바르지 않은 입력값이 삽입된 경우 발생 

 

1번 Not null 칼럼값을 Null 허용으로 변경하면 해결된다. 

#ORACLE 현재 있는 컬럼을 변경시 
ALTER TABLE 테이블명 MODIFY 컬럼명 NULL

#테이블 생성시
CREATE TABLE 테이블명 (
	컬럼명 컬럼타입 NULL
)

#EX) 컬럼타입 : varchar(10)

 

3. Mybatis에서 파라미터를 Map으로 전달 시 명시되어 있지 않은 파라미터인 경우 

#insert mapper

<insert id="developmentRegist" parameterType="HashMap">
    INSERT INTO projectBoard (boardNo, usercode, projectName, projectCategory, projectStatus, projectStartDate,
    projectEndDate, projectDate, borderRegistDate, borderModifyDate, borderContent, borderWorking,
    imgFileName1, imgFileName2, imgFileName3, imgFileName4, imgFileName5,
    imgFilePath1, imgFilePath2, imgFilePath3, imgFilePath4, imgFilePath5, 
    imgFileTitle1, imgFileTitle2, imgFileTitle3, imgFileTitle4, imgFileTitle5,
    imgFIleContent1, imgFIleContent2, imgFIleContent3, imgFIleContent4, imgFIleContent5 )VALUES
    (seqno.NEXTVAL,#{usercode}, #{projectName}, #{projectCategory}, 'ing', #{nowDate}, ' ', '-', #{nowDate}, 
    ' ', #{projectContent}, ' ', 
    #{imgFileName1}, #{imgFileName2}, #{imgFileName3}, #{imgFileName4}, #{imgFileName5},
    #{imgFilePath1}, #{imgFilePath2}, #{imgFilePath3}, #{imgFilePath4}, #{imgFilePath5}, 
    #{imgFileTitle1}, #{imgFileTitle2}, #{imgFileTitle3}, #{imgFileTitle4}, #{imgFileTitle5}, 
    #{imgFileContent1}, #{imgFileContent2}, #{imgFileContent3}, #{imgFileContent4}, #{imgFileContent5})
</insert>

 

#{} 파라미터를 Map으로 전달할 때 key, value 값에 오타가 있거나 빠진 값이 있는지 확인

 

* 추가

Mybatis select 이외에 insert, update delete 구문의 int 리턴값은 다음과 같음

1. insert 의 경우 정상적으로 추가 진행 시 삽입된 행의 개수를 반환한다.

2. update 의 경우 수정에 성공한 행의 개수를 반환한다( 실패 시 0 )

3. delete 의 경우 삭제된 행의 개수를 반환한다. 

Comments