这是我的 oracle 11g XE 的 pl/sql 代码。我该如何解决这个问题我想同时运行两个选择查询请帮助我....它们作为单个程序工作。
CREATE OR REPLACE PACKAGE myproc
as
PROCEDURE TestProc (p_recordset OUT SYS_REFCURSOR, lock_s OUT SYS_REFCURSOR);
END myproc;
/
CREATE OR REPLACE PACKAGE BODY myproc
IS
PROCEDURE TestProc (p_recordset OUT SYS_REFCURSOR, lock_s OUT SYS_REFCURSOR)
AS
BEGIN
OPEN p_recordset FOR
select a.TABLESPACE_NAME as Tablespace,
round((1-((a.BYTES-nvl(b.BYTES,0))/a.BYTES))*100,2) AS Percentages
from (select TABLESPACE_NAME, sum(BYTES) BYTES
from sys.dba_data_files
group by TABLESPACE_NAME) a,
(select TABLESPACE_NAME, sum(BYTES) BYTES
from sys.dba_free_space
group by TABLESPACE_NAME) b
where a.TABLESPACE_NAME = b.TABLESPACE_NAME (+)
order by ((a.BYTES-b.BYTES)/a.BYTES) desc;
SELECT vh.sid locking_sid,
vw.sid waiter_sid,
vs.status status,
vs.program program_holding,
vsw.program program_waiting
FROM v$lock vh, v$lock vw, v$session vs, v$session vsw
WHERE (vh.id1, vh.id2) IN (SELECT id1, id2
FROM v$lock
WHERE request = 0
INTERSECT
SELECT id1, id2
FROM v$lock WHERE lmode = 0)
AND vh.id1 = vw.id1
AND vh.id2 = vw.id2
AND vh.request = 0
AND vw.lmode = 0
AND vh.sid = vs.sid
AND vw.sid = vsw.sid;
end;
end;
/
错误信息是:-
警告:包体创建时出现编译错误。
SQL> show error
Errors for PACKAGE BODY MYPROC:<br/>
LINE/COL ERROR
-------- -----------------------------------------------------------------
13/4 PLS-00428: an INTO clause is expected in this SELECT statement
SQL>