Social Icons

Tuesday, 3 December 2013

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;

Thursday, 14 November 2013

Moving fan using java Applet

import java.awt.*;
import java.awt.event.*;
import java.applet.*;
/*
<applet code="Banner5" width=500 height=500>
</applet>
*/
public class Banner5 extends Applet implements Runnable,MouseListener,MouseMotionListener{

Thread t = null;

Thread t1 = null;
int x,y,state;
boolean stopFlag,st1;
// Set colors and initialize thread.
public void init() {
setBackground(Color.cyan);
setForeground(Color.red);
addMouseListener(this);
addMouseMotionListener(this);
}

public void mouseClicked(MouseEvent me)
{
t1 = new Thread(this);
stopFlag = false;
t1.start();

}
public  void mouseEntered(MouseEvent me)
{
t = new Thread(this);
stopFlag = false;
t.start();



}
public  void mouseExited(MouseEvent me)
{
stopFlag = true;
st1=true;
showStatus("Exited");
}

public  void mousePressed(MouseEvent me)
{}
public  void mouseReleased(MouseEvent me)
{}







public void mouseMoved(MouseEvent me)
{
 //repaint();

showStatus("hello");
}



public void run() {
char ch;

for( ; ; ) {
try {



repaint();
Thread.sleep(300);
x=x+10;
y=y+10;



if(stopFlag)
break;
} catch(InterruptedException e) {}
}
}


public void mouseDragged(MouseEvent me)
{

}















// Start thread
public void start() {
t = new Thread(this);
stopFlag = true;
t.start();
x=0;
}

// Pause the banner.
public void stop() {
stopFlag = true;
t = null;
}
// Display the banner.
public void paint(Graphics g) {

g.fillArc(100, 40, 100, 100, 0+x, 45);
g.fillArc(100, 40, 100, 100, 120+x, 45);
g.fillArc(100, 40, 100, 100, 240+x, 45);


g.fillArc(100, 200, 100, 100, 240-y, 45);
g.fillArc(100, 200, 100, 100, 120-y,45);
g.fillArc(100, 200, 100, 100, 0-y, 45);

}
}
 

Sample Text

Sample text

 
Just Programming Cse DriveReputation Management