Home » SQL & PL/SQL » SQL & PL/SQL » previously word (oracle 10g)
previously word [message #342989] Mon, 25 August 2008 15:12 Go to next message
dolphiniron
Messages: 1
Registered: August 2008
Junior Member
Hi,
I have a table like this;
ID (int), Field1 (varchar2)
---------
1, abc_de_XXX_fg
2, abcd_e_XXX
3, a_b_XXX_c_d
4, a_b_cde
5, XXX_a_b_c
6, abcdef_XXX_ghij_klm_n
...
I want find previously word ("_" is word seperator) before XXX.
Results by this example:
ID (int), Field1 (varchar2), RESULT
---------
1, abc_de_XXX_fg, de
2, abcd_e_XXX, e
3, a_b_XXX_c_d, b
4, a_b_cde, null
5, XXX_a_b_c, null
6, abcdef_XXX_ghij_klm_n, abcdef
Thanks.
Re: previously word [message #342990 is a reply to message #342989] Mon, 25 August 2008 15:15 Go to previous messageGo to next message
BlackSwan
Messages: 25038
Registered: January 2009
Location: SoCal
Senior Member
http://www.orafaq.com/forum/t/88153/0/
Please read & follow posting guidelines as stated in URL above
Re: previously word [message #342996 is a reply to message #342989] Mon, 25 August 2008 15:52 Go to previous message
Barbara Boehmer
Messages: 8631
Registered: November 2002
Location: California, USA
Senior Member
You can use SUBSTR and INSTR or perhaps some regular expression.
Previous Topic: SQL help
Next Topic: Dynamic PL/SQL
Goto Forum:
  


Current Time: Mon Dec 05 12:47:21 CST 2016

Total time taken to generate the page: 0.09223 seconds