Reverse a string in PL/SQL Last Updated : 29 Jun, 2018 Comments Improve Suggest changes Like Article Like Report 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. Given a string, the task is to reverse a string using PL/SQL. Examples: Input: skeegrofskeeg Output: geeksforgeeks Input: geeks Output: skeeg Approach: Find the length of the string. Then traverse the string in a reverse manner. Store the characters in another string. Print the final string. Below is the required implementation: SQL DECLARE -- declare variable str , len -- and str1 of datatype varchar str VARCHAR(20) := 'skeegrofskeeg'; len NUMBER; str1 VARCHAR(20); BEGIN -- Here we find the length of string len := Length(str); -- here we starting a loop from max len to 1 FOR i IN REVERSE 1.. len LOOP -- assigning the reverse string in str1 str1 := str1 || Substr(str, i, 1); END LOOP; dbms_output.Put_line('Reverse of string is ' || str1); END; -- Program End Output : Reverse of string is geeksforgeeks Comment More infoAdvertise with us Next Article Reverse a string in PL/SQL S Shashank12 Follow Improve Article Tags : Misc SQL SQL-PL/SQL Practice Tags : Misc Similar Reads PHP Reverse a String Reversing a string in PHP refers to rearranging a given string's characters in reverse order, starting from the last character to the first. This task is often used in text manipulation or algorithm challenges, highlighting PHP's string-handling capabilities.Examples: Input : GeeksforGeeksOutput : s 3 min read Reverse a number in PL/SQL 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. Explanation: Consider the example, input = 12345. Step 2 min read Using the REVERSE Function in SQL In SQL, the REVERSE function is a handy tool that does exactly what its name suggests, it reverses the order of characters within a string. This function can be particularly useful for various data manipulation tasks, allowing you to quickly transform text in a way that suits your needs. We will exa 4 min read SQL Server SUBSTRING() Function The SQL Server SUBSTRING function extracts a substring from a string, starting at a specified position and with an optional length. The SUBSTRING function also works in Azure SQL Database, Azure SQL Data Warehouse, and Parallel Data Warehouse. SyntaxThe SQL SUBSTRING function syntax is: SUBSTRING(in 3 min read Reverse a String â Complete Tutorial Given a string s, the task is to reverse the string. Reversing a string means rearranging the characters such that the first character becomes the last, the second character becomes second last and so on.Examples:Input: s = "GeeksforGeeks"Output: "skeeGrofskeeG"Explanation : The first character G mo 13 min read Like