oracle - Sql query OR function to reverse the Arabic strings -


i need sql query reverse arabic string.

ex:

  1. string 1: abc def (assume abc def arabic string ) out put should cba fed.
  2. string 2: abcdef (assume abcdef arabic string ) out put should fedcba.

thanks rajeev naik

this 3 step process

  1. split string rows using space separator
  2. reverse each string
  3. join strings together

sql fiddle demo

with spacesplit (     select          t.id,         trim(regexp_substr(t.text, '[^ ]+', 1, lines.column_value)) text,          lines.column_value seq     t,       table (cast (multiset       (select level dual               connect level <= regexp_count(t.text, ' ')+1       ) sys.odcinumberlist ) ) lines     order id, lines.column_value ), reversestring (     select id, reverse(text) text, seq     spacesplit ) select id, listagg(text, ' ') within group (order seq) text   reversestring group id ; 

output

| id |     text | |----|----------| |  1 |  cba fed | |  2 |   fedcba | |  3 | ba dc fe | 

Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -