看一个建PACKAGE BODY的语句:
CREATE OR REPLACE PACKAGE BODY OSM_DML_3SP.OSM_TAB_PACKPACK7 AS
gpck NUMBER;
PROCEDURE OSM_TAB_PACKPROCTT(f IN OUT NUMBER) AS
BEGIN
SELECT COUNT(*) INTO f FROM OSM_DML_3SP.OSM_TAB_PACK;
IF f < 8039 THEN
INSERT INTO OSM_DML_3SP.OSM_TAB_PACK SELECT * FROM OSM_DML_3SP.OSM_TAB_PACK;
END IF;
END OSM_TAB_PACKPROCTT;
BEGIN -- 为初使化部分
INSERT INTO OSM_DML_3SP.OSM_TAB_PACK(COL_0, COL_5) VALUES(12140, SYSTIMESTAMP);
gpck := 6048;
END OSM_TAB_PACKPACK7;
1>>> 感觉设计的很麻烦BEGIN ... END为什么不成对出现.
如:
CREATE PACKAGE package-name AS
-- add PL/SQL
END;
为什么不设计成:
CREATE PACKAGE package-name AS
BEGIN
-- add PL/SQL
END;
感觉很是麻烦啊!
上面的感觉这样比较好:
CREATE OR REPLACE PACKAGE BODY OSM_DML_3SP.OSM_TAB_PACKPACK7 AS
INSERT INTO OSM_DML_3SP.OSM_TAB_PACK(COL_0, COL_5) VALUES(12140, SYSTIMESTAMP); -- 为初使化部分
gpck := 6048;
BEGIN
gpck NUMBER;
PROCEDURE OSM_TAB_PACKPROCTT(f IN OUT NUMBER) AS
BEGIN
SELECT COUNT(*) INTO f FROM OSM_DML_3SP.OSM_TAB_PACK;
IF f < 8039 THEN
INSERT INTO OSM_DML_3SP.OSM_TAB_PACK SELECT * FROM OSM_DML_3SP.OSM_TAB_PACK;
END IF;
END OSM_TAB_PACKPROCTT;
END OSM_TAB_PACKPACK7;
2>>> AS 与 IS 不知道什么时候用
create function / procedure / package 中AS与IS可以混和用, 但为什么CURSOR中却只可以用IS
CURSOR c1 IS SELECT COL_0 FROM aa;
感觉很是奇怪.
不知道设计PL/SQL人的怎么想的!!!
阅读(1532) | 评论(0) | 转发(0) |