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 is reversed.

 

PL/SQL Program to Reverse a String

 

Output

Enter value for str: hello world
old 2: str1 varchar2(50):=’&str’;
new 2: str1 varchar2(50):=’hello world’;
Reverse of String is:dlrow olleh

One thought on “PL/SQL Program to Reverse a String

  1. LINGA

    Need program for embedded SQL? & Program for database design using ER model and normalization ?

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *