[Hint] Potency in PL/SQL without using POWER 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 Wed, 23 Nov 2005 3:31 pm

Everybody knows the function of the Oracle POWER making power:
Code: Select all
select power(2,3)
from dual
in addition to this you can use the function ** for power:
Code: Select all
SQL> set serveroutput on
SQL> declare
  2    vtemp number;
  3  begin
  4    vtemp := 2**3;   -- Equivalente a POWER(2,3)
  5    dbms_output.put_line ( 'Resultado: '||vtemp );
  6  end;
  7  /
Resultado: 8

PL/SQL procedure successfully completed.

SQL>
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, 24 Nov 2005 12:11 pm

dr_gori, noting that the ' ** ' only works inside a block pl, being assigned to a variable, as you even showed up.

If you use select * 2 * 3 from dual, it won't work.

[] ´ s
anderson
Location: Toledo - PR

Anderson Nuernberg
---

Poston Thu, 24 Nov 2005 12:18 pm

Well remembered! :-o
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


  • See also
    Replies
    Views
    Last Post