Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/67.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
sql中出错:sql命令未正确结束_Sql_Oracle - Fatal编程技术网

sql中出错:sql命令未正确结束

sql中出错:sql命令未正确结束,sql,oracle,Sql,Oracle,当我从VisualStudio执行此查询时,会出现错误“sql命令未正确结束”,但当我从plsql执行此查询时,它可以正常工作,没有错误。 查询是: select animal_type_id, animal_type_name, animal_name from animal natural join animal_type where animal_type_id not in (select animal_type_id from animal where animal.reciev

当我从VisualStudio执行此查询时,会出现错误“sql命令未正确结束”,但当我从plsql执行此查询时,它可以正常工作,没有错误。 查询是:

select animal_type_id, animal_type_name, animal_name
from animal natural join animal_type
where animal_type_id not in (select animal_type_id from animal
   where animal.recieving_date>(sysdate-365))
我能做什么?
谢谢

似乎Visual Studio弄乱了您的SQL,这不是一个与ORACLE相关的问题

尝试运行语句
从animal where animal.receiving_date>(sysdate-365)
选择animal_type_id,然后查看该语句是否正常工作。然后运行
select animal\u type\u id,animal\u type\u name,animal\u name from animal natural join animal\u type where animal\u type\u id not in
-语句,使用固定数量的animal\u type\u id


只是为了确保:您确实用
结束了SQL语句?不知道Visual Studio是否需要它,最好检查一下

您使用哪种DBMS?Visual Studio不是数据库服务器。您正在尝试使用哪个数据库?SQL Server中不支持自然联接。这是有关此错误的Oracle文档:在Visual Studio内的联接中尝试不使用
NATURAL
的SQL。当您说Visual Studio时,您的意思是什么?您是否正在执行一些C#代码中的SQL?您正在使用ODP.NET吗?如果是,请张贴相关代码。