这一直提示这个错误,感觉我语句没写错啊。。。。求指导
insert into zoey_goddess(user_name,sex,age,birthday,email,mobile,create_user,create_date,update_user,update_date,isdel)values(?,?,?,?,?,?,?,current_date(),?,current_date(),?)
Exception in thread "main" java.sql.SQLException: ORA-00917: ????
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:111)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:330)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:287)
at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:744)
at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:215)
at oracle.jdbc.driver.T4CPreparedStatement.executeForRows(T4CPreparedStatement.java:965)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1169)
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3338)
at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:3444)
at com.zoey.dao.GoddessDao.addGoddess(GoddessDao.java:59)
at com.zoey.action.GoddessAction.add(GoddessAction.java:11)
at com.zoey.test.TestAction.main(TestAction.java:73)
以上是报错信息,下面是代码
package com.zoey.test;
import java.util.Date;
import java.util.List;
import java.util.Scanner;
import com.zoey.action.GoddessAction;
import com.zoey.model.Goddess;
public class TestAction {
public void customerDest(){
System.out.println("欢迎来到客服中心,我们提供如下服务");
System.out.println("服务编号:"+"服务名称");
System.out.println("1:查询 ;2:增加;3:删除;4:修改");
System.out.println("请选择服务编号:");
Scanner console=new Scanner(System.in);
int input=console.nextInt();
if(input==1){
}
}
public static void main(String[] args) throws Exception {
GoddessAction action=new GoddessAction();
/*
Goddess g=new Goddess();
g.setUser_name("joey");
g.setSex(0);
g.setAge(25);
g.setBirthday(new Date());
g.setEmail("joey@163.com");
g.setMobile("15688888888");
g.setIsdel(1);
action.add(g);
*/
System.out.println("欢迎来到客服中心,我们提供如下服务");
System.out.println("1:查询 ;2:增加;3:删除;4:修改");
System.out.println("请选择服务编号:");
Scanner console=new Scanner(System.in);
int input=console.nextInt();
if(input==1){
List<Goddess> result=action.query();
for (int i = 0; i < result.size(); i++) {
System.out.println(result.get(i).getId()+
":"+result.get(i).getUser_name());
}
}else if(input==2){
Goddess g=new Goddess();
System.out.println("请输入要添加的女神姓名:");
String name=console.next();
System.out.println("请输入要添加的女神的年龄:");
int age=console.nextInt();
System.out.println("请输入要添加的女神的邮箱:");
String email=console.next();
System.out.println("请输入要添加的女神的手机号:");
String telno=console.next();
g.setUser_name(name);
g.setSex(0);
g.setAge(age);
g.setBirthday(new Date());
g.setEmail(email);
g.setMobile(telno);
g.setCreate_user("sys");
g.setUpdate_user("sys");
g.setIsdel(1);
action.add(g);
}else{
System.out.println("222");
}
}
}
-----------------------------------------------------------
package com.zoey.dao;
import java.sql.Connection;
import java.sql.Date;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.List;
import com.zoey.db.DBUtil;
import com.zoey.model.Goddess;
public class GoddessDao {
public List<Goddess> query() throws Exception{
List<Goddess> result=new ArrayList<Goddess>();
Connection conn=DBUtil.getConnection();
StringBuilder sb=new StringBuilder();
sb.append("select id,user_name,age from zoey_goddess ");
PreparedStatement ptmt=conn.prepareStatement(sb.toString());
ResultSet rs=ptmt.executeQuery();
Goddess g=null;
while(rs.next()){
g=new Goddess();
g.setId(rs.getInt("id"));
g.setUser_name(rs.getString("user_name"));
g.setAge(rs.getInt("age"));
result.add(g);
}
return result;
}
public void addGoddess(Goddess g) throws Exception{
Connection conn=DBUtil.getConnection();
String sql="" +
"insert into zoey_goddess"+
"(user_name,sex,age,birthday,email,mobile,"+
"create_user,create_date,update_user,update_date,isdel)"+
"values(" +
"?,?,?,?,?,?,?,current_date(),?,current_date(),?)";
PreparedStatement ptmt=conn.prepareStatement(sql);
System.out.println(sql);
ptmt.setString(1, g.getUser_name());
ptmt.setInt(2, g.getSex());
ptmt.setInt(3, g.getAge());
ptmt.setDate(4, new Date(g.getBirthday().getTime()));
ptmt.setString(5, g.getEmail());
ptmt.setString(6, g.getMobile());
ptmt.setString(7, g.getCreate_user());
ptmt.setString(8, g.getUpdate_user());
ptmt.setInt(9, g.getIsdel());
ptmt.execute();
}
}
----------------------------------------------------------------------
package com.zoey.action;
import java.util.List;
import com.zoey.dao.GoddessDao;
import com.zoey.model.Goddess;
public class GoddessAction {
public void add(Goddess goddess) throws Exception{
GoddessDao dao=new GoddessDao();
dao.addGoddess(goddess);
}
public List<Goddess> query() throws Exception{
GoddessDao dao=new GoddessDao();
return dao.query();
}
}