-- Define the function CREATE OR REPLACE FUNCTION PowerNN (x IN NUMBER, n IN NUMBER) RETURN NUMBER IS result NUMBER; BEGIN result := POWER(x, n); RETURN result; END; / -- Use the function DECLARE x NUMBER := &x; -- Base n NUMBER := &n; -- Exponent result NUMBER; BEGIN result := PowerNN(x, n); DBMS_OUTPUT.PUT_LINE(x || ' power ' || n || ' is ' || result); END; /
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter