Skip to main content

Pl/sql imp program

Full course of c++ programming language

Click here > C++ programming language



1 ] print the message in pl/sql block. 

set serveroutput on;

begin

 dbms_output.put_line('Welcome to pl/sql world');

end;

/


==========================================

2 ] create a pl/sql block for print 1 to 10 numbers. 


set serveroutput on;

declare

 i number:=1;

begin

 while(i<=10)

  loop

   dbms_output.put_line(i);

   i:=i+1;

  end loop;

end;

/

==========================================

3 ] create a pl/sql block for print any message for number of time? 


set serveroutput on;

declare

 i number:=1;

begin

 while(i<=5)loop

  dbms_output.put_line('Hello world');

  i:=i+1;

 end loop;

end;

/


==========================================

4 ] create a pl/sql block for print the message for particular times? 

set serveroutput on;

declare

 msg varchar(25):=&message;

 n number:=&n;

 i number:=1;

begin

 while i<=n loop

  dbms_output.put_line(msg);

  i:=i+1;

 end loop;

end;

/


==========================================

6] create a pl/sql block for find the area of circle? 


set serveroutput on;

declare

 r number:=&radious;

 pi number:=3.14;

 ans number;

begin

 ans:=pi*r*r;

 dbms_output.put_line('The area of circle is '||ans);

end;

/


==========================================

7 ] create a pl /sql block for find the simple interest? 

set serveroutput on;

declare

 p number:=&p;

 r number:=&r;

 n number:=&n;

 si number;

begin 

 si:=(p*r*n)/100;

 dbms_output.put_line('The simple interest is '||si);

end;

/


==========================================

8 ]create a pl/sql block for check the number is positive, negative and zero? 

set serveroutput on;

declare

 n number:=&n;


begin 

 if(n>0) THEN

  dbms_output.put_line('Positive number');

 elsif(n=0) THEN

  dbms_output.put_line('Zero number');

 else

  dbms_output.put_line('Negative number');


 end if;

end;

/


==========================================

9 ] create a pl/sql block for print the fibbonacci series? 

set serveroutput on;

declare

 n number:=&n;

 a number:=0;

 b number:=1;

 c number;

 i number:=1;

begin

 while i<=5 loop

  dbms_output.put_line(a);

  c:=a+b;

  a:=b;

  b:=c;

  i:=i+1;

 end loop;

end;

/


==========================================

10 ] create a pl/sql block for print the multiplication table? 


set serveroutput on;

declare

 n number:=&n;

 i number:=1;

 ans number;

begin

 while(i<=10)loop

  ans:=n*i;

  dbms_output.put_line(n||'x'||i||'='||ans);

  i:=i+1;

 end loop;

end;

/


==========================================

11 ] Create a pl/sql block for check the number is prime or not? 


set serveroutput on;


declare

 n number:=&n;

 r number;

 s number;

 i number:=1;

 c number:=1;

begin

 s:=n;

 while(i!=n)loop

  if mod(n,i)=0 then

   c:=c+1;

  end if;

 i:=i+1;

 end loop;

 if c=2 then

  dbms_output.put_line('This number is prime');

 else

  dbms_output.put_line('This number is not a prime');

 end if;


end;

/



==========================================

12 ]Create a pl/sql block for find the number is armstrong Or not? 


set serveroutput on;

declare

 n number:=&n;

 temp number:=n;

 arm number:=0;

 r number;

begin

 while temp>0 loop

  r:=mod(temp,10);

  arm:=arm+(r*r*r);

  temp:=floor(temp/10); 

 end loop;

 dbms_output.put_line(arm);

 dbms_output.put_line(n);

 if n=arm then

  dbms_output.put_line('This number is armstrong');

 else

  dbms_output.put_line('This number is not a armstrong');

 end if;


end;

/


==========================================

13]Create a pl/sql block for find the factorial of number? 


set serveroutput on;


declare

 n number:=&n;

 i number:=n;

 fac number:=1; 

begin

 while(i>0)loop

  fac:=fac*i;

  i:=i-1;

 end loop;

 dbms_output.put_line('The factorial of '||n||'number is'||fac);


end;

/







Comments

Popular posts from this blog

Remove specific item from Recyclerview in android studio

For Full video click on below link :- https://youtu.be/sUz4fqeanjI?si=A8AqBWCgu-5NnBOJ Working with the activity_main.xml file. Navigate to the   app > res > layout > activity_main.xml  and add the below code to that file. Below is the code for the   activity_main.xml   file.  <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".MainActivity" android:orientation="vertical" android:background="@color/white"> <EditText android:layout_width="350dp" android:layout_height="50dp" android:inputType="text" android:id="@+id/coursenam...

Fingerprint Authentication in Android Studio Project

Implement the implementation : - implementation 'androidx.biometric:biometric:1.0.1' Working with the activity_main.xml file. Navigate to the   app > res > layout > activity_main.xml  and add the below code to that file. Below is the code for the   activity_main.xml   file. <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="center" android:orientation="vertical" tools:context=".MainActivity" android:background="@color/white"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Welcome to the Boxcode!!" android:textSize=...

Sqlite with CRUD operation in Android studio

For Full video click on link :- https://youtu.be/QTvy8sJSiyI?si=dM1f98Mr7aFpJpqG Working with the activity_main.xml file. Navigate to the   app > res > layout > activity_main.xml  and add the below code to that file. Below is the code for the   activity_main.xml   file.  <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".MainActivity" android:orientation="vertical" android:background="@color/white"> <EditText android:layout_width="350dp" android:layout_height="50dp" android:inputType="text" android:id="@+id/coursename...