create or replace package vendition_pkg is
type mer_row is record
(
id tb_wyh_user_info.user_id%type,
user_name tb_wyh_user_info.user_name%type,
age tb_wyh_user_info.age%type,
area tb_wyh_user_info.area%type,
salary tb_wyh_user_info.salary%type
)
procedure serchcount(userid in varchar2,user_info out mer_row);
procedure updatedata(userid in varchar2,user_salary in number);
end vendition_pkg;
/create or replace package body vendition_pkg is
procedure serchcount (userid in varchar2,user_info out mer_row)is
begin
select a.user_id,a.user_name,a.age,a.area,a.salary into user_info from tb_wyh_user_info a
where a.user_id=userid
exception
when too_many_rows then
dbms_output.put_line('用户编号不是唯一的');
when no_data_found then
dbms_output.put_line('未找到该用户的商品');
when others then
dbms_output.put_line('出现未知错误: '||sqlerrm);
end serchcount;
procedure updatedata(userid in varchar2,user_salary in number) is
exec exception;
begin
if user_salary<=0 then
raise exec;
end if;
update tb_wyh_user_info
set salary=user_salary+1
where user_id=userid;
commit;
exception
when exec then
dbms_output.put_line('输入的工资格无效');
when others then
dbms_output.put_line('无此用户');
end updatedata;
end vendition_pkg;
出现误??? 不知为什么??请各位帮忙、、、感激不尽。。
解决方案 »
- 高分求解决办法
- Oracle实现月数变更,但是最后一天不能变
- Oracle 高级复制问题
- pl-sql语句的问题,求达人解答
- 用VC在已知的数据源中创建Oracle数据表
- 急求两表关联问题~~~~~~!!
- "ORA-00604: 递归 SQL 层 1 出现错误 ORA-00942: 表或视图不存在" 我删除表的一列时报这样的错,有人说是权限的问题,不知是少什么权限?
- oracle中clob字段,我想让它和页面上输入的文字做一个完全匹配
- 请问哪里有ORACLE下载?
- 救救我吧!创建数据库时启动实例出错。
- to_char(sysdate……)的参数设置
- 创建视图时报ORA-00905: missing keyword
--PACKAGE这里
salary tb_wyh_user_info.salary%type
)--少个分号--PACKAGE BODY这里
where a.user_id=userid --少分号
--PROCEDURE UPDATEDATA 里面
EXEC EXCEPTION; --不要用EXEC做变量名称,换一个。
create or replace procedure gife is
begin
insert into mytest values('MARRY,'m123');
Exception
when others then
dbms_output.put_line('格式不对,拒绝插入');
end;
(包)
--创建包sp_package
create package sp_package is
procedure update_sal(name varchar2,newSal number);
function sp_fun(name varchar2) return number;
end;
--实现包sp_package
create or replace package body sp_package is
procedure update_sal(name varchar2,newSal number)
is
begin
update emp set sal=newSal where ename=name;
end;
function sp_fun(name varchar2) return number
is yearSal number;
begin
select sal*12+nvl(comm,0)*12 into yearSal from emp where ename=name;
return yearSal;
end;
end;