Here is a PL/SQL program that can determine whether a number is even or odd: DECLARE num NUMBER; BEGIN num := # IF MOD(num, 2) = 0 THEN DBMS_OUTPUT.PUT_LINE('The number ' || num || ' is even.'); ELSE DBMS_OUTPUT.PUT_LINE('The number ...
Discy Latest Articles
PL/SQL Program to Find Armstrong Number
Vinish KapoorAn Armstrong number is a number that is equal to the sum of its own digits raised to the power of the number of digits. Here is a simple PL/SQL program that can be used to find Armstrong numbers: declare ...
PL/SQL Program to Find the Largest of Two Numbers
Vinish KapoorTo find the largest of two numbers using PL/SQL, you can use a SELECT statement with a comparison expression. The comparison expression can use the GREATER THAN operator (>) to compare the two numbers, and the result of the expression ...
PL/SQL Program to Reverse a String
Vinish KapoorTo reverse a string using PL/SQL, you can iterate over the characters in the string in reverse order and append each character to a new string. This will create a new string that contains the characters of the original string ...
PL/SQL Program to Reverse a Number
Vinish KapoorTo reverse a number using PL/SQL, you can convert the number to a string, iterate over the characters in the string in reverse order, and then convert the reversed string back to a number. Here is an example of how ...
PL/SQL Program to Add Two Numbers
Vinish KapoorTo add two numbers using PL/SQL, you can use a SELECT statement with an arithmetic expression. The arithmetic expression can use the + operator to add the two numbers together, and the result of the expression will be returned by ...
Oracle LENGTH()
Vinish KapoorTo determine the length of a given string, use the Oracle LENGTH() function. The length includes all trailing blanks if the string's data type is CHAR. This function returns null when a string is empty. Bytes, not characters, are what ...
Oracle INSTR() Function
Vinish KapoorIn Oracle, INSTR() function searches for a string in a string and returns the number of the first occurrence. Below are the syntax and examples of Oracle INSTR() function: Oracle INSTR() Syntax INSTR( x , find_string [, start ] [, ...
Oracle INITCAP() Function
Vinish KapoorIn Oracle, INITCAP() function converts the first letter of each word to uppercase. Below are the syntax and examples of Oracle INITCAP() function: Oracle INITCAP() Syntax initcap(string) Oracle INITCAP() Function Examples: Example-1: Get the employee name from the EMP table ...
Oracle Concat
Vinish KapoorIn Oracle, to join or concatenate two strings we use the CONCAT function. The following is the syntax of the Oracle Concat function: Oracle Concat Syntax concat(a, b) Here it will join the string a and b and will return ...