Untitled
unknown
plain_text
9 months ago
654 B
10
Indexable
--6 pl/sql boolean function
create or replace function check_complaints(apt_in IN number)
return boolean is
complaint_count number;
result boolean;
begin
SELECT COUNT(*) INTO complaint_count
FROM complaints
WHERE apt_no = apt_in
And (status = 'p' OR status IS NULL);
IF complaint_count > 0 THEN
result := TRUE;
ELSE
result := FALSE;
END IF;
RETURN result;
END check_complaints;
/
declare
apt_in number;
begin
if check_complaints(200) then
dbms_output.put_line('complaint exists');
else
dbms_output.put_line('no complaint');
end if;
end;
/Editor is loading...
Leave a Comment