I'm trying to return the nextval from an oracle sequence and save the value into a variable, I´m not expert using Oracle with C# until now I have the connection done and I've used some Oracle packages with c#.
I know that I can use the [sequence_name].nextval into the insert query but for bussiness logic I need the same sequence number for many records and the idea is store the nextval into a variable and pass it like parameter to another c# function that will gonna be the responsible to insert the "n" records into the table.
Any hint or code example gonna be helpful, thanks a lot for the help.
You can get nextval with an OracleCommand
OracleCommand loCmd = Connection.CreateCommand();
loCmd.CommandType = CommandType.Text;
loCmd.CommandText = "select seqname.nextval from dual";
long lnNextVal = Convert.ToInt64(loCmd.ExecuteScalar());
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With