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!

SSRS 2008 Oracle LIKE with parameter - invalid number error 1

Status
Not open for further replies.

SSRS4Evr

Programmer
Sep 26, 2011
2
US
Good day everyone,

I am working with SSRS 2008 with an Oracle datasource -

Need to give the report parameter for the OrgSequenceNumber ... but they only need to be able to give the first couple numbers ...in other words they want a "starts with" parameter. I know this is LIKE @Parameter + '%' -- but I keep getting an "invalid number" error from the datasource. Any idea what I'm doing wrong?

THIS WORKS--
Code:
SELECT     DESCRIPTION, DAILY_INJ_DATE, METERED_VOL, INJ_TUBING_PRESS, INJ_FLUID_TYPE, SHORT_ORGSEQNO
from         ODSVIEWS.ODSV_MONTHLY_INJ_REPORT 
WHERE (SHORT_ORGSEQNO LIKE '16%')

But this DOES NOT...
Code:
SELECT     DESCRIPTION, DAILY_INJ_DATE, METERED_VOL, INJ_TUBING_PRESS, INJ_FLUID_TYPE, SHORT_ORGSEQNO
from         ODSVIEWS.ODSV_MONTHLY_INJ_REPORT 
WHERE (SHORT_ORGSEQNO LIKE :OrgSeqNo + '%')
When prompted I enter 16 as the parameter value and then I get the "ORA-01722:Invalid Number" error

I even tried...
Code:
SELECT     DESCRIPTION, DAILY_INJ_DATE, METERED_VOL, INJ_TUBING_PRESS, INJ_FLUID_TYPE, SHORT_ORGSEQNO
from         ODSVIEWS.ODSV_MONTHLY_INJ_REPORT 
WHERE (SHORT_ORGSEQNO LIKE TO_CHAR(:OrgSeqNo)+'%')

The SHORT_ORGSEQNO field is a varchar(8) so there should be no need for the TO_CHAR, but I thought I'd try anything to get it working. I am missing something though -- anyone got any ideas?

Thanks in advance for any help!! :)
Sincerely
Brenda L.
 
select * from mytable where name like '%' + @myparam + '%'

or in case of oracle i think use this

select * from mytable where name like '%' + :myparam + '%'

i'm not sure this is what you are looking for
 
oops forgot Oracle does not use the + to concatenate

select * from mytable where name like '%' || :myparam || '%'
 
You! ...are a genius! That was it exactly!

I now remember having to concatenate with ORACLE with the || ("pipes") once before, but it had not occured to me this time. Thank you very much!!

Sincerely,
Brenda L.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top