Consider the opposite of a Word

Hi all
I want to reverse the words any word or phrases
for example
demand chain
--------------- ----------
MY NAME IS RAMA RAMA IS MY NAME
IT OF GOOD, GOOD IT IS

and it's another query, I want that
I have a lot of descriptions such as
FREE 10 M PRODUCT SIZE
FREE 20 M PRODUCT SIZE
30 M FREE PRODUCT SIZE
ABC 123 123 ORACLE
ABC 123 123 XYZ
KLM ABC 123 123
I don't know what will be the string will come but I want to cut the strings common/repeated
as in example above
I only want
SIZE 10 M
SIZE 20 M
SIZE 30 M
ORACLE 123
XYZ 123
KLM 123

Please review.

Stew of Ashton wrote:

This variant is faster

Perhaps, but is this correct?

SQL> with t as (
  2             select 'MY  NAME  IS  RAMA' s from dual union all
  3             select 'HE    IS         GOOD' from dual
  4            )
  5  select (
  6    select ltrim(sys_connect_by_path(regexp_substr(s,'\w+',1,regexp_count(s,'\w+') + 1 - level),' ')) r
  7    from  dual
  8    where connect_by_isleaf = 1
  9    connect by level <= length(s) + 1 - length(replace(s, ' ', ''))
 10  ) answer
 11  from t
 12  /
  select ltrim(sys_connect_by_path(regexp_substr(s,'\w+',1,regexp_count(s,'\w+') + 1 - level),' ')) r
                                                                                     *
ERROR at line 6:
ORA-01428: argument '0' is out of range

SQL> 

SY.

Tags: Database

Similar Questions

Maybe you are looking for