我试着运行以下命令:
select *
from tax.tax_payer@reis tp
left outer join re_right@reis r on (tp.tin = r.tin or tp.tin = r.tin_a1 or tp.tin = r.tin_a2)
where (r.right_status = -1 or r.right_status is null)
--and r.right_id is not null
and tp.je_id = 12;但不断得到
ORA-00933: SQL命令未正确结束。
如果我删除评论,它可以正常工作,但为什么呢?
发布于 2011-03-23 19:00:07
上面的代码在SQL*Plus中工作得很好,在远程数据库连接中有合适的定义。在实际的执行环境中,一定有一些令人困惑的软件。
尝试使用“内联注释”形式,而不是“行注释的末尾”。从文体上讲,在SQL语句的末尾不需要";“,除非您的执行环境需要它们,或者您正在提交一个多行的过程代码块(实际上并非如此)。
select *
from tax.tax_payer@reis tp
left outer join
re_right@reis r
on ( tp.tin = r.tin
or tp.tin = r.tin_a1
or tp.tin = r.tin_a2
)
where ( r.right_status = -1
or r.right_status is null
)
and tp.je_id = 12
/* and r.right_id is not null */另外,您可能希望将所有的计算移到远程数据库中,而不是将数据拉过电线并在更本地的数据库上进行连接。( Oracle的一些最新版本将为您完成此优化。)
发布于 2011-03-23 19:48:37
在.NET中,您不能在查询中使用尾随分号--它会破坏查询。
https://stackoverflow.com/questions/5409986
复制相似问题