Lexical parameter is used to replace a specific ‘String’ in sql statement

at runtime.
 It can be created with ‘&’ at runtime.
 String to replace can be handled in ‘After Parameter
Form’trigger.
 Used in SQL only.
 Used in all Clauses.
In this example we are going to retrieve the employees who hired in
certain period of time i.e.
Step 1: Open Reports builder and connect the database, go to the data
model of a new report and write a query as bellow

Press OK, system will show that ‘Query has created the lexical
parameter’

Step 2: Now create report using this query. To do this right click on
‘Q_1’ and select ‘Report Wizard’ shown below

.

.

such as column names. It replaces any part of a SELECT statement. the FROM clause. To create a lexical reference in a query. Lexical parameters can dynamically replace clauses in the Select statement in the data model and even the whole select statement.Step 3: Provide the dynamic parameter value as bellow you can also use WHERE hirdate > ’01-Jan-2012′ OR WHERE hirdate = ’01-Jan-2012′ WHERE hirdate BETWEEN ’01-Jan-2012′ AND ’01-Jan- 2013′ About these ads Posted by Elangovan Ragavan at 09:33 No comments: Email ThisBlogThis!Share to TwitterShare to FacebookShare to Pinterest Labels: Lexical & Bind. prefix the parameter name with an ampersand (&) . REPORT Lexical parameter These are used to replace a value dynamically at run time. the WHERE clause. the ORDER BY clause.

HAVING. HAVING. however.. SELECT Col1.. number. You cannot make lexical references in a PL/SQL statement. Report Builder will create a parameter for you by default. or date. You create a bind reference by entering a colon (:) followed immediately by the column or parameter name. WHERE. GROUP BY. and START WITH. ORDER BY. The bind parameter is used as well and lexical parameter used for ex: Bind parameter has a PREFIX colon (:) Bind references (or bind variables) are used to replace a single value in SQL or PL/SQL. FROM. GROUP BY. WHERE. ..ename from emp &X At run time we can pass the entire where condition like where deptno=30 and sal>3000 etc. use a bind reference in PL/SQL to set the value of a parameter that is then referenced lexically in SQL. Bind references may not be referenced in FROM clauses or in place of reserved words or clauses.Col2 FROM &ATABLE select empno. If you do not create a column or parameter before making a bind reference to it in a SELECT statement. where sal>6000 parameter We can create lexical parameter & bind parameter in the report in the data model query. such as a character string. You can use lexical references to replace the clauses appearing after SELECT. Specifically. You can. CONNECT BY. and START WITH clauses of queries. bind references may be used to replace expressions in SELECT. ORDER BY.Lexical parameter has a PREFIX ampersand (&) Lexical references are placeholders for text that you embed in a SELECT statement. CONNECT BY.

where. start with cause of queries. where. &condition. It is started with Colon (:) It is started with Amparsign (&) It is used to accept the value when It is used to build report queries executing the query dynamically It is used in (select.deptno FROM emp WHERE empno=:empno . connect by.deptno FROM emp WHERE empno=:empno Difference between Bind and Lexical parameter? Bind Parameter Lexical Parameter Bind parameter are used to pass a lexical parameter may be used single value in sql. having. order by.SELECT ename. It is used both sql & pl/sql. group. pl/sql to replace expressions in select.ename. Both bind and lexical SELECT &deptno. order It is used in all clause. It is used only in sql. by group by ) but not in from. select * from emp where select * from emp where emp_no=:emp_no.