im working in pl/sql and I keep getting the error componet 'first' must be declared, and i have no idea why...
here is my code for my cursor and proc
here is my code for my cursor and proc
Code:
cursor cGetTeamStats is
select *
from varsity.soccer_period_results
where game_code = p_GameCode;
type team_stats_1d is table of cGetTeamStats%rowtype index by varsity.soccer_period_results.team_id%type;
type team_stats_2d is table of team_stats_1d index by pls_integer;
aTeamStats team_stats_1d;
xTeamStats team_stats_2d;
Code:
procedure pWriteTeamStats(tTeamID in varchar2, tTeamType in varchar2, iIndent in number) as
iCurrStatType number;
tCurrTeamID varsity.soccer_period_results.team_id%type;
begin
utl_file.put_line(file_handle, sp(iIndent) || '<' || tTeamType || '-team-stats>');
iCurrStatType := xTeamStats(tTeamID).first;
loop
exit when iCurrStatType is null;
tCurrTeamID := xTeamStats(tTeamID)(iCurrStatType).first;
loop
exit when tCurrTeamID is null;
utl_file.put(file_handle, sp(iIndent + 2) || '<' || aStatTypes(iCurrStatType) || ' ');
case iCurrStatType
when 2 then -- goal
utl_file.put_line(file_handle, 'goals="' || xTeamStats(tTeamID)(iCurrStatType)(tCurrTeamID).goals || '">');
when 4 then -- shots
utl_file.put_line(file_handle, 'shots="' || xTeamStats(tTeamID)(iCurrStatType)(tCurrTeamID).shots || '">');
when 5 then -- shots on goal
utl_file.put_line(file_handle, 'shots on goal="' || xTeamStats (tTeamID)(iCurrStatType)(tCurrTeamID).shots_on_goal || '">');
when 9 then -- saves
utl_file.put_line(file_handle, 'saves="' || xTeamStats(tTeamID)(iCurrStatType)(tCurrTeamID).saves || '">');
when 10 then -- fouls committed
utl_file.put_line(file_handle, 'fouls committed="' || xTeamStats(tTeamID)(iCurrStatType)(tCurrTeamID).fouls_committed || '">');
when 11 then -- corner kicks
utl_file.put_line(file_handle, 'corner kicks="' || xTeamStats(tTeamID)(iCurrStatType)(tCurrTeamID).corner_kicks || '">');
when 12 then -- yellow cards
utl_file.put_line(file_handle, 'yellow cards="' || xTeamStats(tTeamID)(iCurrStatType)(tCurrTeamID).yellow_cards || '">');
when 13 then -- red cards
utl_file.put_line(file_handle, 'red cards="' || xTeamStats(tTeamID)(iCurrStatType)(tCurrTeamID).red_cards || '">');
end case;
tCurrTeamID := xTeamStats(tTeamID)(iCurrStatType).next(tCurrTeamID);
end loop;
iCurrStatType := xTeamStats(tTeamID).next(iCurrStatType);
end loop;
utl_file.put_line(file_handle, sp(iIndent) || '</' || tTeamType || '-team-stats>');
end pWriteTeamStats;