Curiosity - Reverse Function

Dúvidas, dicas e truques de PL/SQL. Aqui também vão assuntos relacionados a pacotes, triggers, funções, Java-Stored Procedures, etc
Post Reply
User avatar
dr_gori
Moderador
Moderador
Posts: 5024
Joined: Mon, 03 May 2004 3:08 pm
Location: Portland, OR USA
Contact:
Thomas F. G

Você já respondeu a dúvida de alguém hoje?
https://glufke.net/oracle/search.php?search_id=unanswered

There is a non-documented function:

Select all

SQL> select reverse('123456789') from dual; 
 
REVERSE(' 
--------- 
987654321 
 
SQL> select reverse('bom dia!') from dual; 
 
REVERSE( 
-------- 
!aid mob 
 
SQL> select reverse('GLUFKE') from dual; 
 
REVERS 
------ 
EKFULG
charlesmafra
Rank: Estagiário Sênior
Rank: Estagiário Sênior
Posts: 8
Joined: Thu, 19 Aug 2004 9:45 am
Location: Angola
Contact:
Charles Mafra
Oracle Developer

Reverse can also be used for a loop being covered from the highest value for the lowest, as in the example ...


Good did not know the command Reverse as mentioned earlier, as this is a PL / SQL forum, I remembered this.
User avatar
anderson
Rank: Analista Júnior
Rank: Analista Júnior
Posts: 75
Joined: Mon, 06 Jun 2005 1:08 pm
Location: Toledo - PR
Contact:
Anderson Nuernberg
---

Another interesting example ...

Select all

select reverse('socorram me subino onibus em marrocos') frase from dual;
's: -o
User avatar
dr_gori
Moderador
Moderador
Posts: 5024
Joined: Mon, 03 May 2004 3:08 pm
Location: Portland, OR USA
Contact:
Thomas F. G

Você já respondeu a dúvida de alguém hoje?
https://glufke.net/oracle/search.php?search_id=unanswered

There goes one more:

Select all

select reverse('A MALA NADA NA LAMA') frase from dual; 
: D
leonchacal
Rank: Estagiário Sênior
Rank: Estagiário Sênior
Posts: 12
Joined: Mon, 18 Aug 2014 3:51 pm

The interesting thing is that the reverse does not work like this:


Error report -
ORA-06550: Line 8, column 15:
PLS-00201: The 'reverse' identifier must be declared
or-06550: line 8, column 2:
DanielNN
Moderador
Moderador
Posts: 641
Joined: Mon, 03 Sep 2007 3:26 pm
Location: Fortaleza - CE
att,

Daniel N.N.

Two more,: D

Select all

 
select reverse('Anotaram a data da maratona') frase from dual; 
 
select reverse('A man, a plan, a canal, Panama!') setence from dual; 
Post Reply
  • Information
  • Who is online

    Users browsing this forum: Bing [Bot] and 9 guests