Plsql developer 工具创建存储过程,必须要在package 文件下创建存储声明 pa
答案:1 悬赏:0 手机版
解决时间 2021-01-31 08:16
- 提问者网友:爱了却不能说
- 2021-01-30 21:09
Plsql developer 工具创建存储过程,必须要在package 文件下创建存储声明 pa
最佳答案
- 五星知识达人网友:一袍清酒付
- 2021-01-30 21:21
是的!
给一个例子给你
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;
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯