table 集合物件

2021-07-08 10:17:55 字數 1762 閱讀 6868

說明:table()必須使用schema級別的集合物件

sql> declare

2type t_nstbl is table of varchar2(20);  --本地

3    v_nstbl t_nstbl;

4    csr sys_refcursor;

5    vlu varchar2(20);

6  begin

7    v_nstbl:=t_nstbl('a','b','c');

8    open csr for select * from (table(v_nstbl));

9    loop

10      fetch csr into vlu;

11      exit when csr%notfound;

12      dbms_output.put_line(vlu);

13    end loop;

14  end;

15  /

declare

type t_nstbl is table of varchar2(20);

v_nstbl t_nstbl;

csr sys_refcursor;

vlu varchar2(20);

begin

v_nstbl:=t_nstbl('a','b','c');

open csr for select * from (table(v_nstbl));

loop

fetch csr into vlu;

exit when csr%notfound;

dbms_output.put_line(vlu);

end loop;

end;

ora-06550: 第 8 行, 第 37 列: 

pls-00642: 在 sql 語句中不允許使用本地收集型別

ora-06550: 第 8 行, 第 31 列: 

pl/sql: ora-22905: 無法從非巢狀表項訪問行

ora-06550: 第 8 行, 第 16 列: 

pl/sql: sql statement ignored

sql> create or replace type t_nstbl is table of varchar2(20);--schema級別

2  /

type created

sql> declare

2   -- type t_nstbl is table of varchar2(20);

3    v_nstbl t_nstbl;

4    csr sys_refcursor;

5    vlu varchar2(20);

6  begin

7    v_nstbl:=t_nstbl('a','b','c');

8    open csr for select * from (table(v_nstbl));

9    loop

10      fetch csr into vlu;

11      exit when csr%notfound;

12      dbms_output.put_line(vlu);

13    end loop;

14  end;

15  /ab

cpl/sql procedure successfully completed

Table物件集合

table物件集合 table物件 表示html文件中的表,對於文件中每個標記,瀏覽器都建立乙個table物件.集合 描述 cells 獲取包含 中所有單元格的陣列 rows 獲取包含 中所有行的陣列 tbodies 獲取包含 中所有tbody的陣列 table物件屬性 border 設定或獲取 邊...

Oracle 方法返回集合型別 table

img 以scott.emp 為例,根據職位 mgr 編號,查出該職位編號的所有資訊 先建立型別 相當於每一行記錄的型別 可以理解為 scott.emp rowtype 1.create or replace type my record is object empno number 4 ename...

列印Lua的Table物件

小夥伴們再也不用為列印lua的table物件而苦惱了,本人曾也苦惱過,哈哈 不過今天剛完成了這個東西,以前在網上搜過列印table的指令碼,但是都感覺很不理想,於是,自己造輪子了 列印的效果,自己感覺還比較慢,不敢私藏,趕緊分享.如有更好的更改,歡迎討論,優化 以下指令碼儲存到檔案 dumptabl...