Home » SQL & PL/SQL » SQL & PL/SQL » Using INSTR function
Using INSTR function [message #207865] Thu, 07 December 2006 04:01 Go to next message
irajasekharhexa
Messages: 6
Registered: June 2005
Location: Bangalore
Junior Member

Can any body suggest that how can we identify the position of blank space in a sentence.

Suppose if we have 'hello madam'

The space position is 6.

But when iam using INSTR(column_name,'''',1) it si giving Zero records.

Any help pls.

Re: Using INSTR function [message #207873 is a reply to message #207865] Thu, 07 December 2006 04:11 Go to previous messageGo to next message
Littlefoot
Messages: 20901
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Query you used does NOT look for a blank space. This one does:
SQL> select instr('hello madam', ' ', 1) from dual;

INSTR('HELLOMADAM','',1)
------------------------
                       6

SQL>
Re: Using INSTR function [message #208179 is a reply to message #207873] Fri, 08 December 2006 08:32 Go to previous messageGo to next message
selvakumar_82
Messages: 138
Registered: October 2005
Location: chennai
Senior Member
Hi

select length('hi madam bye madam')-length(Replace('hi madam bye madam',' ')) from dual;


Regards
Selva.R
Re: Using INSTR function [message #208186 is a reply to message #208179] Fri, 08 December 2006 08:50 Go to previous message
ebrian
Messages: 2794
Registered: April 2006
Senior Member
selvakumar_82 wrote on Fri, 08 December 2006 09:32

select length('hi madam bye madam')-length(Replace('hi madam bye madam',' ')) from dual;

This will count how many spaces occur in the string.

Littlefoot already answered the OP's question.
Previous Topic: Array, temp table, loop? Suggestions please.
Next Topic: substr truncates one byte
Goto Forum:
  


Current Time: Fri Dec 09 13:47:21 CST 2016

Total time taken to generate the page: 0.06502 seconds