当前位置:   article > 正文

oracle设置自增ID_oracle 设置自增id

oracle 设置自增id

CREATE SEQUENCE 序列名
START WITH 1
INCREMENT BY 1
MINVALUE 1
ORDER
NOCYCLE;

//CREATE SEQUENCE “QMS”.“Untitled” MINVALUE 1 INCREMENT BY 1 START WITH 1 ORDER NOCACHE
创建触发器
create or replace trigger 触发器
before insert on “表名” for each row
begin
select 序列表名.nextval into :new.“自增的字段” from dual;
end;

//oracle 联合查询示例
select T1.ID,t1.EQUIP_NO,T1.EQUIP_NAME,T1.EQUIP_TYPE,t1.CLASSES,T1.FACTORY,T1.FACTORY_GROUP,T1.LINE,T1.PROCESS_NAME,T1.PROVIDER,T1.EQUIP_IP,T1.SERVER_IP,T1.CREATE_DATE,T1.UPDATE_DATE,T1.MES_EQUIP_TYPE,ET.ID
from(select rownum no, a.* from EQUIPMENT_INFO a WHERE 1 = 1 ) T1
left JOIN EQUIP_TYPE_INFO ET ON ET.SCADA_EQUIP_TYPE = T1.MES_EQUIP_TYPE
where no between 1 and 10 order by T1.ID desc

//PL/SQL语法
DECLARE
V_LANG CLOB := ‘待插入的海量字符串’;

   V_UPDATE CLOB := '待更新的海量字符串';
  • 1

BEGIN

–UPDATE EQUIP_TEST t SET t.IMAGE2 = V_UPDATE WHERE ID = 2; --修改

insert into EQUIP_TEST t (t.ID,t.IMAGE2)VALUES(3,V_UPDATE);

COMMIT;

END;
/

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/羊村懒王/article/detail/626588
推荐阅读
相关标签
  

闽ICP备14008679号