using functions defined in the sql with clause?

April 1, 2014 — Leave a comment

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.

No Comments

Be the first to start the conversation!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.