获取此行的以下错误创建一个存储过程,将其作为参数作为行业 ID
CREATE OR REPLACE PROCEDURE businesses (industryid INDUSTRY.INDUSTRYID%TYPE) AS
CURSOR businessloop IS
select tx.UNIONTITLE,b.ABNNUMBER,b.BUSINESSNAME
from business b INNER JOIN business_industry bi
on
b.ABNNUMBER = bi.ABNNUMBER
INNER JOIN industry ind
on
bi.INDUSTRYID = ind.INDUSTRYID
INNER JOIN trade_union tx
on
ind.UNIONID = tx.UNIONID
where
INDUSTRY.INDUSTRYID = industryid;
BEGIN
FOR ptr IN businessloop LOOP
DBMS_OUTPUT.PUT_LINE(ptr.UNIONTITLE);
DBMS_OUTPUT.PUT_LINE(ptr.ABNNUMBER);
DBMS_OUTPUT.PUT_LINE(ptr.BUSINESSNAME);
DBMS_OUTPUT.PUT_LINE('---------------------------');
END LOOP;
end businesses;
/
Execute businesses(6);
我的输出看起来像这样
Errors: PROCEDURE BUSINESSES
Line/Col: 5/1 PL/SQL: SQL Statement ignored
Line/Col: 16/23 PL/SQL: ORA-00918: column ambiguously defined
Line/Col: 26/1 PL/SQL: Statement ignored
Line/Col: 26/22 PLS-00364: loop index variable 'PTR' use is invalid
Line/Col: 27/1 PL/SQL: Statement ignored
Line/Col: 27/22 PLS-00364: loop index variable 'PTR' use is invalid
Line/Col: 28/1 PL/SQL: Statement ignored
Line/Col: 28/22 PLS-00364: loop index variable 'PTR' use is invalid
ORA-06550: line 1, column 7:
PLS-00905: object SQL_PQETEGYQDKCHNVXHUMIWRPLSE.BUSINESSES is invalid
我认为这条线有错误
INDUSTRY.INDUSTRYID = industryid;