【问题标题】:Oracle PL/SQL Function - caller declares parameter values => function returns equation solutionOracle PL/SQL 函数 - 调用者声明参数值 => 函数返回方程解
【发布时间】:2015-09-22 10:48:13
【问题描述】:

我想创建一个函数,调用者可以在其中声明 4 个参数,PL/SQL 将求解使用这些参数的方程。我当前的代码是:

create or replace function get_distance(
  p_y1 in number,
  p_x1 in number,
  p_y2 in number,
  p_x2 in number)
return number
as
begin
return SQRT(power(p_x2 - p_x1) + power(p_y2 - p_y1));
end;

我很确定错误在返回语句中,但到目前为止我还无法弄清楚。

【问题讨论】:

    标签: oracle function plsql


    【解决方案1】:

    函数power()接受两个参数。

    底数和指数。

    power(base, exponent)
    

    喜欢,power(100, 2) = 10000

    所以,你的幂函数应该像power(p_x2 - p_x1, 2),我的意思是你在函数power() 中缺少第二个参数,第二个参数应该是根据你的逻辑的值。

    更多详情请点击:Oracle Power Function

    【讨论】:

      猜你喜欢
      • 2013-05-06
      • 2012-10-31
      • 1970-01-01
      • 2013-02-26
      • 1970-01-01
      • 2011-05-03
      • 1970-01-01
      • 2016-09-28
      • 1970-01-01
      相关资源
      最近更新 更多