异常处理create or replace procedure prc_get_sex (stuname student.name%type) as stusex student.sex%type; begin select sex into stusex from student where name=stuname; dbms_output.put_line('学生' || stuname || '的性别为:' || stusex); exception when too_many_rows…
异常的语法格式 在begin语句内: exception when then when then when others then --异常处理 --首先创建一份对象的用法 create type xtype as object (name varchar2(20)); declare x xtype; begin x.name:='aaa'; exception when ACCESS_INTO_NULL then dbms_output.put_line('init x first'); e…
create or replace function MD5(passwd in varchar2) return varchar2 is retval ); begin retval := utl_raw.cast_to_raw(DBMS_OBFUSCATION_TOOLKIT.MD5(INPUT_STRING => passwd)) ; return retval; end MD5; 用法: select MD5(password) from table;…
比如表结构数据如下: Table:Tree ID Name ParentId 1 一级 0 2 二级 1 3 三级 2 4 四级 3 SQL SERVER 2005查询方法: //上查 with tmpTree as ( select * from Tree where Id=2 union all select p.* from tmpTree inner join Tree p on p.Id=tmpTree.ParentId ) select * from tmpTree //下查…