用oracle创建一个包 实现表的增删改查 用过程和函数实现。

就是要写出具体的步骤代码能运行出结果谢了... 就是要写出具体的步骤代码 能运行出结果 谢了 展开
 我来答
匿名用户
2013-11-15
展开全部
create or replace package UBS_USER_PKG is

type user_record_type is record
(
userID number(4),
username varchar2(20),
createdate date,
deptID number(4),
gender number(1),
job varchar2(30),
remarks varchar2(200),
birthday date,
jobexperience varchar2(200),
education varchar2(200),
relationship varchar2(200)
);

type user_ref_cursor is ref cursor return user_record_type;
type user_table_type is table of user_record_type index by binary_integer;

procedure user_query(dmlset in out user_ref_cursor);
procedure user_lock(dmlset in out user_table_type);
procedure user_insert(dmlset in out user_table_type);
procedure user_update(dmlset in out user_table_type);
procedure user_delete(dmlset in out user_table_type);

end UBS_USER_PKG;
/
create or replace package body UBS_USER_PKG is

procedure user_query(dmlset in out user_ref_cursor) is
begin

open dmlset for

select

userid,
username,
createdate,
deptid,
gender,
job,
remarks,
birthday,
jobexperience,
education,
relationship

from ubs_user;

end;

procedure user_lock(dmlset in out user_table_type) is
userID_holder number;
begin

select userID into userID_holder from ubs_user where userID=dmlset(1).userID for update;

end;

procedure user_insert(dmlset in out user_table_type) is
begin

insert into ubs_user
(
userid,
username,
createdate,
deptid,
gender,
job,
remarks,
birthday,
jobexperience,
education,
relationship
)
values
(
dmlset(1).userid,
dmlset(1).username,
dmlset(1).createdate,
dmlset(1).gender,
dmlset(1).job,
dmlset(1).remarks,
dmlset(1).birthday,
dmlset(1).jobexperience,
dmlset(1).education,
dmlset(1).education,
dmlset(1).relationship
);

end;

procedure user_update(dmlset in out user_table_type) is
begin
update ubs_user set
本回答被网友采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式