How to write a query in SSRS which will get the data from ORACLE when both Table & Column are parameters
Hello,
This is Keshava. I have a requirement in my report which will have 2 parameters.
One Dropdown contains List of tables in a DB, Other one is depends on first and when select a table from the 1st Dropdown we can see the list of columns that are exists in the selected table.
We need to connect to the ORACLE database.
HERE both tabe and column are dynamically passed.
in this case how to write an statement and execute.
For your understanding:
In SQL i did by using EXECUTE ('SELECT' + @Col + 'FROM ' + @Table)
this works when i connect to SQL DB.
the problem is with ORCALE
i tried like EXECUTE IMEEDIDATE ('SELECT' || :Col || 'FROM ' || :Table ||)
but its giving an error in SSRS 'Invalid SQL Statement'
Hope you understand the problem
Can any one help me out!
Thanks
Keshava
Manohar.K
June 27th, 2012 4:06am
Hi,
To Execute Oracle query within SQL you need to create a linked server
see below links
http://www.sqlmag.com/article/sql-server/setting-up-an-oracle-linked-server49687
http://msdn.microsoft.com/en-us/library/aa213778(v=sql.80).aspx
Hope this will help you !!!
Sanjeewan
Free Windows Admin Tool Kit Click here and download it now
June 27th, 2012 5:06am
Hi Sanjeewan,
i tried with Linked server. but i am getting the following error
OLE DB provider "OraOLEDB.Oracle" for linked server "ORACLELINKEDSERVER" returned message "ORA-28000: the account is locked".
Any Idea? do we need to confugre some more settings.?
Manohar.K
June 27th, 2012 6:33am
Hi,
Not sure how error is coming . this link may be helpfull to you
https://blogs.oracle.com/rajeshthekkadath/entry/resolving_oracle_error_ora_28000
Hope this will help you !!!
Sanjeewan
Free Windows Admin Tool Kit Click here and download it now
June 27th, 2012 7:13am