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 and the task is to count the number of characters and words in the given string.
Input: str = 'Geeks for geeks ' Output: Characters = 13 , Words = 3 Input: str = 'A Computer science portal' Output: Characters = 22, Words = 4
Approach is to maintain two counter variables i.e. one for the characters and the other for words. Start traversing character one by one and increment the count and when there is a blank space then increment the count of words.
Below is the required implementation:
No. of characters:15 No. of words: 3
- Difference between SQL and PLSQL
- Convert the given numbers into words in Pl/SQL
- Count odd and even digits in a number in PL/SQL
- Reverse a string in PL/SQL
- SQL | String functions
- No. of vowels and consonants in a given string in PL/SQL
- Check whether a string is palindrome or not in PL/SQL
- SELECT INTO statement in SQL
- Pivot and Unpivot in SQL
- Common error in Group By
- Categories of SQL Functions
- Query to find 2nd largest value in a column in Table
- Comparisons between Oracle vs SQL Server
- SQL vs NoSQL: Which one is better to use?
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.