如何使refcursor结果/输出显示为文本? [英] How to get refcursor result/output to show as text?
问题描述
我正在尝试在Oracle中调用存储过程并显示调用结果,问题是它在行FETCH v_cur into v_a;
上崩溃,错误为:ORA-06504: PL/SQL: Return types of Result Set variables or query do not match.
I'm trying to call a stored procedure in Oracle and show the results of the call, the problem is that it crashes on the line FETCH v_cur into v_a;
with error: ORA-06504: PL/SQL: Return types of Result Set variables or query do not match.
我猜查询的输出与v_a VARCHAR2(100)
不匹配,但是我不知道该放在哪里.被调用的存储过程将多个表联接在一起,并选择属于不同表的20多个不同的列.因此,我想要的是仅查看查询的输出,而不必分别引用每个结果列.我将如何去做呢?
I guess the output of the query does not match v_a VARCHAR2(100)
, but I don't know what to put there instead. The stored procedure that's being called does a join of several tables and selects more than 20+ different columns belonging to different tables. So what I would want is to just view the output of the query without having to refer to each result column separately. How I would go and do this ?
我正在使用SQL Navigator(我想不是很重要).
I'm using SQL Navigator (not that important I guess).
DECLARE
v_cur SYS_REFCURSOR;
v_a VARCHAR2(100);
BEGIN
pkg_get_results.get_rows(v_cur,to_date('2012/04/12', 'yyyy/mm/dd'),to_date('2012/04/12', 'yyyy/mm/dd'), '','','','');
LOOP
FETCH v_cur into v_a; -- what to put here ?
EXIT WHEN v_cur%NOTFOUND;
dbms_output.put_line(v_a );
END LOOP;
CLOSE v_cur;
END;
推荐答案
SQL Navigator确实可以为您执行此操作.确切的操作方法取决于您的Navigator版本,并且可以想到(尽管我不知道)某些版本可能没有它.
SQL Navigator does have the ability to do this for you. How to do it exactly depends on your version of Navigator, and it's conceivable (though I don't know) some versions may not have it.
可以在此线程中找到说明: http://sqlnavigator.inside. quest.com/thread.jspa?threadID=2466
Instructions can be found in this thread: http://sqlnavigator.inside.quest.com/thread.jspa?threadID=2466
顺便说一下,Toad也具有这种能力.
Incidentally, Toad also has this ability.
这篇关于如何使refcursor结果/输出显示为文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!