Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Download
Standard view
Full view
of .
Save to My Library
Look up keyword
Like this
2Activity
0 of .
Results for:
No results containing your search query
P. 1
DBMS LABWEEKS

DBMS LABWEEKS

Ratings: (0)|Views: 147 |Likes:
Published by adithyaaddanki

More info:

Published by: adithyaaddanki on Jun 13, 2009
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as DOC, PDF, TXT or read online from Scribd
See more
See less

07/06/2010

pdf

text

original

 
*Print Armstrong numbers using While Loop in PL/SQL Blockdeclaren number(12):=&num1;s number(12):=0;d number(12):=n;r number(12);beginwhile(d>=1)loopr:=mod(d,10);s:=s+(r*r*r);d:=floor(d/10);end loop;if(s=n) thendbms_output.put_line(n||' is a Armstrong');elsedbms_output.put_line(n||' is not a Armstrong');end if;end;/*Print character in PL/SQL Blockdeclarea number(3):=#b char(1);beginb:=chr(a);dbms_output.put_line('char is "'||b||'"');end;/*Print employees commission in PL/SQL Blockdeclareeno number(4);ename varchar(20);sal number(12,2);comm number(4);beginselect empno,ename,sal,comm into eno,ename,sal,comm from epm whereempno=7782;sal:=sal+nvl(comm,0);dbms_output.put_line(eno||' '||ename||' '||sal||' '||comm);end;/*Print salary level in PL/SQL Block
 
beginselect ename,sal "salary",casewhen sal<=3000 then 'below average'when sal>3000 and sal<5000 then 'average'when sal between 5000 and 10000 then 'normal'else 'good'end "range" from pm;end;/*Update salaries of employees and use predefined and system defined Exceptionsin PL/SQL Blockdeclareeno number(3):=&empno;name varchar(20);sal number(9);sal_err exception;beginselect ename,sal into name,sal from emp where empno=eno;if sal is NULL thenraise sal_err;elsesal:=sal+sal*0.25;end if;update emp set sal=sal where empno=eno;commit;exceptionwhen no_data_found thendbms_output.put_line('no such employee');when too_many_rows thendbms_output.put_line('more than one value');when sal_err thendbms_output.put_line('null value');update emp set sal=5000 where empno=eno;end;/*Print Fibonacci series in PL/SQL Blockdeclarea number(2):=0;b number(3):=1;c number(3);begindbms_output.put_line(a||' ');for i in 1..10
 
loopc:=a+b;dbms_output.put_line(c||' ');a:=b;b:=c;end loop;end;/*Print factorial of a given number in PL/SQL Blockdeclaren number(3):=&num;f number(4):=1;beginfor i in 1..nloopf:=f*i;end loop;if(n<1) thendbms_output.put_line(' no factorial');elsedbms_output.put_line('factorial is '||f);end if;end;/*Print words for a given number in PL/SQL Blockdeclaren number(9):=&num1;s number(9);ct number(3):=0;c varchar(10);beginn:=revstr(n);loopct:=ct+1;s:=mod(n,10);n:=floor(n/10);case swhen 0 thenc:='ZERO';when 1 thenc:='ONE';when 2 thenc:='TWO';when 3 then

You're Reading a Free Preview

Download
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->