CREATE OR REPLACE FUNCTION rectangle_area (length IN NUMBER,width IN NUMBER) RETURN NUMBER IS
area NUMBER;
BEGIN
area := length * width;
RETURN area;
END rectangle_area;
/
DECLARE
length NUMBER := 5;
width NUMBER := 4;
area NUMBER;
BEGIN
area := rectangle_area(length, width);
DBMS_OUTPUT.PUT_LINE('Length: ' || length);
DBMS_OUTPUT.PUT_LINE('Width: ' || width);
DBMS_OUTPUT.PUT_LINE('Area of the rectangle: ' || area);
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