-
插入:
1 CREATE OR REPLACE Procedure p_insert_t_stu --存储过程名称
2 (
3 p_stuid in Number,
4 p_stuname in Nvarchar2,
5 p_stusex in Nvarchar2,
6 p_stuadd in Nvarchar2
7 )
8 as
9 BEGIN
10 insert into t_stu
11 values
12 (p_stuid,p_stuname,p_stusex,p_stuadd);
13 commit;
14 end;
删除:
1 CREATE OR REPLACE Procedure p_delete_t_stu --存储过程名称
2 (
3 p_stuid in Number,
4 p_msg Out Nvarchar2
5 )
6 Is
7 flag Integer := 1;
8 v_stuid Number;
9 Begin
10 Select flag Into v_stuid From t_stu Where stuid=p_stuid;
11 Delete t_stu
12 Where
13 stuid=p_stuid;
14 commit;
15 If flag=1 Then
16 Begin
17 p_msg:='删除成功'; 18 End;
19 End If;
20 Exception 21 When Others Then
22 p_msg:=Sqlerrm || ',' || '删除失败';
23 END;
修改:
1 CREATE OR REPLACE Procedure p_update_t_stu --存储过程名称
2 (
3 p_stuid in Number,
4 p_stuname in Nvarchar2,
5 p_stusex in Nvarchar2,
6 p_stuadd in Nvarchar2
7 )
8 as
9 BEGIN
10 Update t_stu Set stuname=p_stuname,stusex=p_stusex,stuadd=p_stuadd
11 Where
12 stuid=p_stuid;
13 commit;
14 end;