Search code examples
sqloraclestored-proceduresora-06550

Stored Procedure error ORA-06550


I'm getting compile errors with this code using 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

Whenever I type show errors, it tells me there are no 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.


Solution

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