sql脚本:
create table T_TB0606609_score(
stu_id varchar2(20),
cour_id varchar2(20),
cour_name varchar2(20),
score varchar2(20),
constraint p_score primary key(cour_id)
);
create or replace procedure p_del_score(
stu_id varchar2,
cour_id varchar2,
cour_name varchar2,
score varchar2,
)
is
begin
delete from T_TB0606609_score where p_stu_id=stu_id;
commit;
end p_del_score;
JAVA调用:
public void delScore(String studentId) {
conn = DBHelper.getConnection();
sql = "{call p_del_score(?)}";
try {
cstmt = conn.prepareCall(sql);
cstmt.setString(1, studentID);
cstmt.executeUpdate();
System.out.println("增加数据成功");
} catch (SQLException e) {
// TODO 自动生成 catch 块
e.printStackTrace();
} finally {
try {
if (conn != null)
conn.close();
} catch (SQLException e) {
// TODO 自动生成 catch 块
e.printStackTrace();
}
}
}
谢谢指教!