Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 SQL error?

Author  Topic 

raysefo
Constraint Violating Yak Guru

260 Posts

Posted - 2007-01-29 : 09:17:40
Hi,

I have a select statement below which gives "AbtError: rc=-1 for '42610' in
an AbtIbmCliCSDatabaseConnection at (29.01.2007 15:43:13)
'[SQLSTATE=42610 - [IBM][CLI Driver][DB2/NT] SQL0418N A statement contains
a use of a parameter marker that is not valid. SQLSTATE=42610 [Native
Error=-418]]" error when i put it into multirow query. I guess its beacause
of variables beside the CASE expressions(:sonuc). How can i fix this?

select
sf.tldno,op.personelref,k.eskikod,p.siralama,o.adi,o.soyadi,s.deep,s.eye,s.shallow,s.notron,s.beta,s.gama,s.yorum,s.sonuc,k.calismaalani,k.aktifmi
from
(dzmt.sonuc s
LEFT OUTER JOIN dzmt.dagitim d ON s.dagitimid = d.id
LEFT OUTER JOIN dzmt.sifirlama sf ON s.sifirlamaid = sf.id)
,dzmt.priyotlar p,rsgd.org_personelbilgileri o,dzmt.donemsayac
ds,dzmt.kurumdetay k,rsgd.org_personelindex op
where
d.periyodid = p.id and
p.yil = :yil and
d.personelid = o.id and
sf.donemsayacid = ds.id and
k.id = ds.kurumkod and
op.personelref = o.id and
((s.sonuc = (CASE :sonuc
when 'E' then 'E'
when 'GELMEYEN' then 'A'
END)) or ((s.deep between (
CASE :sonuc
when 'MDL-0.99' then 0.1
when '1.0-4.9' then 1
when '5.0-9.9' then 5.0
when '10.0-14.9' then 10.0
when '15.0-19.9' then 15.0
when '20.0-29.9' then 20.0
when '>30.0' then 30
when 'MDL' then 0
END) and (CASE :sonuc
when 'MDL-0.99' then 1
when '1.0-4.9' then 4.9
when '5.0-9.9' then 9.9
when '10.0-14.9' then 14.9
when '15.0-19.9' then 19.9
when '20.0-29.9' then 29.9
when '>30.0' then 1000
when 'MDL' then 0.1
END))))

Kristen
Test

22859 Posts

Posted - 2007-01-29 : 09:34:10
If this is SQL Server, rather than DB2, then there is no colon in a CASE statement

Change:

CASE :sonuc when 'E' then 'E' when 'GELMEYEN' then 'A' END

to

CASE sonuc when 'E' then 'E' when 'GELMEYEN' then 'A' END

Kristen
Go to Top of Page

raysefo
Constraint Violating Yak Guru

260 Posts

Posted - 2007-01-29 : 09:44:36
But those are variables that i sent data dynamically to them.
Go to Top of Page

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2007-01-29 : 09:46:27
Use @ instead of : as a prefix (unless you are using embedded Sql with C)

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2007-01-29 : 09:48:11
OK, so:

:sonuc

is a variable, rather than a Column in one of the tables in a query?

In SQL Server you use variables with this style syntax:

@sonuc

If this is NOT specifically for SQL Server then all bets are off I'm afraid as this is a SQL Server (only) forum / site.

Kristen
Go to Top of Page
   

- Advertisement -