CodeSnip: Practical Use of Translate Function in Oracle
page 2 of 4
by Deepankar Sarangi
Feedback
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 19734/ 42

Problem Statement

The above stated problem can be represented as the figure below. Let us say we have a table consisting of two fields as NAME and ID and has been maintained as follows.

Figure 1

In order to find out how many names are there in the NAME field we cannot put sum function across it. This is because by putting sum across the NAME we will find only 5 instead of 17.

Listing 1

select sum(length(name) - length(translate(name,' ,',' '))+1) NAMES 
from multiple_id;

Figure 2


View Entire Article

User Comments

No comments posted yet.






Community Advice: ASP | SQL | XML | Regular Expressions | Windows


©Copyright 1998-2024 ASPAlliance.com  |  Page Processed at 2024-04-26 5:13:03 PM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search