public static boolean deleteEmployee( String empId )
{
PreparedStatement pstmt=null;
ResultSet rs=null;
try
{
String sql="delete from emp where empno=?";
pstmt=ConnectionFctory.getConnection().prepareStatement(sql);
pstmt.setInt(1, Integer.valueOf(empId));
rs=pstmt.executeQuery();
while(rs.next())
{
if(rs.getInt(Integer.valueOf(empId))!=0)
return true;
else
return false;
}
rs.close();
pstmt.close();
}catch(SQLException se)
{
System.out.println("删除员工出错!"+se.getMessage());
}
return false;
}各位前辈,为什么小弟运行后就出现:
删除员工出错!ORA-01002: 提取违反顺序???????????????????
{
PreparedStatement pstmt=null;
ResultSet rs=null;
try
{
String sql="delete from emp where empno=?";
pstmt=ConnectionFctory.getConnection().prepareStatement(sql);
pstmt.setInt(1, Integer.valueOf(empId));
rs=pstmt.executeQuery();
while(rs.next())
{
if(rs.getInt(Integer.valueOf(empId))!=0)
return true;
else
return false;
}
rs.close();
pstmt.close();
}catch(SQLException se)
{
System.out.println("删除员工出错!"+se.getMessage());
}
return false;
}各位前辈,为什么小弟运行后就出现:
删除员工出错!ORA-01002: 提取违反顺序???????????????????
解决方案 »
- javascript中的数据类型 分析
- 笔试题:有多少种情况会引发IllegalMonitorStateException抛出
- Thread跟Runable有什么区别?
- 请教高手关于SMSLIB发短息的问题!
- 求教JTextPane的两个问题!
- 请问Class.getMethod()方法问题
- 中文问题!
- 为什么我的jbuildr中的dbpilotW.exe无法与我的mysql连接?
- 一个关于String的问题
- 请问:为什么我的窗口没有显示滚动条,怎样才能正确显示?附源代码!
- java输入文件是按字节的,我想从键盘输入5个整数存入txt文件,请高手帮忙改改下面的代码
- SWT的TabFolder与TabItem的使用问题
楼主【goopoolzl】截止到2008-07-25 23:05:38的历史汇总数据(不包括此帖):
发帖的总数量:12 发帖的总分数:220 每贴平均分数:18
回帖的总数量:7 得分贴总数量:0 回帖的得分率:0%
结贴的总数量:12 结贴的总分数:220
无满意结贴数:1 无满意结贴分:20
未结的帖子数:0 未结的总分数:0
结贴的百分比:100.00% 结分的百分比:100.00%
无满意结贴率:8.33 % 无满意结分率:9.09 %
敬礼!
Cause: This error means that a fetch has been attempted from a cursor which is no longer valid. Note that a PL/SQL cursor loop implicitly does fetches, and thus may also cause this error. There are a number of possible causes for this error, including: 1) Fetching from a cursor after the last row has been retrieved and the ORA-1403 error returned. 2) If the cursor has been opened with the FOR UPDATE clause, fetching after a COMMIT has been issued will return the error. 3) Rebinding any placeholders in the SQL statement, then issuing a fetch before reexecuting the statement.
Action: 1) Do not issue a fetch statement after the last row has been retrieved - there are no more rows to fetch. 2) Do not issue a COMMIT inside a fetch loop for a cursor that has been opened FOR UPDATE. 3) Reexecute the statement after rebinding, then attempt to fetch again.
int delNum = pstmt.executeUpdate();
{
PreparedStatement pstmt=null;
ResultSet rs=null;
try
{
String sql="delete from emp where empno=?";
pstmt=ConnectionFctory.getConnection().prepareStatement(sql);
pstmt.setString(1, empId);
int del=pstmt.executeUpdate();
if(del!=0)
{
pstmt.close();
return true;
}
else
return false;
}catch(SQLException se)
{
System.out.println("删除员工出错!"+se.getMessage());
}
return false;
}是这样吗?