PL/SQL function to check triangle validity

Q. Write a PL/SQL function to accept three sides of a triangle. The sides of the triangle should be input by the user. The function should return a Boolean value:- 'true' if the triangle is valid, otherwise 'false'.
A triangle is valid if the length of each side is less than the sum of the lengths of the other two sides.


Answer:

Aim: To check if the dimensions entered by the user can form a valid triangle.

So the function is given below.

CREATE OR REPLACE FUNCTION revstr(st IN OUT varchar2) RETURN boolean AS len number:=length(st);
BEGIN
FOR j IN 1..len LOOP st:=st||substr(st,len-j,1);
END LOOP;
st:=substr(st,len);
len:=length(st);
st:=substr(st,1,len-1);
dbms_output.put_line('reverse string is '||st);
RETURN TRUE;
END;
/