存储过程错误ORA-06550

时间:2013-11-19 02:15:31

标签: sql oracle stored-procedures ora-06550

我使用sqlplus使用此代码收到编译错误。

我的错误是:

  

警告:使用编译错误创建过程。

     

BEGIN point_triangle; END;

     

第1行出错:ORA-06550:第1行第7列:
  PLS-00905:对象POINT_TRIANGLE无效
  ORA-06550:第1行第7栏:
  忽略PL / SQL语句

每当我输入show errors时,它都会告诉我没有错误。

这是代码。

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;
/

假设将所有球员分别放入A和B,并将他们在该球队的职业生涯积分投入C中。我知道查询有效,而不是在程序中。

2 个答案:

答案 0 :(得分:1)

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;
/

答案 1 :(得分:-1)

你可以尝试一下这个:

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;