简体   繁体   中英

Oracle SQL how to call created function

I made a function in Oracle that calculates the distance between two points (x1,y1) and (x2,y2) ,here it is:

CREATE OR REPLACE FUNCTION afstand_cart (x1 IN number, x2 IN number, y1 IN number, y2 IN number)
RETURN number IS
BEGIN
return sqrt((x2-x1)*(x2-x1) + (y2-y1)*(y2-y1));
END;

Now how do I call this function?

SELECT afstand_cart(0,0,1,1) FROM dual  

Doesn't work.

The syntax in Oracle is to use call :

CALL afstand_cart(0,0,1,1)

see here

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM