梦幻之旅

DEBUG - 天道酬勤

   :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理 ::
  671 随笔 :: 6 文章 :: 256 评论 :: 0 Trackbacks
1.一个简单的存储过程
create or replace procedure pro_sample(
    i_number1 
in number default 0,
    i_number2 
in number default 0,
    o_result out 
varchar2)
is
    i_result 
number;
begin
    i_result :
= i_number1 / i_number2;
    o_result :
= i_number1||'/'||i_number2||'='||i_result;
    exception
        
when others then
            o_result:
='除数不能为0';
end pro_sample;


2.调试
如果plsql develope 工具调试存储时  始终是灰色,请考虑,本用户是否有调试存储的权限.
如果没有权限请执行以下sql语句
GRANT debug any procedure, debug connect session TO test;

3.plssql的一些总结
1).流程控制1
  if 条件 then
     执行语句
  else if 条件 then
     执行语句
  else if 条件  then
    执行语句
  else
    执行语句
  end if;
2).流程控制2
   1.case 检测
      case 检测表达式
          when  value1 then
              执行语句
          when value2 then
             执行语句
          else
              执行语句
     end case;
   2.case 搜索式
      case
          when  条件1 then
              执行语句
          when 条件2 then
              执行语句
          when 条件2 then
             执行语句
          else
             执行语句
       end case  
3).循环
   1. 简单循环
    loop 
      执行语句
    exite when 条件
   end loop;

   2.while 循环
    while 条件 loop
       执行语句
     end loop;

   3.for in循环
     for  变量  in  下限..上限 loop
        执行语句
     end loop;
      
   

posted on 2011-07-06 16:00 HUIKK 阅读(2191) 评论(0)  编辑  收藏 所属分类: DataBase

只有注册用户登录后才能发表评论。


网站导航: