Manual No 14
Manual No 14
Objection
Introduction of functions in PL/SQL
Introduction
Write a Function to check the given number is prime or not.
FUNCTION DEFINITION :
DECLARE
given_number NUMBER;
prime_check NUMBER;
BEGIN
given_number:=&given_number;
prime_check:=isprime(given_number);
IF prime_check=0 THEN
dbms_output.put_line(’NUMBER IS PRIME’);
60
61
ELSE
dbms_output.put_line(’NUMBER IS NOT PRIME’);
END IF;
END;
/
Output
Output