Reputation: 428
Good day. I create some repository for objects and try to update same object. I used 'ExecuteStoreCommand' and next method
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));
}
And there accrue next exception:
"ORA-00933: SQL command not properly ended"
P.S. Parameters of the called method is not zero(not null and not object in not empty).
Upvotes: 1
Views: 183
Reputation: 1
Additional the semicolon (;) at the end of the statement is incorrect. Even in a "execute immediate" command you have not to use the semicolon.
Upvotes: 0
Reputation: 2182
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.
Upvotes: 1