Oracle数据库操作存储Oracle认证考试
文章作者 100test 发表时间 2011:03:01 00:11:27
来源 100Test.Com百考试题网
  插入:
  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_0delete_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_0update_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.
  编辑特别推荐: 
  #0000ff>ORACLE建表时提示缺少右括号
  #0000ff>常用的SQL注射语句解析 
  #0000ff>Oracle提议基于开放标准的云管理API