Sunday, December 8, 2013

What are the Bind Variables & Substitution Variables?

Bind Variables are also called host variables, which is accessed even after the PL/SQL block is executed.
It can be create using VARIABLE keyword and referenced with a preceding colon-:.

ex.
VARIABLE sal number;
begin
select salary into :sal from emp where emp_id = 11;
end;
/
select firstname , lastname from emp where salary = :sal;

Substitution Variables are used to get user input at run time to avoid hard-coding of values that we can provide run time also.
We can reference the same with in PL/SQL block with symbol ampersand-&.

VARIABLE sal number;
accept empid prompt 'provide emp id' 
declare
v_empid number := &empid; 
begin
select salary into :sal from emp where emp_id = v_empid;
end;
/
select firstname , lastname from emp where salary = :sal;


Tuesday, October 9, 2012

New PL/SQL Features and Enhancements in Oracle 11g


The new PL/SQL features and enhancements in Oracle 11g are as follows:
  • Enhancements to regular expression built-in SQL functions
  • SIMPLE_INTEGER, SIMPLE_FLOAT, and SIMPLE_DOUBLE datatypes
  • CONTINUE statement
  • Sequences in PL/SQL expressions
  • Dynamic SQL enhancements
  • More control over triggers
  • Compound triggers
  • Database resident connection pool
  • Automatic subprogram inlining
  • PL/Scope
  • PL/SQL hierarchical profiler
  • PL/SQL native compiler generates native code directly