1

Does anyone know if its possible to call an oracle's sequence.NextVal from ef4 without using StoredProcedure? I have an Oracle db from a client which I cannot modify, so stroedproc are not an option for me. I use ef4 ctp5.

Thank!

Devart
  • 119,203
  • 23
  • 166
  • 186
Breach
  • 1,288
  • 1
  • 11
  • 25

2 Answers2

1

For example, you can execute an SQL command:

  OracleParameter param = new OracleParameter("p", OracleDbType.Integer, System.Data.ParameterDirection.Output);
  oContext.Database.SqlCommand("begin SELECT sequence_name.nextval into :p FROM dual; end;", param);
  int i = (int)param.Value;

I have tested this code using dotConnect for Oracle 6.0.86, it works.

Devart
  • 119,203
  • 23
  • 166
  • 186
0

I'm not familiar with ef4 but can you execute regular queries like this?

SELECT sequence_name.nextval
FROM dual;
JOTN
  • 6,120
  • 2
  • 26
  • 31