oracle - Sql query OR function to reverse the Arabic strings -
i need sql query reverse arabic string.
ex:
- string 1: abc def (assume abc def arabic string ) out put should cba fed.
- string 2: abcdef (assume abcdef arabic string ) out put should fedcba.
thanks rajeev naik
this 3 step process
- split string rows using space separator
- reverse each string
- join strings together
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
Post a Comment