Oracle DBMS Maze Game

create table stage1(rid varchar2(3), c1 varchar2(1), c2 varchar2(1), c3 varchar2(1), c4 varchar2(1), c5 varchar2(1), c6 varchar2(1), c7 varchar2(1), c8 varchar2(1), c9 varchar2(1), c10 varchar2(1), c11 varchar2(1), c12 varchar2(1), c13 varchar2(1), c14 varchar2(1), c15 varchar2(1), c16 varchar2(1), c17 varchar2(1), c18 varchar2(1), c19 varchar2(1), c20 varchar2(1)); insert into stage1 values('1', 'w', 'w', 'w', 'w', 'w', 'w', 'w', 'w', 'w', 'w', 'w', 'w', 'w', 'w', 'w', 'w', 'w', 'w','w','w'); insert into stage1 values('2', 'w', 'p', 'w', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0','0','w'); insert into stage1 values('3', 'w', '0', 'w', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0','0','w'); insert into stage1 values('4', 'w', '0', 'w', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0','0','w'); insert into stage1 values('5', 'w', '0', 'w', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0','0','w'); insert into stage1 values('6', 'w', '0', 'w', 'w', 'w', 'w', 'w', 'w', 'w', 'w', 'w', '0', '0', '0', '0', '0', '0', '0','0','w'); insert into stage1 values('7', 'w', '0', '0', '0', '0', '0', '0', '0', '0', '0', 'w', '0', '0', '0', '0', '0', '0', '0','0','w'); insert into stage1 values('8', 'w', 'w', 'w', 'w', 'w', 'w', 'w', 'w', 'w', '0', 'w', '0', '0', '0', '0', '0', '0', '0','0','w'); insert into stage1 values('9', 'w', '0', '0', '0', '0', '0', '0', '0', 'w', '0', 'w', '0', '0', '0', '0', '0', '0', '0','0','w'); insert into stage1 values('10', 'w', '0', '0', '0', '0', '0', '0', '0', 'w', '0', 'w', '0', '0', '0', '0', '0', '0', '0','0','w'); insert into stage1 values('11', 'w', '0', '0', '0', '0', '0', '0', '0', 'w', '0', 'w', '0', '0', '0', '0', '0', '0', '0','0','w'); insert into stage1 values('12', 'w', '0', '0', '0', '0', '0', '0', '0', 'w', '0', 'w', '0', '0', '0', '0', '0', '0', '0','0','w'); insert into stage1 values('13', 'w', '0', '0', '0', '0', '0', '0', '0', 'w', '0', 'w', '0', '0', '0', '0', '0', '0', '0','0','w'); insert into stage1 values('14', 'w', '0', '0', '0', '0', '0', '0', '0', 'w', '0', 'w', 'w', 'w', 'w', 'w', 'w', 'w', 'w','w','w'); insert into stage1 values('15', 'w', '0', '0', '0', '0', '0', '0', '0', 'w', '0', '0', '0', '0', '0', '0', '0', '0', '0','0','w'); insert into stage1 values('16', 'w', '0', '0', '0', '0', '0', '0', '0', 'w', 'w', 'w', 'w', 'w', 'w', 'w', 'w', 'w', 'w','0','w'); insert into stage1 values('17', 'w', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', 'w','0','w'); insert into stage1 values('18', 'w', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', 'w','0','w'); insert into stage1 values('19', 'w', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', 'w','g','w'); insert into stage1 values('20', 'w', 'w', 'w', 'w', 'w', 'w', 'w', 'w', 'w', 'w', 'w', 'w', 'w', 'w', 'w', 'w', 'w', 'w','w','w'); create table player1 as (select * from stage1); create or replace procedure showPlayer(pno in number) is cursor rowofplayer is select * from player1; rowdata player1%rowtype; begin if pno = 1 then dbms_output.put_line('Player1'); dbms_output.put_line('-------'); dbms_output.put_line(' '); for rowdata in rowofplayer loop dbms_output.put_line(rowdata.c1||' '||rowdata.c2||' '||rowdata.c3||' '||rowdata.c4||' '||rowdata.c5||' '||rowdata.c6||' '||rowdata.c7||' '||rowdata.c8||' '||rowdata.c9||' '||rowdata.c10||' '||rowdata.c11||' '||rowdata.c12||' '||rowdata.c13||' '||rowdata.c14||' '||rowdata.c15||' '||rowdata.c16||' '||rowdata.c17||' '||rowdata.c18||' '||rowdata.c19||' '||rowdata.c20||' '); end loop; else dbms_output.put_line('Argument not equals 1'); end if; end; / create or replace procedure goLeft(a in number) is cursor rowofplayer is select * from player1 where c1 = 'p' or c2 = 'p' or c3 = 'p' or c4 = 'p' or c5 = 'p' or c6 = 'p' or c7 = 'p' or c8 = 'p' or c9 = 'p' or c10 = 'p' or c11 = 'p' or c12 = 'p' or c13 = 'p' or c14 = 'p' or c15 = 'p' or c16 = 'p' or c17 = 'p' or c18 = 'p' or c19 = 'p' or c20 = 'p'; rowdata player1%rowtype; begin for rowdata in rowofplayer loop if rowdata.c3 = 'p' and rowdata.c2 <> 'w' then update player1 set c2 = 'p', c3 = '0' where rid = rowdata.rid; elsif rowdata.c4 = 'p' and rowdata.c3 <> 'w' then update player1 set c3 = 'p', c4 = '0' where rid = rowdata.rid; elsif rowdata.c5 = 'p' and rowdata.c4 <> 'w' then update player1 set c4 = 'p', c5 = '0' where rid = rowdata.rid; elsif rowdata.c6 = 'p' and rowdata.c5 <> 'w' then update player1 set c5 = 'p', c6 = '0' where rid = rowdata.rid; elsif rowdata.c7 = 'p' and rowdata.c6 <> 'w' then update player1 set c6 = 'p', c7 = '0' where rid = rowdata.rid; elsif rowdata.c8 = 'p' and rowdata.c7 <> 'w' then update player1 set c7 = 'p', c8 = '0' where rid = rowdata.rid; elsif rowdata.c9 = 'p' and rowdata.c8 <> 'w' then update player1 set c8 = 'p', c9 = '0' where rid = rowdata.rid; elsif rowdata.c10 = 'p' and rowdata.c9 <> 'w' then update player1 set c9 = 'p', c10 = '0' where rid = rowdata.rid; elsif rowdata.c11 = 'p' and rowdata.c10 <> 'w' then update player1 set c10 = 'p', c11 = '0' where rid = rowdata.rid; elsif rowdata.c12 = 'p' and rowdata.c11 <> 'w' then update player1 set c11 = 'p', c12 = '0' where rid = rowdata.rid; elsif rowdata.c13 = 'p' and rowdata.c12 <> 'w' then update player1 set c12 = 'p', c13 = '0' where rid = rowdata.rid; elsif rowdata.c14 = 'p' and rowdata.c13 <> 'w' then update player1 set c13 = 'p', c14 = '0' where rid = rowdata.rid; elsif rowdata.c15 = 'p' and rowdata.c14 <> 'w' then update player1 set c14 = 'p', c15 = '0' where rid = rowdata.rid; elsif rowdata.c16 = 'p' and rowdata.c15 <> 'w' then update player1 set c15 = 'p', c16 = '0' where rid = rowdata.rid; elsif rowdata.c17 = 'p' and rowdata.c16 <> 'w' then update player1 set c16 = 'p', c17 = '0' where rid = rowdata.rid; elsif rowdata.c18 = 'p' and rowdata.c17 <> 'w' then update player1 set c17 = 'p', c18 = '0' where rid = rowdata.rid; elsif rowdata.c19 = 'p' and rowdata.c18 <> 'w' then update player1 set c18 = 'p', c19 = '0' where rid = rowdata.rid; end if; end loop; showPlayer(1); end; / create or replace procedure goRight(a in number) is cursor rowofplayer is select * from player1 where c1 = 'p' or c2 = 'p' or c3 = 'p' or c4 = 'p' or c5 = 'p' or c6 = 'p' or c7 = 'p' or c8 = 'p' or c9 = 'p' or c10 = 'p' or c11 = 'p' or c12 = 'p' or c13 = 'p' or c14 = 'p' or c15 = 'p' or c16 = 'p' or c17 = 'p' or c18 = 'p' or c19 = 'p' or c20 = 'p'; rowdata player1%rowtype; begin for rowdata in rowofplayer loop if rowdata.c3 <> 'w' and rowdata.c2 = 'p' then update player1 set c2 = '0', c3 = 'p' where rid = rowdata.rid; elsif rowdata.c4 <> 'w' and rowdata.c3 = 'p' then update player1 set c3 = '0', c4 = 'p' where rid = rowdata.rid; elsif rowdata.c5 <> 'w' and rowdata.c4 = 'p' then update player1 set c4 = '0', c5 = 'p' where rid = rowdata.rid; elsif rowdata.c6 <> 'w' and rowdata.c5 = 'p' then update player1 set c5 = '0', c6 = 'p' where rid = rowdata.rid; elsif rowdata.c7 <> 'w' and rowdata.c6 = 'p' then update player1 set c6 = '0', c7 = 'p' where rid = rowdata.rid; elsif rowdata.c8 <> 'w' and rowdata.c7 = 'p' then update player1 set c7 = '0', c8 = 'p' where rid = rowdata.rid; elsif rowdata.c9 <> 'w' and rowdata.c8 = 'p' then update player1 set c8 = '0', c9 = 'p' where rid = rowdata.rid; elsif rowdata.c10 <> 'w' and rowdata.c9 = 'p' then update player1 set c9 = '0', c10 = 'p' where rid = rowdata.rid; elsif rowdata.c11 <> 'w' and rowdata.c10 = 'p' then update player1 set c10 = '0', c11 = 'p' where rid = rowdata.rid; elsif rowdata.c12 <> 'w' and rowdata.c11 = 'p' then update player1 set c11 = '0', c12 = 'p' where rid = rowdata.rid; elsif rowdata.c13 <> 'w' and rowdata.c12 = 'p' then update player1 set c12 = '0', c13 = 'p' where rid = rowdata.rid; elsif rowdata.c14 <> 'w' and rowdata.c13 = 'p' then update player1 set c13 = '0', c14 = 'p' where rid = rowdata.rid; elsif rowdata.c15 <> 'w' and rowdata.c14 = 'p' then update player1 set c14 = '0', c15 = 'p' where rid = rowdata.rid; elsif rowdata.c16 <> 'w' and rowdata.c15 = 'p' then update player1 set c15 = '0', c16 = 'p' where rid = rowdata.rid; elsif rowdata.c17 <> 'w' and rowdata.c16 = 'p' then update player1 set c16 = '0', c17 = 'p' where rid = rowdata.rid; elsif rowdata.c18 <> 'w' and rowdata.c17 = 'p' then update player1 set c17 = '0', c18 = 'p' where rid = rowdata.rid; elsif rowdata.c19 <> 'w' and rowdata.c18 = 'p' then update player1 set c18 = '0', c19 = 'p' where rid = rowdata.rid; end if; end loop; showPlayer(1); end; / create or replace procedure goUp(a in number) is cursor rowofplayer is select * from player1 where c1 = 'p' or c2 = 'p' or c3 = 'p' or c4 = 'p' or c5 = 'p' or c6 = 'p' or c7 = 'p' or c8 = 'p' or c9 = 'p' or c10 = 'p' or c11 = 'p' or c12 = 'p' or c13 = 'p' or c14 = 'p' or c15 = 'p' or c16 = 'p' or c17 = 'p' or c18 = 'p' or c19 = 'p' or c20 = 'p'; rowdata player1%rowtype; var varchar2(1); begin for rowdata in rowofplayer loop if rowdata.rid = '2' then exit; elsif rowdata.c2 = 'p' then select c2 into var from player1 where rid = rowdata.rid-1; if var <> 'w' then update player1 set c2 = 'p' where rid = rowdata.rid-1; update player1 set c2 = '0' where rid = rowdata.rid; end if; elsif rowdata.c3 = 'p' then select c3 into var from player1 where rid = rowdata.rid-1; if var <> 'w' then update player1 set c3 = 'p' where rid = rowdata.rid-1; update player1 set c3 = '0' where rid = rowdata.rid; end if; elsif rowdata.c4 = 'p' then select c4 into var from player1 where rid = rowdata.rid-1; if var <> 'w' then update player1 set c4 = 'p' where rid = rowdata.rid-1; update player1 set c4 = '0' where rid = rowdata.rid; end if; elsif rowdata.c5 = 'p' then select c5 into var from player1 where rid = rowdata.rid-1; if var <> 'w' then update player1 set c5 = 'p' where rid = rowdata.rid-1; update player1 set c5 = '0' where rid = rowdata.rid; end if; elsif rowdata.c6 = 'p' then select c6 into var from player1 where rid = rowdata.rid-1; if var <> 'w' then update player1 set c6 = 'p' where rid = rowdata.rid-1; update player1 set c6 = '0' where rid = rowdata.rid; end if; elsif rowdata.c7 = 'p' then select c7 into var from player1 where rid = rowdata.rid-1; if var <> 'w' then update player1 set c7 = 'p' where rid = rowdata.rid-1; update player1 set c7 = '0' where rid = rowdata.rid; end if; elsif rowdata.c8 = 'p' then select c8 into var from player1 where rid = rowdata.rid-1; if var <> 'w' then update player1 set c8 = 'p' where rid = rowdata.rid-1; update player1 set c8 = '0' where rid = rowdata.rid; end if; elsif rowdata.c9 = 'p' then select c9 into var from player1 where rid = rowdata.rid-1; if var <> 'w' then update player1 set c9 = 'p' where rid = rowdata.rid-1; update player1 set c9 = '0' where rid = rowdata.rid; end if; elsif rowdata.c10 = 'p' then select c10 into var from player1 where rid = rowdata.rid-1; if var <> 'w' then update player1 set c10 = 'p' where rid = rowdata.rid-1; update player1 set c10 = '0' where rid = rowdata.rid; end if; elsif rowdata.c11 = 'p' then select c11 into var from player1 where rid = rowdata.rid-1; if var <> 'w' then update player1 set c11 = 'p' where rid = rowdata.rid-1; update player1 set c11 = '0' where rid = rowdata.rid; end if; elsif rowdata.c12 = 'p' then select c12 into var from player1 where rid = rowdata.rid-1; if var <> 'w' then update player1 set c12 = 'p' where rid = rowdata.rid-1; update player1 set c12 = '0' where rid = rowdata.rid; end if; elsif rowdata.c13 = 'p' then select c13 into var from player1 where rid = rowdata.rid-1; if var <> 'w' then update player1 set c13 = 'p' where rid = rowdata.rid-1; update player1 set c13 = '0' where rid = rowdata.rid; end if; elsif rowdata.c14 = 'p' then select c14 into var from player1 where rid = rowdata.rid-1; if var <> 'w' then update player1 set c14 = 'p' where rid = rowdata.rid-1; update player1 set c14 = '0' where rid = rowdata.rid; end if; elsif rowdata.c15 = 'p' then select c15 into var from player1 where rid = rowdata.rid-1; if var <> 'w' then update player1 set c15 = 'p' where rid = rowdata.rid-1; update player1 set c15 = '0' where rid = rowdata.rid; end if; elsif rowdata.c16 = 'p' then select c16 into var from player1 where rid = rowdata.rid-1; if var <> 'w' then update player1 set c16 = 'p' where rid = rowdata.rid-1; update player1 set c16 = '0' where rid = rowdata.rid; end if; elsif rowdata.c17 = 'p' then select c17 into var from player1 where rid = rowdata.rid-1; if var <> 'w' then update player1 set c17 = 'p' where rid = rowdata.rid-1; update player1 set c17 = '0' where rid = rowdata.rid; end if; elsif rowdata.c18 = 'p' then select c18 into var from player1 where rid = rowdata.rid-1; if var <> 'w' then update player1 set c18 = 'p' where rid = rowdata.rid-1; update player1 set c18 = '0' where rid = rowdata.rid; end if; elsif rowdata.c19 = 'p' then select c19 into var from player1 where rid = rowdata.rid-1; if var <> 'w' then update player1 set c19 = 'p', c20 = rowdata.c20 where rid = rowdata.rid-1; update player1 set c19 = '0', c20 = rowdata.c20 where rid = rowdata.rid; end if; end if; end loop; showPlayer(1); end; / create or replace procedure goDown(a in number) is cursor rowofplayer is select * from player1 where c1 = 'p' or c2 = 'p' or c3 = 'p' or c4 = 'p' or c5 = 'p' or c6 = 'p' or c7 = 'p' or c8 = 'p' or c9 = 'p' or c10 = 'p' or c11 = 'p' or c12 = 'p' or c13 = 'p' or c14 = 'p' or c15 = 'p' or c16 = 'p' or c17 = 'p' or c18 = 'p' or c19 = 'p' or c20 = 'p'; rowdata player1%rowtype; var varchar2(1); begin for rowdata in rowofplayer loop if rowdata.rid = '19' then exit; elsif rowdata.c2 = 'p' then select c2 into var from player1 where rid = rowdata.rid+1; if var <> 'w' then update player1 set c2 = 'p' where rid = rowdata.rid+1; update player1 set c2 = '0' where rid = rowdata.rid; end if; elsif rowdata.c3 = 'p' then select c3 into var from player1 where rid = rowdata.rid+1; if var <> 'w' then update player1 set c3 = 'p' where rid = rowdata.rid+1; update player1 set c3 = '0' where rid = rowdata.rid; end if; elsif rowdata.c4 = 'p' then select c4 into var from player1 where rid = rowdata.rid+1; if var <> 'w' then update player1 set c4 = 'p' where rid = rowdata.rid+1; update player1 set c4 = '0' where rid = rowdata.rid; end if; elsif rowdata.c5 = 'p' then select c5 into var from player1 where rid = rowdata.rid+1; if var <> 'w' then update player1 set c5 = 'p' where rid = rowdata.rid+1; update player1 set c5 = '0' where rid = rowdata.rid; end if; elsif rowdata.c6 = 'p' then select c6 into var from player1 where rid = rowdata.rid+1; if var <> 'w' then update player1 set c6 = 'p' where rid = rowdata.rid+1; update player1 set c6 = '0' where rid = rowdata.rid; end if; elsif rowdata.c7 = 'p' then select c7 into var from player1 where rid = rowdata.rid+1; if var <> 'w' then update player1 set c7 = 'p' where rid = rowdata.rid+1; update player1 set c7 = '0' where rid = rowdata.rid; end if; elsif rowdata.c8 = 'p' then select c8 into var from player1 where rid = rowdata.rid+1; if var <> 'w' then update player1 set c8 = 'p' where rid = rowdata.rid+1; update player1 set c8 = '0' where rid = rowdata.rid; end if; elsif rowdata.c9 = 'p' then select c9 into var from player1 where rid = rowdata.rid+1; if var <> 'w' then update player1 set c9 = 'p' where rid = rowdata.rid+1; update player1 set c9 = '0' where rid = rowdata.rid; end if; elsif rowdata.c10 = 'p' then select c10 into var from player1 where rid = rowdata.rid+1; if var <> 'w' then update player1 set c10 = 'p' where rid = rowdata.rid+1; update player1 set c10 = '0' where rid = rowdata.rid; end if; elsif rowdata.c11 = 'p' then select c11 into var from player1 where rid = rowdata.rid+1; if var <> 'w' then update player1 set c11 = 'p' where rid = rowdata.rid+1; update player1 set c11 = '0' where rid = rowdata.rid; end if; elsif rowdata.c12 = 'p' then select c12 into var from player1 where rid = rowdata.rid+1; if var <> 'w' then update player1 set c12 = 'p' where rid = rowdata.rid+1; update player1 set c12 = '0' where rid = rowdata.rid; end if; elsif rowdata.c13 = 'p' then select c13 into var from player1 where rid = rowdata.rid+1; if var <> 'w' then update player1 set c13 = 'p' where rid = rowdata.rid+1; update player1 set c13 = '0' where rid = rowdata.rid; end if; elsif rowdata.c14 = 'p' then select c14 into var from player1 where rid = rowdata.rid+1; if var <> 'w' then update player1 set c14 = 'p' where rid = rowdata.rid+1; update player1 set c14 = '0' where rid = rowdata.rid; end if; elsif rowdata.c15 = 'p' then select c15 into var from player1 where rid = rowdata.rid+1; if var <> 'w' then update player1 set c15 = 'p' where rid = rowdata.rid+1; update player1 set c15 = '0' where rid = rowdata.rid; end if; elsif rowdata.c16 = 'p' then select c16 into var from player1 where rid = rowdata.rid+1; if var <> 'w' then update player1 set c16 = 'p' where rid = rowdata.rid+1; update player1 set c16 = '0' where rid = rowdata.rid; end if; elsif rowdata.c17 = 'p' then select c17 into var from player1 where rid = rowdata.rid+1; if var <> 'w' then update player1 set c17 = 'p' where rid = rowdata.rid+1; update player1 set c17 = '0' where rid = rowdata.rid; end if; elsif rowdata.c18 = 'p' then select c18 into var from player1 where rid = rowdata.rid+1; if var <> 'w' then update player1 set c18 = 'p' where rid = rowdata.rid+1; update player1 set c18 = '0' where rid = rowdata.rid; end if; elsif rowdata.c19 = 'p' then select c19 into var from player1 where rid = rowdata.rid+1; if var <> 'w' then update player1 set c19 = 'p' where rid = rowdata.rid+1; update player1 set c19 = '0' where rid = rowdata.rid; end if; end if; end loop; showPlayer(1); end; / create table userlist( username varchar2(20) primary key, password varchar2(20), score number(4) default 0, stage number(2) default 1 ); create table currentState( username varchar2(20), stage number(2), score number(4) ); create table gameStore( username varchar2(20), rid varchar2(3), c1 varchar2(1), c2 varchar2(1), c3 varchar2(1), c4 varchar2(1), c5 varchar2(1), c6 varchar2(1), c7 varchar2(1), c8 varchar2(1), c9 varchar2(1), c10 varchar2(1), c11 varchar2(1), c12 varchar2(1), c13 varchar2(1), c14 varchar2(1), c15 varchar2(1), c16 varchar2(1), c17 varchar2(1), c18 varchar2(1), c19 varchar2(1), c20 varchar2(1) ); create or replace procedure registerPlayer(username in varchar2, password in varchar2) is begin insert into userlist values(username, password, 0, 1); insert into gameStore (select username,rid, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20 from stage1); end; / create or replace procedure logout(flag in number) is varUsername varchar2(20); varStage number(2); varScore number(4); begin select username into varUsername, stage into varStage, score into varScore from currentState; update userlist set score = varScore, stage = varStage where username = varUsername; delete from gameStore where username = varUsername; insert into gameStore (select varUsername,rid, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20 from player1); delete from player1; delete from currentState; end; / create or replace procedure logout(flag in number) is varUsername varchar2(20); varStage number(2); varScore number(4); cursor pointer is select * from currentState; rowpointer pointer%rowtype; begin for rowpointer in pointer loop varUsername:=rowpointer.username; varStage:=rowpointer.stage; varScore:=rowpointer.score; end loop; update userlist set score = varScore, stage = varStage where username = varUsername; delete from gameStore where username = varUsername; insert into gameStore (select varUsername,rid, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20 from player1); delete from player1; delete from currentState; dbms_output.put_line('Logout Successfull'); end; / create or replace procedure login(username in varchar2, password in varchar2) is begin end; / create or replace procedure login(uname in varchar2, pass in varchar2) is cursor pointer is select * from gamestore g where g.username=uname; rowpointer pointer%rowtype; cursor userpointer is select count(*) as login from userlist u where u.username=uname and u.password=pass; rowuserpointer userpointer%rowtype; cursor detailpointer is select * from userlist u where u.username=uname and u.password=pass; rowdetailpointer detailpointer%rowtype; login number(1):=0; varStage number(2); varScore number(4); begin logout(1); for rowuserpointer in userpointer loop login:=rowuserpointer.login; end loop; if login=1 then for rowdetailpointer in detailpointer loop varStage:=rowdetailpointer.stage; varScore:=rowdetailpointer.score; end loop; insert into currentstate values(uname, varStage, varScore); insert into player1( select rid, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15, c16, c17, c18, c19, c20 from gamestore where username = uname ); dbms_output.put_line('Login Successfull'); else dbms_output.put_line('Incorrect Credential'); end if; end; /
DBMS MCA 2nd YEAR PROJECT

You just need to execute all the statements

set serverout on;

call registerPlayer('username', 'password');
call login('username', 'passoword');
call showPlayer(1);
call goDown(1);
call goUp(1);
call goLeft(1);
call goRight(1);

call logout(1);

triggers:

updateScoreTrigger1
updateScoreTrigger2

You are p:player.
Eat a : apple / m:mango to increase score. Stage will automatically change when stamping g:goal.

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.