P.J. Hughes
asked on
Oracle ODBC SQL Command not properly ended - Visual Studio
I am trying to retrieve data from an Oracle 10g database into a simple Visual Studio project. The sql statement (see below) is very simple and works fine when I run it in SQL Server Management Studio; however, when I try to execute the statement in Visual Studio I get the following error:
ERROR [HY000] [Oracle][ODBC][Ora]ORA-009 33: SQL command not properly ended
As I said, this same command executes with no errors in SQL Server Management Studio.
Any ideas???
select Case
when UserName = '2085' then 'Hazel'
when UserName = '2088' then 'Tracie'
end
as UserName,
mbrsep, name, transdate, cafield, oldval, newval
from openquery(SEDCCA, '
select anntrandetl.mbrsep, name, transdate, cafield, oldval, newval, oper as UserName
from anntrandetl inner join mbrsepmstr on anntrandetl.mbrsep = mbrsepmstr.mbrsep
')
where transdate >= '090719' and cafield = 'MAILCODE' AND (UserName = '2085' or UserName = '2088')
ERROR [HY000] [Oracle][ODBC][Ora]ORA-009
As I said, this same command executes with no errors in SQL Server Management Studio.
Any ideas???
select Case
when UserName = '2085' then 'Hazel'
when UserName = '2088' then 'Tracie'
end
as UserName,
mbrsep, name, transdate, cafield, oldval, newval
from openquery(SEDCCA, '
select anntrandetl.mbrsep, name, transdate, cafield, oldval, newval, oper as UserName
from anntrandetl inner join mbrsepmstr on anntrandetl.mbrsep = mbrsepmstr.mbrsep
')
where transdate >= '090719' and cafield = 'MAILCODE' AND (UserName = '2085' or UserName = '2088')
ASKER
I have removed the blank lines and tried the semi colon. Neither worked.
I have used this same approach before in Visual Studio and have referred back to some of those previous queries but cannot figure out what the problem is.
I have used this same approach before in Visual Studio and have referred back to some of those previous queries but cannot figure out what the problem is.
This will be my last guess since I don't have the setup to test anything.
Do any of the previous queries use CASE? I wonder if the ODBC driver recognizes it.
Do any of the previous queries use CASE? I wonder if the ODBC driver recognizes it.
ASKER
I thought about that too. I removed the CASE statement and the results were the same. I made the statement as simple as I could make it and still get the error. I'm sure it's a simple solution, but for the life of me I can't find it.
Thanks anyway.
Thanks anyway.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Try removing all blank lines (might be a posting error) and/or try a semi colon at the end. Some products like the ';', others do not.