1

再会。我为对象创建了一些存储库并尝试更新相同的对象。我使用了“ExecuteStoreCommand”和下一个方法

public void UpdatePatienAccount(long modelId, long patientId, long accountId)
{
//ExecuteStoreCommand(@"UPDATE PATIENT_ACCOUNT SET PATIENT_ID = :1 AND ACCOUNT_ID = :2 WHERE ID == :3", patientId, accountId, modelId);
ExecuteStoreCommand(String.Format("UPDATE PATIENT_ACCOUNT SET PATIENT_ID = {0} AND ACCOUNT_ID = {1} WHERE ID = {2};", patientId, accountId, modelId));            
}

并产生下一个异常:

"ORA-00933: SQL command not properly ended"

PS 被调用方法的参数不为零(不为空且不为非空的对象)。

4

2 回答 2

1
CREATE TABLE PATIENT_ACCOUNT
(
    ID         NUMBER
,   PATIENT_ID NUMBER
,   ACCOUNT_ID NUMBER
);

INSERT INTO PATIENT_ACCOUNT VALUES(1, 11, 22);

UPDATE  PATIENT_ACCOUNT
SET     PATIENT_ID = 1
AND     ACCOUNT_ID = 2
WHERE   ID = 3;
-- ORA-00933: SQL command not properly ended

UPDATE  PATIENT_ACCOUNT
SET     PATIENT_ID = 33
,       ACCOUNT_ID = 44
WHERE   ID = 1;
-- 1 rows updated.
于 2013-06-19T08:13:11.827 回答
0

另外,语句末尾的分号 (;) 不正确。即使在“立即执行”命令中,您也不必使用分号。

于 2013-06-19T08:36:07.700 回答