Home » SQL & PL/SQL » SQL & PL/SQL » Query for counting alphabet in word
Query for counting alphabet in word [message #10684] Mon, 09 February 2004 23:53 Go to next message
ruchi
Messages: 8
Registered: October 2002
Junior Member
hello

Please guide me

1>>>

I need a sql query that count each occurrance of alphabet in a word.

eg

certification

occurrance of 'c' is 2 in above word

2>>

A column in a table contain data in following format

firstname,lastname.

eg-           john,mathew

how to write a query that will  return the output as below for all rows in table.

lastname,firstname

eg-   mathew,john

 thanks

ruchi

 
Re: Query for counting alphabet in word [message #10688 is a reply to message #10684] Tue, 10 February 2004 01:23 Go to previous messageGo to next message
Prashanth
Messages: 41
Registered: September 1999
Member
for query #2, try this

select lastname||','||firstname your_table;
Re: Query for counting alphabet in word [message #10689 is a reply to message #10688] Tue, 10 February 2004 01:24 Go to previous messageGo to next message
Prashanth
Messages: 41
Registered: September 1999
Member
small correction

SQL > select lastname||','||firstname from your_table;
Re: Query for counting alphabet in word [message #10698 is a reply to message #10684] Tue, 10 February 2004 09:35 Go to previous message
Todd Barry
Messages: 4819
Registered: August 2001
Senior Member
nvl(length(:word) - length(replace(:word, :letter)), 0)
Previous Topic: Connect by prior (Oracle 8i)
Next Topic: calling a procedure from a procedure
Goto Forum:
  


Current Time: Tue Apr 23 06:54:14 CDT 2024