1

I want to create a function where a caller can declare 4 parameters and PL/SQL will solve an equation that uses these parameters. My current code is:

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;

I'm pretty sure the error is in the return-statement but this far I haven't been able to figure it out.

1 Answer 1

2

function power() accepts two parameters.

The base and the exponent.

power(base, exponent)

like, power(100, 2) = 10000

So, your power function should be like power(p_x2 - p_x1, 2), I mean your are missing second parameter in the function power() , second parameter should be a value according to your logic.

For more Detail Click : Oracle Power Function

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.