日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 >

oracle类型不匹配,sys_refcursor的使用,报错类型不匹配

發布時間:2023/12/19 58 豆豆
生活随笔 收集整理的這篇文章主要介紹了 oracle类型不匹配,sys_refcursor的使用,报错类型不匹配 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

---------------------------------------------------------------------------------------------------------------以下是數據源

Connected to Oracle Database 11g Enterprise Edition Release 11.2.0.1.0

Connected as scott@ORCL

SQL> desc dept1;

Name? ?Type? ?? ?? ?Nullable Default Comments

------ ------------ -------- ------- --------

DEPTNO NUMBER(2)? ? Y

DNAME??VARCHAR2(14) Y

LOC? ? VARCHAR2(13) Y

SQL> select * from dept1;

DEPTNO DNAME? ?? ?? ? LOC

------ -------------- -------------

10 ACCOUNTING? ???NEW YORK

20 RESEARCH? ?? ? DALLAS

30 SALES? ?? ?? ? CHICAGO

40 OPERATIONS? ???BOSTON

-----------------------------------------------------------------------------------------------------------以下是定義 type 和存儲過程

create type p_table is object (??----------類型1

deptno NUMBER(2) ,

dname??VARCHAR2(14),

loc? ? VARCHAR2(13)

);

create type use_p_table is table of p_table; -----------類型2

create or replace procedure up_test(o out sys_refcursor) is ----存儲過程1

begin

open o for select * from dept1;

end;

create or replace procedure use_sys_ref is -------- 存儲過程2

o sys_refcursor;

test_table use_p_table;

begin

up_test(o);

fetch o bulk collect into test_table;

for i in 1..test_table.count loop

dbms_output.put_line(test_table(i).deptno||''||test_table(i).dname||''||test_table(i).loc);

end loop;

end;

--------------------------------------------------------------------------------------------------------------------------------以下是調用

begin

use_sys_ref;

end;

----------------------------------------------------------------以下是報錯

ora-06504

l/sql:結果集變量或查詢的返回類型不匹配

總結

以上是生活随笔為你收集整理的oracle类型不匹配,sys_refcursor的使用,报错类型不匹配的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。