SQL 存储过程错误 ORA-06550
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/20061863/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Stored Procedure error ORA-06550
提问by user3002669
I'm getting compile errors with this code using sqlplus.
我使用 sqlplus 收到此代码的编译错误。
My errors are:
我的错误是:
Warning: Procedure created with compilation errors.
BEGIN point_triangle; END;
Error at line 1: ORA-06550: Line 1, column 7:
PLS-00905: object POINT_TRIANGLE is invalid
ORA-06550: line 1, column 7:
PL/SQL Statement ignored
警告:创建的过程有编译错误。
BEGIN point_triangle; 结尾;
第 1 行错误:ORA-06550:第 1 行,第 7 列:
PLS-00905:对象 POINT_TRIANGLE 无效
ORA-06550:第 1 行,第 7 列:
PL/SQL 语句被忽略
Whenever I type show errors, it tells me there are no errors.
每当我输入 show errors 时,它都会告诉我没有错误。
Here is the code.
这是代码。
create or replace procedure point_triangle
AS
A VARCHAR2(30);
B VARCHAR2(30);
C INT;
BEGIN
FOR thisteam in (select P.FIRSTNAME into A from PLAYERREGULARSEASON P where P.TEAM = 'IND' group by P.FIRSTNAME, P.LASTNAME order by SUM(P.PTS) DESC)
(select P.LASTNAME into B from PLAYERREGULARSEASON P where P.TEAM = 'IND' group by P.FIRSTNAME, P.LASTNAME order by SUM(P.PTS) DESC)
(select SUM(P.PTS) into C from PLAYERREGULARSEASON P where P.TEAM = 'IND' group by P.FIRSTNAME, P.LASTNAME order by SUM(P.PTS) DESC);
LOOP
dbms_output.put_line(A|| ' ' || B || ':' || C);
END LOOP;
END;
/
it is suppose to put all the players into A and B with their points of their career on that team into the C. I know the queries work, just not in the procedure.
假设将所有球员放入 A 和 B,并将他们在该团队的职业生涯积分放入 C。我知道查询有效,只是程序中没有。
采纳答案by The Hungry Dictator
create or replace procedure point_triangle
AS
BEGIN
FOR thisteam in (select FIRSTNAME,LASTNAME,SUM(PTS) from PLAYERREGULARSEASON where TEAM = 'IND' group by FIRSTNAME, LASTNAME order by SUM(PTS) DESC)
LOOP
dbms_output.put_line(thisteam.FIRSTNAME|| ' ' || thisteam.LASTNAME || ':' || thisteam.PTS);
END LOOP;
END;
/
回答by Sergey N Lukin
Could you try this one:
你可以试试这个:
create or replace
procedure point_triangle
IS
BEGIN
FOR thisteam in (select P.FIRSTNAME,P.LASTNAME, SUM(P.PTS) S from PLAYERREGULARSEASON P where P.TEAM = 'IND' group by P.FIRSTNAME, P.LASTNAME order by SUM(P.PTS) DESC)
LOOP
dbms_output.put_line(thisteam.FIRSTNAME|| ' ' || thisteam.LASTNAME || ':' || thisteam.S);
END LOOP;
END;