Home » Developer & Programmer » Reports & Discoverer » how to pass table name in report sql
how to pass table name in report sql [message #682689] Tue, 10 November 2020 05:54 Go to next message
compuscience
Messages: 94
Registered: September 2012
Member
how to pass table name in report sql query statement

[Updated on: Tue, 10 November 2020 05:55]

Report message to a moderator

Re: how to pass table name in report sql [message #682696 is a reply to message #682689] Tue, 10 November 2020 12:17 Go to previous messageGo to next message
Littlefoot
Messages: 21671
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
You didn't specify Reports version you use, but - if you're on 10g or above, then something like this should work:
select empno, ename
from &p_table_name;

See examples in Advanced Concepts.
Re: how to pass table name in report sql [message #682697 is a reply to message #682696] Tue, 10 November 2020 14:34 Go to previous messageGo to next message
compuscience
Messages: 94
Registered: September 2012
Member
i need to insert variable with constant tabble name


i.e i have table emp
and i need to select from table emp2019


how can i do
&emp2019
Re: how to pass table name in report sql [message #682698 is a reply to message #682697] Tue, 10 November 2020 21:10 Go to previous messageGo to next message
compuscience
Messages: 94
Registered: September 2012
Member
compuscience wrote on Tue, 10 November 2020 22:34
i need to insert variable with constant tabble name


i.e i have table emp
and i need to select from table emp2019


how can i do
&emp2019
Report version 6i
Re: how to pass table name in report sql [message #682707 is a reply to message #682689] Wed, 11 November 2020 03:35 Go to previous messageGo to next message
compuscience
Messages: 94
Registered: September 2012
Member
help please
Re: how to pass table name in report sql [message #682708 is a reply to message #682707] Wed, 11 November 2020 05:10 Go to previous messageGo to next message
Michel Cadot
Messages: 67851
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

He took you 9 hours to answer the simple question about your version, wait a little bit .
In the meantime, review your previous topics, answer the question we posted and feed back in the other ones.

Re: how to pass table name in report sql [message #682709 is a reply to message #682708] Wed, 11 November 2020 05:14 Go to previous messageGo to next message
compuscience
Messages: 94
Registered: September 2012
Member
sorry for that
i didn't see his question about version
when i review the topic and see it i answered
Re: how to pass table name in report sql [message #682719 is a reply to message #682709] Wed, 11 November 2020 15:32 Go to previous messageGo to next message
Littlefoot
Messages: 21671
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
I don't have Reports 6i; but, open its Help and see what's written for lexical parameters.

As of the table name in my example (i.e. "... from &p_table_name") - it means that you'd create a parameter whose name is P_TABLE_NAME and pass the table name while calling the report. In your case, you'd pass "EMP2019". Query wouldn't change at all, it would still be "... from &p_table_name" but Reports would substitute EMP2019 for P_TABLE_NAME.
Re: how to pass table name in report sql [message #682727 is a reply to message #682697] Thu, 12 November 2020 02:12 Go to previous messageGo to next message
flyboy
Messages: 1899
Registered: November 2006
Senior Member
compuscience wrote on Tue, 10 November 2020 21:34
i.e i have table emp
and i need to select from table emp2019

how can i do
&emp2019
Generally, when a character follows right after substitution variable name, dot (.) shall be used for its termination. So, in your case, it would be &emp.2019
I am not aware of its use in Reports. For sqlplus, it is described here: https://docs.oracle.com/en/database/oracle/oracle-database/20/sqpug/using-substitution-variables-sqlplus.html#GUID-DD1BE849-0B66-4F99 -83D0-F3B9F5A0D361

[Edit: Added quote of the source question (I hope I understood it)]

[Updated on: Thu, 12 November 2020 02:15]

Report message to a moderator

Re: how to pass table name in report sql [message #683496 is a reply to message #682727] Sun, 24 January 2021 13:32 Go to previous message
shahzaib_4vip@hotmail.com
Messages: 406
Registered: December 2008
Location: karachi
Senior Member
Sorry sir but i don't understand your question you need to run report without given the table name its that your question if yes then create 2 different report and used parameter.
Previous Topic: print pdf file from oracle reports
Next Topic: Arabic Report In Adobe PDF printer
Goto Forum:
  


Current Time: Mon May 17 05:51:20 CDT 2021