创建 PROCEDURE :
CREATE OR REPLACE PROCEDURE taog (p_ip IN VARCHAR2, ref1 out SYS_REFCURSOR)
IS
BEGIN
OPEN ref1 FOR
SELECT *
FROM oms_ads_iplist
WHERE (ip = p_ip or p_ip is null);
EXCEPTION
WHEN NO_DATA_FOUND
THEN
NULL;
WHEN OTHERS
THEN
-- Consider logging the error and then re-raise
RAISE;
END taog;
IS
BEGIN
OPEN ref1 FOR
SELECT *
FROM oms_ads_iplist
WHERE (ip = p_ip or p_ip is null);
EXCEPTION
WHEN NO_DATA_FOUND
THEN
NULL;
WHEN OTHERS
THEN
-- Consider logging the error and then re-raise
RAISE;
END taog;
PLSQL调用:
var cur refcursor;
exec taog(null,:cur);
print cur;
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/22392018/viewspace-687163/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/22392018/viewspace-687163/