用于查询Oracle的管道行

时间:2014-02-20 12:18:45

标签: oracle plsql

我有一个查询,其中我使用调试DBMS_OUTPUT来显示数据, 但它只适用于调试模式,

set serveroutput on;
DECLARE
    CURSOR MyCursor IS 
      select distinct AccountID, AccountName from Account where rownum < 10;
    TYPE Temp_Account IS TABLE OF MyCursor%ROWTYPE INDEX BY PLS_INTEGER;
    All_Accounts Temp_Account;
BEGIN    
Open MyCursor;
  Fetch MyCursor BULK COLLECT INTO All_Accounts;
  CLOSE MyCursor;
  for i in All_Accounts.first .. All_Accounts.last loop   
    DBMS_OUTPUT.PUT_LINE(All_Accounts(i).AccountName);
  end loop;  
END ;

我尝试使用显示数据 管道行(All_Accounts(i))但它仅适用于函数,

DECLARE
    CURSOR MyCursor IS 
      select distinct AccountID, AccountName from Account where rownum < 10;
    TYPE Temp_Account IS TABLE OF MyCursor%ROWTYPE INDEX BY PLS_INTEGER;
    All_Accounts Temp_Account;
BEGIN    
  Open MyCursor;
  Fetch MyCursor BULK COLLECT INTO All_Accounts;
  CLOSE MyCursor;
  for i in All_Accounts.first .. All_Accounts.last loop   
    pipe row(All_Accounts(i));
  end loop;  
END ;

我的问题是: 在运行时(非调试)模式下,我可以显示我的结果行集 没有使用管排? 我是PL / SQL的初学者,所以请帮忙......谢谢

0 个答案:

没有答案