473,326 Members | 2,010 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Function To get the number of dots in string variable

Is there any function in SQL to get the number of dots in a string variable.

Suppose
str1 is a varchar2 type variable

str1='adf.hjk.jhh.jhkjh.'

Any function or any method is available in sql to get the number of dots in the string data variable. The result should give the number of dots present i.e it should give 4 as value.
Sep 4 '07 #1
2 1556
debasisdas
8,127 Expert 4TB
Try to use the functions REPLACE,TRANSLATE and LENGTH ,for the purpose.

If u want u can define your own FUNCTION for that using PL/SQL
Sep 4 '07 #2
amitpatel66
2,367 Expert 2GB
DECLARE
v_cnt NUMBER := 0;
a VARCHAR2(20) := '...................';
BEGIN
FOR I IN 1..LENGTH(a) LOOP
IF(SUBSTR(a,i,1) = '.') THEN
v_cnt:= v_cnt + 1;
END IF;
END LOOP;
DBMS_OUTPUT.PUT_LINE(v_cnt);
v_cnt:=0;
END;
/
Sep 5 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: Penn Markham | last post by:
Hello all, I am writing a script where I need to use the system() function to call htpasswd. I can do this just fine on the command line...works great (see attached file, test.php). When my...
3
by: domeceo | last post by:
can anyone tell me why I cannot pass values in a setTimeout function whenever I use this function it says "menu is undefined" after th alert. function imgOff(menu, num) { if (document.images) {...
10
by: Robert Skidmore | last post by:
Take a look at this new JS function I made. It is really simple but very powerful. You can animate any stylesheet numeric value (top left width height have been tested), and works for both % and px...
28
by: Larax | last post by:
Best explanation of my question will be an example, look below at this simple function: function SetEventHandler(element) { // some operations on element element.onclick = function(event) {
2
by: rn5a | last post by:
All the String functions like 'Len', 'Left', 'Right', 'Mid' etc. that are available in ASP are supported by ASP.NET as well except for the string function 'String'. The 'String' function takes...
3
pbmods
by: pbmods | last post by:
AN INTRODUCTION TO FUNCTION OBJECTS LEVEL: INTERMEDIATE PREREQS: OBJECTS You've seen it before. You're setting up an XMLHttpRequest call, and you need to execute a function when it returns, so...
3
by: David | last post by:
Hi Everyone, I'm looking for a way to grab a number from a string, although this number is not at either end of the string. Here is the string in question: var el =...
5
by: Middletree | last post by:
My results after doing some stuff are going to have names separated by commas. Example: James & Beth Williams John & Mary Smith Ross & Rachel Gellar Willy & Wanda Wonka But the number of...
6
by: jmarcrum | last post by:
Hi everyone! I'm using a super class (DVD.java) that handles another class (EnhancedDVD.java). I want to pass the "details" of the DVD into the super class DVD.java. The super class contains the...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.