我正在尝试创建一个返回表的PL SQL,但它不起作用
CREATE PROCEDURE MyProcedure
AS
BEGIN
SELECT * FROM MyTable
END
这是怎么了?谢谢!
答案 0 :(得分:0)
SELECT
语句END
过程必须以;
结尾。
CREATE OR REPLACE PROCEDURE MyProcedure
(
P_Column1 OUT INTEGER,
P_Column2 OUT VARCHAR2,
P_COlumn3 OUT FLOAT
)
AS
BEGIN
SELECT Column1, Column2, Column3
INTO P_Column1, P_Column2, P_Column3
FROM MyTable
WHERE <Condition>;
END;
/
使用CURSOR
:
CREATE PROCEDURE GET_ONESET_CUSTOMERINFO
(
CURSOR_ IN OUT TYPES.REF_CURSOR
)
AS
BEGIN
OPEN CURSOR_ FOR
SELECT * FROM MyTable
WHERE <condition>;
END;
中找到更多示例