----要是实现的功能为使用存储过程往mytest表里插入一条数据
create procedure sp_prol is
create or replace procedure sp_prol1 is
begin
insert into mytest('小史','xiaoshi');
end;
/
----调用一个存储过程
exec sp_prol;
----注释:or replace表示如果有了一个存储过程,则替换之前的
-----这一个demo是实现了根据你输入的一个编号,而查找出一个员工的姓名和工资信息,并作了异常处理
declare
----定义变量
v_name varchar2(30);
v_sal number(7,2);
begin
----执行部分
select ename,sal into v_name,v_sal from emp where empno=&no;
---控制台输出
dbms_output.put_line('username:'||v_name || ' 工资:'||v_sal);
---异常处理
exception
when no_data_found then
dbms_output.put_line('你好,输入的数据不存在');
end;