another nice features of oracle 12cR1: you may define functions within the sql with clause:
SQL> !cat a.sql
WITH
FUNCTION f_test ( a NUMBER) RETURN NUMBER
IS
BEGIN
return a * 2;
END;
select f_test (5) from dual;
/
SQL> @a
F_TEST(5)
----------
10
this is particulary useful when you are not allowed to created stored procedures or you are connected to a read only database.

