Plsql developer 工具创建存储过程,必须要在package 文件下创建存储声明 pa
Plsqldeveloper工具创建存储过程,必须要在package文件下创建存储声明packagebodies目录下创建具体实现方式吗...
Plsql developer 工具创建存储过程,必须要在package 文件下创建存储声明 package bodies目录下创建具体实现方式吗
展开
- 你的回答被采纳后将获得:
- 系统奖励15(财富值+成长值)+难题奖励20(财富值+成长值)
1个回答
展开全部
是的!
给一个例子给你
CREATE OR REPLACE PACKAGE PKG_USER AS
TYPE DEPT_TYPE IS TABLE OF DEPT%ROWTYPE;
PROCEDURE INSERTOPERATE(P_USERTYPE IN DEPT_TYPE);
END PKG_USER;
SELECT S.OBJECT_NAME,S.STATUS FROM ALL_OBJECTS S WHERE S.OBJECT_NAME=UPPER('Pkg_User');
CREATE OR REPLACE PACKAGE BODY PKG_USER IS
PROCEDURE INSERTOPERATE(P_USERTYPE IN DEPT_TYPE) IS
BEGIN
SAVEPOINT AA;
FOR I IN 1 .. P_USERTYPE.COUNT LOOP
INSERT INTO DEPT
(DEPTNO, DNAME, LOC)
VALUES
(P_USERTYPE(I).DEPTNO, P_USERTYPE(I).DNAME, P_USERTYPE(I).LOC);
END LOOP;
COMMIT;
EXCEPTION WHEN OTHERS THEN ROLLBACK TO AA;
END INSERTOPERATE;
END PKG_USER;
给一个例子给你
CREATE OR REPLACE PACKAGE PKG_USER AS
TYPE DEPT_TYPE IS TABLE OF DEPT%ROWTYPE;
PROCEDURE INSERTOPERATE(P_USERTYPE IN DEPT_TYPE);
END PKG_USER;
SELECT S.OBJECT_NAME,S.STATUS FROM ALL_OBJECTS S WHERE S.OBJECT_NAME=UPPER('Pkg_User');
CREATE OR REPLACE PACKAGE BODY PKG_USER IS
PROCEDURE INSERTOPERATE(P_USERTYPE IN DEPT_TYPE) IS
BEGIN
SAVEPOINT AA;
FOR I IN 1 .. P_USERTYPE.COUNT LOOP
INSERT INTO DEPT
(DEPTNO, DNAME, LOC)
VALUES
(P_USERTYPE(I).DEPTNO, P_USERTYPE(I).DNAME, P_USERTYPE(I).LOC);
END LOOP;
COMMIT;
EXCEPTION WHEN OTHERS THEN ROLLBACK TO AA;
END INSERTOPERATE;
END PKG_USER;
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |