On Mar 23, 2:37 pm, "mike.arsenault" <[email protected]> wrote:
> Hey there,
>
> I'd appreciate it if someone could offer some pointers.
>
> I'm executing the following statement from my application against an
> Oracle DB through an Oracle ODBC driver.
>
> -----------------------------------------------------------------------------------------------------
> SELECT *
> FROM (OQ.omclassrel o
> LEFT OUTER JOIN OQ.omrelationtype o2 ON o.RelType_oi=o2.rltypoi)
> WHERE
>
> (o.dmcroi <> 1000037465 OR o.dmcroi IS NULL )
>
> AND
>
> o2.rltypoi=?
> -----------------------------------------------------------------------------------------------------
>
> When I execute the above statement as shown I get no results (the
> substituted bound parameter has a value of 1). However, if I swap the
> order of the conditions following the 'WHERE' (while keeping the '?'),
> then the query works as expected and returns some results.
>
> Also, if I force the query to execute a 'hard-coded' statement by
> placing the value of '1' in place of the '?', then the results is as
> expected, regardless of the order of the criterion.
>
> So, the only problem is when the inequality criteria is before the
> criteria with the '?'.
>
> I've verified that this is a problem against Oracle - not sure about
> SQLServer, since when I generate my query against SQLServer, the order
> comes out differently.
>
> Can someone explain this?? Is there some rule that says inequalities
> cannot come before parametrized variables??
>
> Thanks
> Mike Arsenault
Have you tried this:
SELECT *
FROM (OQ.omclassrel o
LEFT OUTER JOIN OQ.omrelationtype o2 ON
o.RelType_oi=o2.rltypoi)
WHERE
nvl(o.dmcroi, 0) <> 1000037465
AND
o2.rltypoi=?
David Fitzjarrell
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Oracle PL/SQL" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/Oracle-PLSQL?hl=en
-~----------~----~----~----~------~----~------~--~---