Skip to Main Content

Explore Oracle PL/SQL

Free tips and training every month! Subscribe for reminders and more from Office Hours. FAQ

Header container

February 5, 2019

Calling PL/SQL Functions from SQL
Isn't it great how you "extend" Oracle SQL by calling your own user-defined PL/SQL functions from within SQL statements? Yes, it really is nice, but there are things you need to know about and take into consideration, from read-consistency to optimizer nuances.

Chris Saxon gave an overview of the key issues from performance to correctness.

Highlights include:

03:30 - performance comparison of plain SQL vs. calling PL/SQL function
04:30 - SQL <> PL/SQL context switches; what they are and how they affect performance
06:10 - Techniques to make calling PL/SQL from SQL faster: scalar subquery caching, deterministic keyword, function result cache, pragma UDF
14:00 - Performance comparison of these options
21:20 - Performance comparison when calling non-deterministic functions
35:30 - The danger when you have SQL that calls PL/SQL that calls SQL
41:30 - Calling PL/SQL in SQL dos and don'ts

Subscribe to give us feedback and be notified of upcoming sessions!

Ask a Question

Ask The Experts - Right Now!

Do you have a question about Calling PL/SQL Functions from SQL. you'd like our experts to answer in their next session? Sign in and submit it here.

Please note that we cannot guarantee to answer all questions. We cannot help you with open Service Requests or account/licensing issues.


Your Experts
Chris Saxon
Chris Saxon, Oracle Developer Advocate for SQL    
Chris Saxon is the quizmaster for the Database Design competitions and an Oracle Developer Advocate for SQL. His job is to help you get the best out of the Oracle Database and have fun with SQL! He's also part of the answer team on Ask TOM and creates YouTube videos at The Magic of SQL channel.
Steven Feuerstein
Steven Feuerstein, Developer Advocate for PL/SQL    
Steven Feuerstein leads a team of Developer Advocate at Oracle Corporation, and is obsessed with the Oracle PL/SQL language, having written ten books on it (all published by O'Reilly Media). He's published over 1400 quizzes on PL/SQL at the Oracle Dev Gym.