Home » SQL & PL/SQL » SQL & PL/SQL » How to cut a string in one string. [merged]
How to cut a string in one string. [merged] [message #396593] Tue, 07 April 2009 05:22 Go to next message
raghu.iv85
Messages: 13
Registered: December 2008
Location: banglore
Junior Member
Hi all,

I want to cut a string in another string using sql query. Suppose I want to cut 'HIST_NM_T' string in 'SH12_MC30_CE_VS_HIST_NM_T' string.


Can you anyone tell me the query?

Thanks in advance.

Regards,
Raghu.
How to cut a string in one string. [message #396595 is a reply to message #396593] Tue, 07 April 2009 05:24 Go to previous messageGo to next message
raghu.iv85
Messages: 13
Registered: December 2008
Location: banglore
Junior Member
Hi all,

I want to cut a string in another string using sql query. Suppose I want to cut 'HIST_NM_T' string in 'SH12_MC30_CE_VS_HIST_NM_T' string.


Can you anyone tell me the query?

Thanks in advance.

Regards,
Raghu.
Re: How to cut a string in one string. [message #396596 is a reply to message #396595] Tue, 07 April 2009 05:26 Go to previous messageGo to next message
ramoradba
Messages: 2454
Registered: January 2009
Location: AndhraPradesh,Hyderabad,I...
Senior Member
Use SUBSTR

IND> select substr('Oracle Corporation',13) from dual;
ration
1 row selected.


IND> select substr('SH12_MC30_CE_VS_HIST_NM_T',17) from dual;
HIST_NM_T

1 row selected.

[Updated on: Tue, 07 April 2009 05:27]

Report message to a moderator

Re: How to cut a string in one string. [message #396598 is a reply to message #396596] Tue, 07 April 2009 05:37 Go to previous messageGo to next message
raghu.iv85
Messages: 13
Registered: December 2008
Location: banglore
Junior Member
Thank you ram.

Regards,
Raghu.
Re: How to cut a string in one string. [message #396599 is a reply to message #396593] Tue, 07 April 2009 05:39 Go to previous messageGo to next message
flyboy
Messages: 1832
Registered: November 2006
Senior Member
Quote:
I want to cut a string in another string using sql query. Suppose I want to cut 'HIST_NM_T' string in 'SH12_MC30_CE_VS_HIST_NM_T' string.

If "cut" means removal (posting required result would help to understand it), then replacing 'HIST_NM_T' with empty string may be what you want:
SQL> select regexp_replace( 'SH12_MC30_CE_VS_HIST_NM_T', 'HIST_NM_T', '' )
  2  from dual;

REGEXP_REPLACE('
----------------
SH12_MC30_CE_VS_

1 row selected.

SQL> 
Re: How to cut a string in one string. [message #396601 is a reply to message #396599] Tue, 07 April 2009 05:41 Go to previous messageGo to next message
ramoradba
Messages: 2454
Registered: January 2009
Location: AndhraPradesh,Hyderabad,I...
Senior Member
Quote:
If "cut" means removal (posting required result would help to understand it), then replacing 'HIST_NM_T' with empty string may be what you want:


Nice.Good rising.

Thanks & regards
Sriram
Re: How to cut a string in one string. [message #396629 is a reply to message #396601] Tue, 07 April 2009 06:54 Go to previous message
JRowbottom
Messages: 5933
Registered: June 2006
Location: Sunny North Yorkshire, ho...
Senior Member
Quote:
Nice.Good rising.


Congratulations @Flyboy - you're now an honorary loaf of bread
Previous Topic: Oracle Float to Date Conversion
Next Topic: view to see create table script
Goto Forum:
  


Current Time: Thu Dec 08 08:39:53 CST 2016

Total time taken to generate the page: 0.13691 seconds