语法错误: 应为标识符或带引号的标识符

在使用C#执行sql的过程中,在plsql中执行没错,在程序中执行的话,就会提示”语法错误: 应为标识符或带引号的标识符”以下错误

解决办法

包含子查询的将子查询去掉用联合查询来做

例子:

1
2
3
4
5
6
7
8
--原sql为
select rownum r, t2.well_name,t2.layers,t2.top_deep,t2.bottom_deep,t2.middle_deep,t2.pressure,t2.pressure_coefficient,t2.test_date,t2.remark from (
select t1.well_name well_name,t1.layers layers,t1.top_deep top_deep,t1.bottom_deep bottom_deep,t1.middle_deep middle_deep,t1.pressure pressure,t1.pressure_coefficient pressure_coefficient,t1.test_date test_date,t1.remark remark
from cd_pressure_coefficient t1 where t1.doc_id='{0}' order by test_date ) t2
--改为

select t1.well_name well_name,t1.layers layers,t1.top_deep top_deep,t1.bottom_deep bottom_deep,t1.middle_deep middle_deep,t1.pressure pressure,t1.pressure_coefficient pressure_coefficient,t1.test_date test_date,t1.remark remark
from cd_pressure_coefficient t1 left join dual t1 where t1.doc_id='{0}' order by test_date