发布网友 发布时间:2023-07-21 11:52
共3个回答
热心网友 时间:2024-12-14 08:15
定义一个数据类型是游标热心网友 时间:2024-12-14 08:15
CREATE OR REPLACE PROCEDURE OPE_SELECT (热心网友 时间:2024-12-14 08:15
返回数据集,用游标吧。追问用游标 上面的代码应该怎么写追答定义一个包,在包头里定义游标变量。
create or replace package PKG_TEST as
type MYCURSOR is REF CURSOR;
PROCEDURE OPE_SELECT (
loginname_i in TBL_OPERATEINFO.loginname%type,
CUR_OUT OUT MYCURSOR) ;
end PKG_TEST;
在包体内写代码:
create or replace package body PKG_TEST as
PROCEDURE OPE_SELECT (
loginname_i in TBL_OPERATEINFO.loginname%type,
CUR_OUT OUT MYCURSOR) AS
BEGIN
OPEN cur_OUT FOR SELECT name FROM TBL_OPERATEINFO WHERE loginname LIKE '%' || loginname_i || '%' ;
END OPE_SELECT;
end PKG_TEST;