我有一个关于我正在处理的更新查询的奇怪问题。看看:
UPDATE DW.SLS_SLS_SCHEDE_SDS P1
SET
P1.RECORD_INSERITO_AGGIORNATO = 'A',
P1.DATA_ELABORAZIONE = (SELECT DATA_INS_AGG_SDS
FROM DWH.SUMIGLOBAL P2
WHERE SUBSTR(P2.CODICE_PRODOTTO,1,6)= P1.COD_PRODOTTO
AND P2.DATA_INS_AGG_SDS>'20160400'
AND (TO_NUMBER(TO_DATE(P1.DATA_ELABORAZIONE, 'YYYY/MM/DD') -
TO_DATE(P2.DATA_INS_AGG_SDS,'YYYY/MM/DD')))>0
AND (TO_NUMBER(TO_DATE(P1.DATA_ELABORAZIONE, 'YYYY/MM/DD') -
TO_DATE(P2.DATA_INS_AGG_SDS,'YYYY/MM/DD')))<366)
WHERE EXISTS
(SELECT *
FROM DWH.SUMIGLOBAL P2
WHERE SUBSTR(P2.CODICE_PRODOTTO,1,6)= P1.COD_PRODOTTO
AND P2.DATA_INS_AGG_SDS>'20160400'
AND (TO_NUMBER(TO_DATE(P1.DATA_ELABORAZIONE, 'YYYY/MM/DD') -
TO_DATE(P2.DATA_INS_AGG_SDS,'YYYY/MM/DD')))>0
AND (TO_NUMBER(TO_DATE(P1.DATA_ELABORAZIONE, 'YYYY/MM/DD') -
TO_DATE(P2.DATA_INS_AGG_SDS,'YYYY/MM/DD')))<366);
首先我正在使用Visual Studio 2015
我也使用toad for oracle 12.8
,其中我在数据库中有一些记录。当我在蟾蜍中执行查询时,它的工作原理完全正常。
因为我需要从VS运行查询,我已将VS链接到oracle并执行查询,因此我收到以下错误
{&#34; ORA-00971:缺少SET关键字&#34;}。
此错误来自VS.我确信问题与我写的代码无关。
C#代码
using (var dbContextTransaction = con.BeginTransaction())
{
const string selectCommandTextPianoAcq = "same query as before"
var cmd = new OracleCommand
{
Connection = con,
CommandText = selectCommandTextPianoAcq,
CommandTimeout = 15,
Transaction = dbContextTransaction
};
var reader = cmd.ExecuteReader();
}
知道为什么会这样吗?