向数据库中插入数据报错误

来源:百度知道 编辑:UC知道 时间:2024/05/15 21:51:57
insert into SMS (SMS_NUM, SMS_WRITE_DATE, SMS_TITLE, SMS_CON, SMS_SENDER, SMS_SENDE_TEL, SMS_WRITER) values (seq_sms.nextVal, sysdate, ?, ?, ?, ?, ?)

Parameters: [asdajkshdjjkk, asdsdsdsaasdas, 세외수입정보화사업단, 02-2222-2222, 정명춘]

Types: [java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String]

错误提示:
javax.servlet.ServletException: SqlMapClient operation; bad SQL grammar []; nested exception is com.ibatis.common.jdbc.exception.NestedSQLException:
--- The error occurred in wnis/sms/dao/sqlmap/Sms.xml.
--- The error occurred while applying a parameter map.
--- Check the addSms-InlineParameterMap.
--- Check the statement (update failed).
--- Cause: java.sql.SQLException: ORA-02289: ?????

高手详细说说~~~
怎么取得当用户向数据库中插入一条数据的时候,下一个那个序列号的编号啊?

insert into SMS (SMS_NUM, SMS_WRITE_DATE, SMS_TITLE, SMS_CON, SMS_SENDER, SMS_SENDE_TEL, SMS_WRITER) values (seq_sms.nextVal, sysdate, ?, ?, ?, ?, ?)

Parameters: [asdajkshdjjkk, asdsdsdsaasdas, 세외수입정보화사업단, 02-2222-2222, 정명춘]

Types: [java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String]

错误提示:
javax.servlet.ServletException: SqlMapClient operation; bad SQL grammar []; nested exception is com.ibatis.common.jdbc.exception.NestedSQLException:
--- The error occurred in wnis/sms/dao/sqlmap/Sms.xml.
--- The error occurred while applying a parameter map.
--- Check the addSms-InlineParameterMap.
--- Check the statement (update failed).
--- Cause: java.sql.SQLException: ORA-02289: ?????

因为你的数据库中相对应的表中没有自动增长列。
去看看你的数据库就知道了。

seq_sms.nextVal是oracle中的序列对象取下一个序列号,sysdate是代表当前日期