Lexical references

I am making an oracle 10g report and in Query Builder I tried to use lexical reference after the from clause
like

SELECT ORDID, TOTAL
FROM &ATABLE;

But it was showing me an error "invalid table name"
Can't i use a lexical reference to make me enter the table name at run time?

please help.

Questions by pragya.vyas

Showing Answers 1 - 9 of 9 Answers

Raghu2008

  • Sep 18th, 2008
 

You can use the lexical parameters at From clause but you have to use lexical parameter as given below.


SELECT 'last_name' client_last_name, 'first_name' client_first_name,
'mailing_address1' mailing_address, 'city' city
FROM dual
WHERE 1=2
&RGROUP1

In above query I have used 2 lexical parameters and while calling the above report pass the &RGOUP1 values using the below statement.

:RGROUP1 := 'UNION
SELECT 'last_name' client_last_name, 'first_name'
client_first_name, 'mailing_address1' mailing_address, 'city' city
FROM emp_det'

Using the above method you can generate the dynamic query in the report.

Thanks,
Raghu.

Lexical references is used to runtime dynamic where conditions. If you create query through query builder colon(:) must be used and this is used in after parameter form.


Jitendra kumar(software Engineer).


  Was this answer useful?  Yes

Rkhatri

  • Feb 25th, 2009
 

It is working fine with Oracle 10g and even with 11g

SQL>select &a, &b from &tablename;

It will ask respective values and it work fine

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions