On Dec 11, 9:52 pm, gayathri Dev <gd0...@gmail.com> wrote: > Again, its another issue. > > select 'Atext-Btext-Ctext-Dtext' from dual; > > Expected Output: > ABCD. > > select 'Atext' from dual; > > Expected Output: > A > > select 'Atext-Btext' from dual; > > Expected Output: > AB > > Want to extract first character after hypen(-) > I want to achieve this result from Oracle 10g SQL . Please suggest a quick > option. > > Thanks > `G
SQL*Plus: Release 10.2.0.4.0 - Production on Sun Dec 12 01:00:22 2010 Copyright (c) 1982, 2007, Oracle. All Rights Reserved. Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options SQL> select replace(replace('&1','text',''),'-','') alpha from dual; Enter value for 1: Atext-Btext-Ctext-Dtext old 1: select replace(replace('&1','text',''),'-','') alpha from dual new 1: select replace(replace('Atext-Btext-Ctext- Dtext','text',''),'-','') alpha from dual ALPHA -------------------------------------------------------------------------------- ABCD SQL> / Enter value for 1: Atext old 1: select replace(replace('&1','text',''),'-','') alpha from dual new 1: select replace(replace('Atext','text',''),'-','') alpha from dual ALPHA -------------------------------------------------------------------------------- A SQL> / Enter value for 1: Atext-Btext old 1: select replace(replace('&1','text',''),'-','') alpha from dual new 1: select replace(replace('Atext-Btext','text',''),'-','') alpha from dual ALPHA -------------------------------------------------------------------------------- AB SQL> David Fitzjarrell -- You received this message because you are subscribed to the Google Groups "Oracle PL/SQL" group. To post to this group, send email to Oracle-PLSQL@googlegroups.com To unsubscribe from this group, send email to oracle-plsql-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/Oracle-PLSQL?hl=en