--oracle添加主键自增长步骤
 
--第一步
CREATE SEQUENCE seq_表名称
 
INCREMENT BY 1 -- 每次加几个
START WITH 1 -- 从1开始计数
 
NOMAXVALUE -- 不设置最大值
NOCYCLE -- 一直累加,不循环
NOCACHE -- 不建缓冲区
 
--第二步
CREATE TRIGGER "tiger_表名称" BEFORE
INSERT ON 表名称 FOR EACH ROW WHEN (new.自增字段 is null)
begin
select seq_表名称.nextval into:new.自增字段 from dual;
end;
 
--第三步
commit;
string sql = "insert into table (name) values ('name') RETURNING id INTO :NEW_SEQ_ID";
var plist = paras.ToDynamicParameters();
plist.Add("NEW_SEQ_ID", dbType: DbType.Decimal, direction: ParameterDirection.Output);
int result;

using (var db = DapperDataAccess.BuildConnection())
{
    db.Execute(sql, plist);
    result = plist.Get<int>("NEW_SEQ_ID");
}

return result;

 

posted @ 2018-04-09 13:48 ChobitsSP 阅读(243) 评论(0) 推荐(0) 编辑
摘要: http://stackoverflow.com/questions/4611549/recursion-with-func http://stackoverflow.com/questions/1208703/can-an-anonymous-method-in-c-sharp-call-itse 阅读全文
posted @ 2018-04-09 13:46 ChobitsSP 阅读(140) 评论(0) 推荐(0) 编辑
摘要: public T CreateDefault() { T item = new T(); foreach (var p in typeof(T).GetProperties()) { Type colType = p.PropertyType; if (colType == typeof(Nullable)) { ... 阅读全文
posted @ 2018-04-09 13:45 ChobitsSP 阅读(202) 评论(0) 推荐(0) 编辑
摘要: http://msdn.microsoft.com/zh-cn/library/system.environment.currentmanagedthreadid.aspx http://stackoverflow.com/questions/15569664/system-missingmetho 阅读全文
posted @ 2018-04-09 13:44 ChobitsSP 阅读(407) 评论(0) 推荐(0) 编辑
摘要: 'use strict'; function InitRedisStrategy(agent, name, channel) { class RedisStrategy extends agent.ScheduleStrategy { start() { // 订阅其他的分布式调度服务发送的消息,收到消息后让一个进程执行定时任务 agent.redis.on... 阅读全文
posted @ 2018-04-09 13:39 ChobitsSP 阅读(621) 评论(0) 推荐(0) 编辑
摘要: submit protected {{ item.type }} _{{ item.name }}; public {{ item.type }} {{ item.name }} { ... 阅读全文
posted @ 2017-08-30 11:25 ChobitsSP 阅读(310) 评论(0) 推荐(0) 编辑
摘要: using System;using System.Collections.Generic;using System.Linq;namespace System.Linq.Expressions{ public static class ExpressionExtensions { ... 阅读全文
posted @ 2014-10-08 09:59 ChobitsSP 阅读(979) 评论(0) 推荐(1) 编辑
摘要: http://tieba.baidu.com/f/search/res?ie=utf-8&kw=&qw=Trait%3A%20Nature&un=&sm=1&rn=100&pn=1(?)[^Trait:.*?Nature[^(?:-[^){1,4}new Regex("(?)[^Trait:.*?N... 阅读全文
posted @ 2014-05-25 22:55 ChobitsSP 阅读(228) 评论(0) 推荐(0) 编辑
摘要: using System;using System.Linq;namespace System.Collections.Generic{ public static class LinqExtensions { public static void ForEach(this... 阅读全文
posted @ 2014-05-21 15:29 ChobitsSP 阅读(865) 评论(0) 推荐(0) 编辑
摘要: using System;using System.Collections.Generic;using System.IO;using System.Text;using System.Web;namespace BuaaOnlineJudge{ public static class CsvWriter { #region Constants private const char DefaultDelimiter = ','; private const char DefaultQuote = '"'; private co... 阅读全文
posted @ 2014-03-27 15:28 ChobitsSP 阅读(433) 评论(0) 推荐(0) 编辑
点击右上角即可分享
微信分享提示