oralce插入返回序列问题 返回
在数据库中插入返回sequence值 db.Insertable(tPMWIREL).ExecuteReturnEntity(),偶尔会报错,提示。
2018-11-27 17:13:56,385 级别:ERROR 异常原因:ORA-08002: 序列 SEQ_TPMWIREL.CURRVAL 尚未在此会话中定义
Oracle.ManagedDataAccess.Client.OracleException (0x80004005): ORA-08002: 序列 SEQ_TPMWIREL.CURRVAL 尚未在此会话中定义
在 SqlSugar.AdoProvider.GetScalar(String sql, SugarParameter[] parameters)
在 SqlSugar.OracleInsertable`1.GetSeqValue(String seqName)
在 SqlSugar.OracleInsertable`1.ExecuteReturnIdentity()
我实体定义是
[SugarColumn(IsPrimaryKey = true, IsIdentity = true, OracleSequenceName = "SEQ_TPMWIREL")]
public long ID {get;set;}
请教如何解决,谢谢!
另外我想通过在插入前获取到nextval赋值到实体去,不知道要怎么写。。。。。、
long nextSEQ = db.Queryable<String>().Select(f => f.ID).Where("select SEQ_TPMWIREL.nextval as id from dual").First();
这么写是错误的。。。。。
热忱回答(4)
-
fate stay night VIP0
2018/11/27Db.ado.getstring(sql)可以执行sql得到你要的
0 回复 -
fate stay night VIP0
2018/11/27Ora开头的错误百度
0 回复 -
fate stay night VIP0
2018/11/27时好时不要一般是代码线程安全没注意好
0 回复 -
叩得儿 VIP0
2020/3/27楼主解决了么?
0 回复