我正在尝试使用Oracle SQL开发人员中的简单存储过程来获取表“empDetails”的结果。以下是SP定义
create or replace
PROCEDURE TEST_ALL (all_Cursor OUT SYS_REFCURSOR ) AS
BEGIN
open all_Cursor for
select * from empDetails;
END TEST_ALL;
当我执行存储过程时,我无法在输出结果选项卡中查看输出。
但我可以通过直接SQL查询select * from empDetails;
有任何线索吗?
答案 0 :(得分:2)
使用这种方式:
declare
a SYS_REFCURSOR;
v_emp_detls empDetails%rowtype;
begin
TEST_ALL (all_Cursor=>a );
loop
FETCH a INTO v_emp_detls;
EXIT WHEN a%NOTFOUND;
DBMS_OUTPUT.PUT_LINE(v_emp_detls.col1||v_emp_detls.col2..and so on);
end loop;
end;
答案 1 :(得分:1)
另一种方法是使用以下内容:
$stmt1 = $user_home->runQuery("SELECT * FROM order_details WHERE dproduct_id=:pid and designerorder_id=:doid");
$stmt1->execute(array(
":doid" => $orderData->getIncrementId(),
":pid" => $orderitemsarray[$k],
));
$paid_status='';
while($datas = $stmt1->fetch())
{
$paid_status=$datas['dpaid_status'];
}
//added new lines of code here - START
if ( $paid_status == ''){
$paid_status='unpaid';
}
//added new lines of code here - END
$responce[] = array(
$paid_status
);
适用于SQL * Plus和大多数其他GUI,允许您将上述内容作为脚本运行(例如SQL Developer,Toad等)