Many developers think that correlated subquires are not efficient.
The correct answer starts with "It depends on...".
Sometimes we can achieve the same efficient perfomance
what we can do with inline views.
Let's see the following example:
(Who earns more then his/her departments's average salary?)
SELECT e.last_name, e.department_id, e.salary FROM employees e
WHERE e.salary> (SELECT AVG(salary) FROM employees where
department_id=e.department_id );
SQL_ID 3jr7194pfhh3s, child [...]
31 Mar - 12:14am
SQL developers frequently hear and realize that the subqueries
are not efficient, avoid using them.
Indeed, many times those SELECT statements, which contains subquires
in the WHERE or HAVING clause are not very efficient.
But this not a general rule!
I'd like to demonstrate that subquieres with IN operator and
correlated subquires can be very efficient.
Let see the next example:
SELECT last_name, [...]
The Bulk Binding is relatively old technology,
but unfortunatelly rarely used by developers.
Basically the Bulk Binding is buffer technology.
Whenever you want to execute an SQL Statement or Fetch statement in loop,
please consider the Bulk Binding.
When you communicate withmthe SQL Engine from your PL/SQL program,
then Oracle creates a - so called - context switch.
This consumes pretty amount [...]
Up to Oracle 1og we have an algorythm, called Bind Peeking.
Briefly, this means the following:
In SQL statement we use a bind variable with not null value.
First time, when SQL statement was executed, the Oracle will apply Hard Parsing to establish the best execusion plan for this statement, using (“peeking”) the value of the bind variable.
Next [...]
SQL injection is a technique for maliciously exploiting applications that use client-supplied data in SQL statements.
Let’s consider the following example.
Developer wanted to allow for the End Users to select data
from an arbitrary (employees’s like) table for ‘IT_PROG’ job category.
CREATE OR REPLACE PROCEDURE SQL_INJ(tname VARCHAR2) IS
type emp_cur_type IS REF CURSOR;
[...]