PrepareBeforeTest1

PrepareBeforeTest1 - Sheet1 Page 1 declare b number not...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Sheet1 Page 1 declare b number not null default 10 con constant number:= 100 begin dbms_output.put_line(b) end--Bind variable var c number begin :c:=100 dbms_output.put_line(:c) end select job, sum(decode(deptno,10,sal,null)) sum10, sum(decode(deptno,20,sal,null)) sum20, sum(decode(deptno,30,sal,null)) sum30, sum(decode(deptno,40,sal,null)) sum40, sum(sal) Total from emp group by job declare em emp%rowtype sum10 number:=0 sum20 number:=0 sum30 number:=0 sum40 number:=0 begin for em in (select * from emp) loop case em.deptno when 10 then sum10:=sum10+em.sal when 20 then sum20:=sum20+em.sal when 30 then sum30:=sum30+em.sal when 40 then sum40:=sum40+em.sal end case end loop dbms_output.put_line('Dept10:=' || sum10 ) dbms_output.put_line('Dept20:=' || sum20 ) dbms_output.put_line('Dept30:=' || sum30 ) dbms_output.put_line('Dept40:=' || sum40 ) end declare em emp%rowtype sum10 number:=0 sum20 number:=0 sum30 number:=0 sum40 number:=0 cursor c1 is select * from emp Sheet1 Page 2 begin for em in c1 loop case em.deptno when 10 then sum10:=sum10+em.sal when 20 then sum20:=sum20+em.sal when 30 then sum30:=sum30+em.sal when 40 then sum40:=sum40+em.sal end case end loop dbms_output.put_line('Dept10:=' || sum10 ) dbms_output.put_line('Dept20:=' || sum20 )dbms_output....
View Full Document

This note was uploaded on 07/15/2011 for the course ECO 2023 taught by Professor Mr.raza during the Summer '10 term at FAU.

Page1 / 12

PrepareBeforeTest1 - Sheet1 Page 1 declare b number not...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online