Social Icons

Tuesday, 3 December 2013

PL/SQL While Loop

set serveroutput on;
set verify off;
declare
i int:=1;
j int;
begin
WHILE i<10 loop
dbms_output.put_line(i);
i:=i+1;

end loop;

end;

output :













Printing pattern in PL/SQL

set serveroutput on;
set verify off;
declare
i int;
j int;
begin
for i in 1..5 loop
 dbms_output.put_line('');
 for j in 1..i loop
   dbms_output.put('*');
 end loop;
  dbms_output.new_line;
end loop;

end;

OUTPUT :


** 
*** 
**** 
*****

PL/SQL Simple Loop

set serveroutput on;
set verify off;
declare
b int:=1;
begin

loop
dbms_output.put_line(''||b);
b:=b+1;
exit when b>=10;
end loop;
end;

PL/SQL if-else Statements

set serveroutput on;
set verify off;
declare
a int;
begin
a:=&a;
if a>50 then
dbms_output.put_line('you are old');
elsif a>30 and a<50 then

dbms_output.put_line('you are young');

else

dbms_output.put_line('you are child');

end if;

end;

 

Sample Text

Sample text

 
Just Programming Cse DriveReputation Management