USP_CA_GETAORHCAMPAIGNS( PI_SERIALNO => PI_SERIALNO, MY_CUR => MY_CUR ); --OPEN MY_CUR;已经打开了 LOOP fetch MY_CUR into temp; exit when MY_CUR%notfound; DBMS_OUTPUT.PUT_LINE('MY_CUR = ' || temp.analystno); END LOOP; END;
Error report - ORA-06504: PL/SQL: Return types of Result Set variables or query do not match ORA-06512: at line 14 06504. 00000 - "PL/SQL: Return types of Result Set variables or query do not match" *Cause: Number and/or types of columns in a query does not match declared return type of a result set variable, or declared types of two Result Set variables do not match. *Action: Change the program statement or declaration. Verify what query the variable actually refers to during execution.请问,这个是什么原因造成的???
Error report - ORA-06504: PL/SQL: Return types of Result Set variables or query do not match ORA-06512: at line 14 06504. 00000 - "PL/SQL: Return types of Result Set variables or query do not match" *Cause: Number and/or types of columns in a query does not match declared return type of a result set variable, or declared types of two Result Set variables do not match. *Action: Change the program statement or declaration. Verify what query the variable actually refers to during execution.请问,这个是什么原因造成的???能不能把你的存储过程贴出来?
DECLARE
PI_SERIALNO VARCHAR2(200);
MY_CUR sys_refcursor;
BEGIN
PI_SERIALNO := '2003004495'; USP_CA_GETAORHCAMPAIGNS(
PI_SERIALNO => PI_SERIALNO,
MY_CUR => MY_CUR
);
/* Legacy output:
DBMS_OUTPUT.PUT_LINE('MY_CUR = ' || MY_CUR);
*/
:MY_CUR := MY_CUR; --<-- Cursor
--rollback;
END;但是执行结果是
Bind Variable "MY_CUR" is NOT DECLARED
anonymous block completed请问问题出在哪里?
DECLARE
PI_SERIALNO VARCHAR2(200);
MY_CUR sys_refcursor;
BEGIN
PI_SERIALNO := '2003004495'; USP_CA_GETAORHCAMPAIGNS(
PI_SERIALNO => PI_SERIALNO,
MY_CUR => MY_CUR
);
/* Legacy output:
DBMS_OUTPUT.PUT_LINE('MY_CUR = ' || MY_CUR);
*/
--:MY_CUR := MY_CUR; --<-- Cursor
/**do something using MY_CUR*/
--rollback;
END;
刚刚接触PLSQL,不怎么熟悉。USP_CA_GETAORHCAMPAIGNS这个存储过程的作用是,向CAMPAIGN表按一定条件取出数据。我怎么循环呢?下边的代码总是报错。
DECLARE
PI_SERIALNO VARCHAR2(200);
MY_CUR sys_refcursor;
temp vp_campaign%rowtype;
BEGIN
PI_SERIALNO := '2003004495'; USP_CA_GETAORHCAMPAIGNS(
PI_SERIALNO => PI_SERIALNO,
MY_CUR => MY_CUR
);
OPEN MY_CUR;
LOOP
fetch MY_CUR into temp;
exit when MY_CUR%notfound;
DBMS_OUTPUT.PUT_LINE('MY_CUR = ' || temp.analystno);
END LOOP;
END;
那个在开头不是declare了吗,我又忘了什么吗?
PI_SERIALNO VARCHAR2(200);
MY_CUR sys_refcursor;
temp vp_campaign%rowtype;
BEGIN
PI_SERIALNO := '2003004495';
USP_CA_GETAORHCAMPAIGNS(
PI_SERIALNO => PI_SERIALNO,
MY_CUR => MY_CUR
);
--OPEN MY_CUR;已经打开了
LOOP
fetch MY_CUR into temp;
exit when MY_CUR%notfound;
DBMS_OUTPUT.PUT_LINE('MY_CUR = ' || temp.analystno);
END LOOP;
END;
Error report -
ORA-06504: PL/SQL: Return types of Result Set variables or query do not match
ORA-06512: at line 14
06504. 00000 - "PL/SQL: Return types of Result Set variables or query do not match"
*Cause: Number and/or types of columns in a query does not match declared
return type of a result set variable, or declared types of two Result
Set variables do not match.
*Action: Change the program statement or declaration. Verify what query the variable
actually refers to during execution.请问,这个是什么原因造成的???
Error report -
ORA-06504: PL/SQL: Return types of Result Set variables or query do not match
ORA-06512: at line 14
06504. 00000 - "PL/SQL: Return types of Result Set variables or query do not match"
*Cause: Number and/or types of columns in a query does not match declared
return type of a result set variable, or declared types of two Result
Set variables do not match.
*Action: Change the program statement or declaration. Verify what query the variable
actually refers to during execution.请问,这个是什么原因造成的???能不能把你的存储过程贴出来?