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
  

Poston Fri, 16 Jul 2004 9:28 am

Tai a undocumented function:
Code: 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
dr_gori
Location: Portland, OR USA

Thomas F. G

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

Poston Thu, 19 Aug 2004 9:59 am

Can also be used to Reverse a LOOP be traversed from the highest to the lowest, as in the example.

Code: Select all
  1  BEGIN
  2  for x in  REVERSE 1..10 LOOP
  3     DBMS_OUTPUT.PUT_LINE('VALOR DE X ='||X);
  4  END LOOP;
  5* END;
SQL> /
VALOR DE X =10
VALOR DE X =9
VALOR DE X =8
VALOR DE X =7
VALOR DE X =6
VALOR DE X =5
VALOR DE X =4
VALOR DE X =3
VALOR DE X =2
VALOR DE X =1

Procedimento de PL/SQL concluído com êxito.
Good didn't know the REVERSE command as mentioned earlier, as this is a forum for PL/SQL, I remembered this.
charlesmafra
Location: Angola

Charles Mafra
Oracle Developer

Poston Fri, 25 Nov 2005 4:11 pm

Another very interesting example.

Code: Select all
select reverse('socorram me subino onibus em marrocos') frase from dual;


[]´s :-o
anderson
Location: Toledo - PR

Anderson Nuernberg
---

Poston Sat, 26 Nov 2005 10:42 am

There goes another one:
Code: Select all
select reverse('A MALA NADA NA LAMA') frase from dual;
:D
dr_gori
Location: Portland, OR USA

Thomas F. G

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

Poston Fri, 23 Mar 2018 12:30 pm

What is interesting is that the reverse does not work like this:
Code: Select all
declare
v_campo varchar2(20);
v_inverte varchar2(20);

Begin
v_campo := 'Teste de inversão';

v_inverte := reverse(v_campo);
   
dbms_output.put_line(v_inverte); 
End;
-error ORA-06550: line 8, column 15: PLS-00201: identifier ' REVERSE ' must be declared ORA-06550: line 8, column 2:
leonchacal

Poston Fri, 23 Mar 2018 1:51 pm

Two more,:D

Code: Select all
select reverse('Anotaram a data da maratona') frase from dual;

select reverse('A man, a plan, a canal, Panama!') setence from dual;
DanielNN
Location: Fortaleza - CE

att,

Daniel N.N.



Return to PL/SQL

Who is online

Users browsing this forum: No registered users and 13 guests