I am relatively unfamiliar with Oracles flavor of SQL. I cannot figure out why this is returning the following exception:
Oracle.ManagedDataAccess.Client.OracleException (0x80004005): ORA-01008: not all variables bound
OracleCommand cmd1 = con.CreateCommand();
cmd1.CommandType = CommandType.Text;
cmd1.CommandText = @"MERGE INTO SECURITY_PRICES$V tgt USING (select * from DUAL) src ON (src.DTE = tgt.DTE AND src.SECURITY = tgt.SECURITY AND src.SOURCE = tgt.SOURCE) WHEN MATCHED THEN UPDATE SET tgt.TYPE = 'I', tgt.SOURCE = src.Source, tgt.CURRENCY = 'JMD' ,tgt.SECURITY = src.Security, tgt.LAST_PRICE = :Close, tgt.HIGH_PRICE = :High, tgt.LOW_PRICE = :Low, tgt.DTE = src.DTE, tgt.Volume = :Vol WHEN NOT MATCHED THEN INSERT (TYPE, SOURCE, CURRENCY, SECURITY, LAST_PRICE, HIGH_PRICE, LOW_PRICE, DTE, Volume) VALUES ('I', 'E', 'JMD', :insID,:Close,:High, :Low, :Time, :Vol)";
cmd1.Parameters.Add("insID", secid);
cmd1.Parameters.Add("Close", data.Close);
cmd1.Parameters.Add("High", data.High);
cmd1.Parameters.Add("Low", data.Low);
cmd1.Parameters.Add("Time", data.Time);
cmd1.Parameters.Add("Vol", data.Volume);
int suc = cmd1.ExecuteNonQuery();
I have tried the following. Adding the colon (':') to parameters.add. Using less variables, ensured that it was not passing in null parameters.
Here is the data. It gets parsed into an object, each property is a string. Does oracle require strongly typed parameters? Passing in a string in MS SQL Server, would not cause an issue - that is my only guess though.
- insID: 228IL
- Low: 0
- High 0
- Time: 2018-01-29T13:05:26
- Vol: 0
- Close:0