大概6个月前,我开始在我的ASP.net web应用中使用DataSet。它是一个漂亮的工具,让我可以快速开发MVC应用程序,而不必在数据库连接/查询中做所有繁琐的工作。
但是今天我遇到了一些奇怪的问题。它从这个查询开始:
select a.MR_PART_CODE as PART_CODE,
b.PART_DESC as PART_DESC,
b.PM_MAD_CAT_CODE as CATEGORY,
c.MPC_MIN_QTY as CAT_SS,
a.MR_MAX_LEAD_TIME as LEAD_TIME,
a.MR_MAD as MAD,
ROUND((a.MR_MAD * a.MR_MAX_LEAD_TIME)) as CAL_SS,
greatest(ROUND((a.MR_MAD * a.MR_MAX_LEAD_TIME)),c.MPC_MIN_QTY) as SS,
d.SOH as SOH,
d.SOO as SOO,
(select sum(back_order) from STK_REQUEST where part_code=b.part_code) as BO,
(d.SOH+a.MR_SOO) as AVAIL,
((d.SOH + a.MR_SOO)-greatest(ROUND((a.MR_MAD * a.MR_MAX_LEAD_TIME)),c.MPC_MIN_QTY)) as ROQ,
(d.SOH - greatest(ROUND((a.MR_MAD * a.MR_MAX_LEAD_TIME)),c.MPC_MIN_QTY) ) as VAR,
a.MR_REMARKS as REMARKS
from ROQ a, PART_MASTER b, MAD_PARTS_CATEGORY c, PART_STATS d
where a.MR_PART_CODE = b.PART_CODE
and d.PART_CODE = b.PART_CODE
and b.PM_MAD_CAT_CODE = c.MPC_CAT_CODE
and b.RETIRE_FLAG = 'N'
and a.mr_year = (select max(mr_year) from roq)
and a.mr_month = (select max(mr_month) from roq where mr_year= (select max(mr_year) from roq))
and a.mr_period = (select max(mr_period) from roq where mr_month=(select max(mr_month) from roq where mr_year= (select max(mr_year) from roq)) and mr_year= (select max(mr_year) from roq))
and greatest(ROUND((a.MR_MAD * a.MR_MAX_LEAD_TIME)),c.MPC_MIN_QTY) > d.SOH`该查询在Toad for Oracle中运行良好,但当我尝试在DataAdapter对象中设置为新查询时,它显然失败了。它在下面这一行显示类似于"Error in list of function arguments: SELECT not recognized“的内容:(select sum(back_order) from STK_REQUEST where part_code=b.part_code) as BO
我做错什么了?
仅供参考,数据库为Oracle。
发布于 2011-05-23 20:55:31
这似乎是某个ASP类试图解析您的SQL时的一个例外。如果消息来自Oracle,则会出现ORA-xxxxx错误号。
你不应该把SQL像那样放在ASP中。相反,创建一个视图,也许这样就可以了。
https://stackoverflow.com/questions/6092068
复制相似问题