论坛首页 入门技术论坛

procedure example of oracle procedure

浏览 2239 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (2) :: 隐藏帖 (0)
作者 正文
   发表时间:2009-09-14  

Some example for memory.

create or replace procedure TQ_FirstProc is
  classname_value class %rowtype;
begin
  select * into classname_value from class where class_id='2';
  dbms_output.put_line(classname_value.class_number);
end TQ_FirstProc;

create or replace procedure TQ_Proc2 is
  classname class.class_name%type;
  remark class.class_remark%type;
begin 
  select class.class_name into classname from class where class.class_number = 1003;
  if classname = 'Grade one' then
     remark := '5 students';
     elsif classname = 'Grade two' then
     remark := '10 students';
     else
     remark := '15 students';
 end if;
     update class set class_remark = remark where class.class_number = 1003;
     commit;
end TQ_Proc2;

create or replace procedure TQ_PROC3 is
  num NUMBER(3):=5;
  rus number(5):=1;
begin
  for i in 1..num loop
    rus := rus*i;
    end loop;
    dbms_output.put_line((rus));
end TQ_PROC3;

 

论坛首页 入门技术版

跳转论坛:
Global site tag (gtag.js) - Google Analytics