Prerequisite – PL/SQL introduction
In PL/SQL code groups of commands are arranged within a block. A block group related declarations or statements.
In declare part, we declare variables and between begin and end part, we perform the operations.
Here, first, we take three variables num, len, and revnum and assign the value in num and fin is the length of the number and after finding the length we start a loop from maximum length to starting length, we assign the num into revnum and print revnum.
Input : 123456 Output :654321
Input :87459 Output :95478
Below is the required implementation:
reverse of number is 654321.