PL/SQL

PL/SQL Program to Print Patterns

Here you will get plsql programs to print patterns of stars, numbers and alphabets. Pattern 1: * ** *** **** ***** declare n number:=5; i number; j number; begin for i in 1..n loop for j in 1..i loop dbms_output.put(‘*’); end loop; dbms_output.new_line; end loop; end; /

PL/SQL Program to Find Greatest of Three Numbers

Here you will get plsql program to find greatest of three numbers. declare a number:=10; b number:=12; c number:=5; begin dbms_output.put_line(‘a=’||a||’ b=’||b||’ c=’||c); if a>b AND a>c then dbms_output.put_line(‘a is greatest’); else if b>a AND b>c then dbms_output.put_line(‘b is greatest’); else dbms_output.put_line(‘c is greatest’); end if; end if; end; / Output a=10 b=12 c=5 b is …

PL/SQL Program to Find Greatest of Three Numbers Read More »

PL/SQL Program to Swap two Numbers

Here you will get pl/sql program to swap two numbers with and without using temporary variable. Method 1: Using Temporary Variable declare a number; b number; temp number; begin a:=5; b:=10; dbms_output.put_line(‘before swapping:’); dbms_output.put_line(‘a=’||a||’ b=’||b); temp:=a; a:=b; b:=temp; dbms_output.put_line(‘after swapping:’); dbms_output.put_line(‘a=’||a||’ b=’||b); end; / Output before swapping: a=5 b=10 after swapping: a=10 b=5 Method 2: Without …

PL/SQL Program to Swap two Numbers Read More »

Pl/SQL Program for Palindrome Number

Here you will get pl/sql program for palindrome number. A number is called palindrome number if its reverse is equal to itself. For example 12321 is palindrome while 123 is not palindrome. Pl/SQL Program for Palindrome Number declare n number; m number; rev number:=0; r number; begin n:=12321; m:=n; while n>0 loop r:=mod(n,10); rev:=(rev*10)+r; n:=trunc(n/10); …

Pl/SQL Program for Palindrome Number Read More »

Difference between SQL and PL/SQL

Here you will learn about difference between SQL and PL/SQL. SQL and PL/SQL are two popular database technologies. These two topics are very frequently asked in database interviews. In this article I have shared the key differences between these two technologies. Also Read: PL/SQL Interview Questions and Answers Image Source Difference between SQL and PL/SQL S. …

Difference between SQL and PL/SQL Read More »

PL/SQL Program to Reverse a String

Here you will get pl/sql program to reverse a string. The substr() function returns a part of string. It has following syntax. substr(string, position, length); We will use this function to extract character by character from string in reverse order and concatenate it previous extracted character. || is used to concatenate string. In this way string …

PL/SQL Program to Reverse a String Read More »