Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: code clean up help
thx a lot..
the code looks a lot better
i got one more question...
i tried
create table tmp_table (
col_1 othertable.other_col_1%type
);
which didn't work
is it impossible?
result code looks like this.. well current auto-indent of my editor doesn't work well --;
procedure each_team(
school_name in schools.scname%type,
school_id out schools.scid%type,
team_id out teams.teamid%type
)
is
begin
select count(*) into val
from schools s
where s.scname = school_name;
if (val = 1) then
select scid into school_id
from schools s
where s.scname = school_name;
select count(*) into val
from teams t
where t.scid = school_id and
t.sport = newrowtsport and t.gender = newrowtgender; if(val =1 ) then null;
t.sport = newrowtsport and t.gender = newrowtgender; else
( team_id, school_id , newrowtsport, newrowtgender);
end if; elsif val = 0 then
( team_id, school_id , newrowtsport, newrowtgender);
else null; end if; end each_team; begin newrowtsc_1 := upper(:new.tsc_1); newrowtsc_2 := upper(:new.tsc_2); newrowtsport := upper(:new.tsport); newrowtgender := upper(:new.tgender); newrowgamedate := upper(:new.gamedate); newrowgamecity := upper(:new.gamecity);
select count(*) into val from games g
where (g.hometeamid = :new.visitorteamid or
g.hometeamid = :new.hometeamid or g.visitorteamid = :new.hometeamid or g.visitorteamid = :new.visitorteamid) and g.gamedate = newrowgamedate and g.gamecity <> newrowgamecity; if (val > 0) then dbms_output.put_line('aaaa'); else dbms_output.put_line('val: ' || val); each_team(newrowtsc_1, home_school_id, home_team_id); each_team(newrowtsc_2, visitor_school_id, visitor_team_id); if ( (:new.visitorpoints <0) or (:new.homepoints < 0)) then insert into games ( hometeamid, visitorteamid, gamedate, gamecity) values ( home_team_id , visitor_team_id, newrowgamedate, newrowgamecity); else
values ( home_team_id , visitor_team_id, newrowgamedate, newrowgamecity, :new.homepoints, :new.visitorpoints); end if; end if; end;
show errors; Received on Fri Sep 13 2002 - 09:39:41 CDT
![]() |
![]() |