我必须在我的项目中执行一个查询,我已经使用jdbctemplate和MapSqlParameterSource来执行但是我的代码给出了以下的删除
exception ex:org.springframework.jdbc.UncategorizedSQLException:PreparedStatementCallback;未分类SQL状态的SQLException [99999];错误代码[17004];列类型无效;嵌套异常是java.sql.SQLException:列类型无效
我的查询如下所述:
UPDATE INDS_GUEST_ACCOUNT_MST_TBL SET
ACTIVE_YN_FLG = :activeflag ,
PASSWORD = (CASE WHEN :activeflag ='Y' THEN :password ELSE NULL END),
NOTES = (CASE WHEN :activeflag='Y' THEN :notes ELSE NULL END),
COMPANY_NAME = (CASE WHEN :activeflag = 'Y' THEN :companyname ELSE NULL END),
END_TIME = (CASE WHEN :activeflag='Y' THEN SYSTIMESTAMP+1 ELSE NULL END),
UPDTD_ON_DT = SYSTIMESTAMP, UPDTD_BY_USR_ID = :user
WHERE GA_SEQ = :sequence
并且MapSqlParameterSource是这样的:
MapSqlParameterSource paramSource = new MapSqlParameterSource();
paramSource.addValue("activeflag", objGuestAccountInfo.getActiveflag().toUpperCase(), Types.VARCHAR);
paramSource.addValue("password", objGuestAccountInfo.getPassword(), Types.VARCHAR);
paramSource.addValue("notes", objGuestAccountInfo.getNotes(), Types.VARCHAR);
paramSource.addValue("companyname", objGuestAccountInfo.getCompany(), Types.VARCHAR);
paramSource.addValue("user", objGuestAccountInfo.getUser(), Types.VARCHAR);
paramSource.addValue("sequence", objGuestAccountInfo.getGA_seq(), Types.NUMERIC);
我的表格结构如下:
GA_SEQ NUMBER (6)
PASSWORD VARCHAR2 (60 Byte)
END_TIME DATE
ACTIVE_YN_FLG VARCHAR2 (1 Byte)
NOTES VARCHAR2 (4000 Byte)
CREATD_BY_USR_ID VARCHAR2 (30 Byte)
CREATD_ON_DT DATE
UPDTD_BY_USR_ID VARCHAR2 (30 Byte)
UPDTD_ON_DT DATE
COMPANY_NAME VARCHAR2 (50 Byte)