GeekInterview.com
   Home |  Tech FAQ  |   Interview Questions |  Placement Papers |  Tech Articles |  Learn |  Freelance Projects |  Online Testing |  Geeks Talk |  Job Postings |  Knowledge Base | Site Search |  Add/Ask Question

  GeekInterview.com  >  Interview Questions  >  Oracle  >  D2K

 Print  |  
Question:  lexical references

Answer: 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.


September 09, 2008 13:22:27 #1
 Raghu2008   Member Since: August 2008    Total Comments: 9 

RE: lexical references
 
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.

     

 

Back To Question