Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query result help

Status
Not open for further replies.

dbsql

IS-IT--Management
Mar 29, 2007
19
US
Hi i am trying to query oracle from SSRS and so far successful but when i try to do this:

select testname, testid
from test
where testname like '%'+upper(?) +'%'

then get error saying that invalid number i know i could do something like that in SQL but having trouble in oracle!

i am doing that so in parameter user don't have to put % !!

thanks


Thanks!!
 

Try this:

...like UPPER('%scott%')

[3eyes]


----------------------------------------------------------------------------
The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb
 
DBSQL,

I am not familiar with SRSS (is that an FLA?), so I am not familiar with how that environment resolves requests for user-supplied value entries (which I presume you are requesting with the "?" entry.

Therefore, I'll show you have to resolve your problem using SQL*Plus (to which you should have access if you are running Oracle), and which you can then extrapolate to the SRSS environment.

Following is a script which I have named, "tt_419.sql":
Code:
set verify off
accept tname prompt "Enter (part of) the name of a test to display: "
select testname, testid
from test
where upper(testname) like '%'||upper('&tname')||'%';
Notice that we concatenate in Oracle by using the "||" operator. Also note that the SQL*Plus string-replacement symbol is "&".

Following are the invocation and the results of invoking "tt_419.sql" from SQL*Plus:
Code:
SQL>  @tt_419
Enter (part of) the name of a test to display: test

TESTNAME                 TESTID
-------------------- ----------
This is test 1.               1
Let us know if this leads to a resolution to your problem.

[santa]Mufasa
(aka Dave of Sandy, Utah, USA)
[I provide low-cost, remote Database Administration services: www.dasages.com]
 
And, yes, LKBrwnDBA's suggestions further simplifies the code:
Code:
...where upper(testname) like upper('%&tname%');

[santa]Mufasa
(aka Dave of Sandy, Utah, USA)
[I provide low-cost, remote Database Administration services: www.dasages.com]
 
dbsql,

I am guessing here, but do you come from a sql server background? I believe that the '+' symbol is used for string concatenation in sql server, but for future reference, you should be aware that the Oracle equivalent is a double pipe '||'.

Regards

Tharg

Grinding away at things Oracular
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top