Like shown below i have 3 columns(Name,No,Address). The
values in name column i want to modity.
Requirement : Keep only once space between two words
(Fname,Lname) in the Name column.
For this what is the query? Please answer me. Advance
Thanks.
Name No Address Reference
manoj kumar
kumar raja
vinzay kumar
rajendra prasad
gowri nath -- -- --
Answers were Sorted based on User's Feedback
Answer / kavitha n
SELECT NAME,
( SUBSTR (NAME, 1, (INSTR (NAME, ' ', 1)))
|| ''
|| SUBSTR (NAME, INSTR (NAME, ' ', -1), LENGTH (NAME))
) output
FROM test;
| Is This Answer Correct ? | 5 Yes | 2 No |
Answer / lince
select substring(NAME,1,charindex(' ',NAME))+' '+
replace(substring(NAME,charindex(' ',NAME),len(NAME)),' ','')
as NAME from test
| Is This Answer Correct ? | 1 Yes | 0 No |
Answer / kalyan
update test set NAME=regexp_replace(NAME,'( ){2,}', ' ')
| Is This Answer Correct ? | 1 Yes | 0 No |
Answer / manojkumar
Thanks to Kavitha and Lince.
Both answers are correct in oracle and in Sql Server.
Excellent
Thanks a lot
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / swastik
select substr(name,1,instr(name,' ',1)-1)||substr(name,instr(name,' ',-1),length(name)) from spacename
| Is This Answer Correct ? | 0 Yes | 0 No |
suppose u hav 1 book with set...page 1-100 n 101 -200 now print page from 2-100 n 102 -200... how we will do..?
Which is the best place to learn hadoop?
What is the best free sql database?
how to implement one-to-one, one-to-many and many-to-many relationships while designing tables? : Sql dba
What does desc stand for?
what is difference b/w pravite procedures and public procedures?
3 Answers Steria, Wipro, Zensar,
What are all the different normalization?
How to use boolean type in select statement?
I have a package in which a table was used in a procedure and compiled later i have dropped the table used in the package what would be the status of package specification and body
how can we find the select statement is indexed or not?
Is oracel sql developer written in java?
what is transaction? : Sql dba
Oracle (3259)
SQL Server (4518)
MS Access (429)
MySQL (1402)
Postgre (483)
Sybase (267)
DB Architecture (141)
DB Administration (291)
DB Development (113)
SQL PLSQL (3330)
MongoDB (502)
IBM Informix (50)
Neo4j (82)
InfluxDB (0)
Apache CouchDB (44)
Firebird (5)
Database Management (1411)
Databases AllOther (288)