Skip to content

Instantly share code, notes, and snippets.

@NekoTashi
Created September 25, 2014 15:13
Show Gist options
  • Save NekoTashi/596bd2692ce2ac8e2ef6 to your computer and use it in GitHub Desktop.
Save NekoTashi/596bd2692ce2ac8e2ef6 to your computer and use it in GitHub Desktop.
PL SQL
DECLARE
i number(3);
j number(3);
function es_primo(p int) return boolean
is
BEGIN
FOR k in reverse 2..(p-1) LOOP
IF mod(p, k) = 0 THEN
RETURN false;
END IF;
END LOOP;
RETURN true;
END;
BEGIN
i:=2;
LOOP
IF ES_PRIMO(i) then
dbms_output.put_line(i||' es primo');
END IF;
exit when i=50;
I:= I+1;
END LOOP;
END;
/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment