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 then dbms_output.put_line('数据太多'); when no_data_found then dbms_output.put_line('没有找到数据'); when invalid_cursor then dbms_output.put_line('无效的游标'); when zero_divide then dbms_output.put_line('除数为零'); when dup_val_on_index then dbms_output.put_line('唯一索引中插入了重复行'); when others then dbms_output.put_line('出现异常'); end; begin prc_get_sex('张三'); end;