以下plsql程序用的scott用户的dept,emp表. not_data_found例外: --系统列外 set serveroutput on declare pename emp.ename%type; begin ; exception when no_data_found then dbms_output.put_line('没有查到数据'); when others then dbms_output.put_line('其他'); end; / too_many_rows例外: -…
参考: http://blog.csdn.net/haiross/article/details/20612135 Oracle/PLSQL: ORA-06550 Learn the cause and how to resolve the ORA-06550 error message in Oracle. Description When you encounter an ORA-06550 error, the following error message will appear: OR…
在plsql中,存储过程中的out模式的参数可以用来返回数据,相当于函数的返回值.下面是一个小例子. 沿用上一篇的emp表结构和数据. 存储过程如下: create or replace procedure out_test(v_user in emp.user_name%type, v_salary out emp.salary%type, v_deptno out emp.emp_deptno%type) as begin select salary, emp_deptno into v_s…
在写oracle存储过程的时候很多东西放到存储过程里面比如一些判断等,要比在程序逻辑里面简单很多,但是也会涉及到捕获和抛出一样的问题. 捕获异常 语法: 首先定义异常: <异常情况> EXCEPTION; 抛出异常: raise <异常情况>; 处理异常: EXCEPTION WHEN excepttion_name1 then ........ WHEN excepttion_name2 then ........ WHEN excepttion_name3 then ...…