Professional Documents
Culture Documents
a single value.
While creating the bind parameter we should use the : before the name of the
parameter.
Example :p_deptno
Example 2: WHERE clause The value of CUST is used to select a single customer.
Example 4: HAVING clause The value of MIN SAL is used to select with a minimum
total salary of
dept.
Example 5: ORDER BY clause The value of SORT is used to select either SAL or
HIREDATE as the sort
criterion. Note that this is not the same as ORDER BY 1 because
:SORT is used as a value
rather than to identify the position of an expression in the SELECT
list. Note that DECODE is
required in this example. You cannot use a bind variable in an ORDER
BY clause unless it is
with DECODE.
Lexical references are placeholders for columns or parameters that you embed in a
SELECT statement. You can use lexical references to replace the clauses appearing
after SELECT, FROM, WHERE, GROUP BY, ORDER BY, HAVING, CONNECT BY, and
START WITH. Use a lexical reference when you want to substitute multiple values at
runtime.
Step 1) Go to the Object Navigator and go to the Data Model and write the sql
query.
Define the Lexical parameter P_WHERE as below.
SELECT EMPNO,ENAME,SAL
FROM EMP
&P_WHERE