Problem statement:
Write a query identifying the type of each record in the TRIANGLES table using its three side lengths. Output one of the followin
this answer is working well in sql * plus but not in hackerrank i dont know why? try this.
declare
cursor mytriangle is select A,B,C from triangles;
a triangles.A %type;
b triangles.B %type;
c triangles.C %type;
begin
open mytriangle;
if mytriangle%isopen then
loop
fetch mytriangle into a,b,c;
exit when mytriangle %notfound;
case
when a+b<=c or b+c<=a or a+c<=b then
dbms_output.put_line('Not A Triangle');
when a=b and b=c then
dbms_output.put_line('Equilateral');
when a=b or b=c or c=a then
dbms_output.put_line('Isoceles');
when a+b>=c and b+c>=a and a+c>=b and a!=b and b!=c and c!=a then
dbms_output.put_line('Scalene');
else
dbms_output.put_line('');
end case;
end loop;
close mytriangle;
else dbms_output.put_line('cannot open the cursor');
end if;
end;