首页 > 代码库 > 存储过程
存储过程
create or replace PROCEDURE "UPDATE_TRAIN_CARRIAGE" ( carriage_1_ IN NUMBER, carriage_2_ IN NUMBER, carriage_3_ IN NUMBER, carriage_4_ IN NUMBER, carriage_5_ IN NUMBER, carriage_6_ IN NUMBER, carriage_7_ IN NUMBER, carriage_8_ IN NUMBER, carriage_9_ IN NUMBER, carriage_10_ IN NUMBER, carriage_11_ IN NUMBER, carriage_12_ IN NUMBER, carriage_13_ IN NUMBER, carriage_14_ IN NUMBER, carriage_15_ IN NUMBER, carriage_16_ IN NUMBER, carriage_17_ IN NUMBER, carriage_18_ IN NUMBER, carriage_19_ IN NUMBER, carriage_20_ IN NUMBER, carriage_21_ IN NUMBER, carriage_22_ IN NUMBER, carriage_23_ IN NUMBER, carriage_24_ IN NUMBER, carriage_25_ IN NUMBER, carriage_26_ IN NUMBER, carriage_27_ IN NUMBER, carriage_28_ IN NUMBER, carriage_29_ IN NUMBER, carriage_30_ IN NUMBER, carriage_31_ IN NUMBER, carriage_32_ IN NUMBER, carriage_33_ IN NUMBER, carriage_34_ IN NUMBER, carriage_35_ IN NUMBER, carriage_36_ IN NUMBER, carriage_37_ IN NUMBER, carriage_38_ IN NUMBER, carriage_39_ IN NUMBER, carriage_40_ IN NUMBER, carriage_41_ IN NUMBER, carriage_42_ IN NUMBER, carriage_43_ IN NUMBER, carriage_44_ IN NUMBER, carriage_45_ IN NUMBER, carriage_46_ IN NUMBER, carriage_47_ IN NUMBER, carriage_48_ IN NUMBER, carriage_49_ IN NUMBER, carriage_50_ IN NUMBER, carriage_51_ IN NUMBER, carriage_52_ IN NUMBER, carriage_53_ IN NUMBER, carriage_54_ IN NUMBER, carriage_55_ IN NUMBER, carriage_56_ IN NUMBER, carriage_57_ IN NUMBER, carriage_58_ IN NUMBER, carriage_59_ IN NUMBER, carriage_60_ IN NUMBER, carriage_61_ IN NUMBER, carriage_62_ IN NUMBER, carriage_63_ IN NUMBER, carriage_64_ IN NUMBER, carriage_65_ IN NUMBER, carriage_66_ IN NUMBER, carriage_67_ IN NUMBER, carriage_68_ IN NUMBER, carriage_69_ IN NUMBER, carriage_70_ IN NUMBER, carriage_71_ IN NUMBER, carriage_72_ IN NUMBER, carriage_73_ IN NUMBER, carriage_74_ IN NUMBER, carriage_75_ IN NUMBER, carriage_76_ IN NUMBER, carriage_77_ IN NUMBER, carriage_78_ IN NUMBER, carriage_79_ IN NUMBER, carriage_80_ IN NUMBER, carriage_81_ IN NUMBER, carriage_82_ IN NUMBER, carriage_83_ IN NUMBER, carriage_84_ IN NUMBER, carriage_85_ IN NUMBER, carriage_86_ IN NUMBER, carriage_87_ IN NUMBER, carriage_88_ IN NUMBER, carriage_89_ IN NUMBER, carriage_90_ IN NUMBER, carriage_91_ IN NUMBER, carriage_92_ IN NUMBER, carriage_93_ IN NUMBER, carriage_94_ IN NUMBER, carriage_95_ IN NUMBER, carriage_96_ IN NUMBER, carriage_97_ IN NUMBER, carriage_98_ IN NUMBER, carriage_99_ IN NUMBER, carriage_100_ IN NUMBER) IS BEGIN DECLARE start_id NUMBER; BEGIN select max(id) into start_id from hhc_plc_train_start; update hhc_plc_train_carriage set carriage_1=carriage_1_, carriage_2=carriage_2_, carriage_3=carriage_3_, carriage_4=carriage_4_, carriage_5=carriage_5_, carriage_6=carriage_6_, carriage_7=carriage_7_, carriage_8=carriage_8_, carriage_9=carriage_9_, carriage_10=carriage_10_, carriage_11=carriage_11_, carriage_12=carriage_12_, carriage_13=carriage_13_, carriage_14=carriage_14_, carriage_15=carriage_15_, carriage_16=carriage_16_, carriage_17=carriage_17_, carriage_18=carriage_18_, carriage_19=carriage_19_, carriage_20=carriage_20_, carriage_21=carriage_21_, carriage_22=carriage_22_, carriage_23=carriage_23_, carriage_24=carriage_24_, carriage_25=carriage_25_, carriage_26=carriage_26_, carriage_27=carriage_27_, carriage_28=carriage_28_, carriage_29=carriage_29_, carriage_30=carriage_30_, carriage_31=carriage_31_, carriage_32=carriage_32_, carriage_33=carriage_33_, carriage_34=carriage_34_, carriage_35=carriage_35_, carriage_36=carriage_36_, carriage_37=carriage_37_, carriage_38=carriage_38_, carriage_39=carriage_39_, carriage_40=carriage_40_, carriage_41=carriage_41_, carriage_42=carriage_42_, carriage_43=carriage_43_, carriage_44=carriage_44_, carriage_45=carriage_45_, carriage_46=carriage_46_, carriage_47=carriage_47_, carriage_48=carriage_48_, carriage_49=carriage_49_, carriage_50=carriage_50_, carriage_51=carriage_51_, carriage_52=carriage_52_, carriage_53=carriage_53_, carriage_54=carriage_54_, carriage_55=carriage_55_, carriage_56=carriage_56_, carriage_57=carriage_57_, carriage_58=carriage_58_, carriage_59=carriage_59_, carriage_60=carriage_60_, carriage_61=carriage_61_, carriage_62=carriage_62_, carriage_63=carriage_63_, carriage_64=carriage_64_, carriage_65=carriage_65_, carriage_66=carriage_66_, carriage_67=carriage_67_, carriage_68=carriage_68_, carriage_69=carriage_69_, carriage_70=carriage_70_, carriage_71=carriage_71_, carriage_72=carriage_72_, carriage_73=carriage_73_, carriage_74=carriage_74_, carriage_75=carriage_75_, carriage_76=carriage_76_, carriage_77=carriage_77_, carriage_78=carriage_78_, carriage_79=carriage_79_, carriage_80=carriage_80_, carriage_81=carriage_81_, carriage_82=carriage_82_, carriage_83=carriage_83_, carriage_84=carriage_84_, carriage_85=carriage_85_, carriage_86=carriage_86_, carriage_87=carriage_87_, carriage_88=carriage_88_, carriage_89=carriage_89_, carriage_90=carriage_90_, carriage_91=carriage_91_, carriage_92=carriage_92_, carriage_93=carriage_93_, carriage_94=carriage_94_, carriage_95=carriage_95_, carriage_96=carriage_96_, carriage_97=carriage_97_, carriage_98=carriage_98_, carriage_99=carriage_99_, carriage_100=carriage_100_ where fk_start_id=start_id and insert_state=1; END; END;
create or replace PROCEDURE "PRO_SU_STOP" /* 记录处理卸船机停时 ttype:(3,故障:对应调度系统停时的设备类型 5,待机:对应调度系统停时的待机类型) STATE:(状态由0变1时新增记录 1变0时更新) */ ( SU_ID NUMBER, STATE NUMBER, TTYPE VARCHAR2) IS FK_SO_BOAT_NOTE_ID NUMBER(15); BERTH NUMBER(15); FK_CLASS_TYPE_ID NUMBER(15); IS_DAY NUMBER(15); BEGIN IF STATE=1 THEN SELECT T.FK_SO_BOAT_NOTE_ID,F.BERTH INTO FK_SO_BOAT_NOTE_ID,BERTH FROM (SELECT * FROM UNLOAD_BOAT_FLOW_DATA T WHERE T.UNLOAD_BOAT_ID=SU_ID ORDER BY T.PERBKTIME DESC ) T LEFT JOIN SO_BOAT_NOTE N ON N.ID=T.FK_SO_BOAT_NOTE_ID LEFT JOIN SO_BOAT_FORE F ON F.ID=N.FK_BOAT_FORE_ID WHERE ROWNUM=1; SELECT T.FK_CLASS_TYPE_ID,T.IS_DAY INTO FK_CLASS_TYPE_ID,IS_DAY FROM PMIS_ATTCHIEF_LOG T WHERE SYSDATE BETWEEN T.BEGIN_TIME AND T.END_TIME AND ROWNUM=1; INSERT INTO PMIS_MACHINE_STOP_LOG (PMIS_MACHINE_STOP_LOG.EAM_ID, PMIS_MACHINE_STOP_LOG.END_TIME, PMIS_MACHINE_STOP_LOG.TYPE, PMIS_MACHINE_STOP_LOG.SYS_TYPE, PMIS_MACHINE_STOP_LOG.FK_SO_BOAT_NOTE_ID, PMIS_MACHINE_STOP_LOG.BERTH, PMIS_MACHINE_STOP_LOG.FK_CLASS_TYPE_ID, PMIS_MACHINE_STOP_LOG.IS_DAY, PMIS_MACHINE_STOP_LOG.CAUSE) VALUES (SU_ID, SYSDATE, TTYPE,1,FK_SO_BOAT_NOTE_ID,BERTH,FK_CLASS_TYPE_ID,IS_DAY,chr(10)||chr(13)||‘系统自动采集‘); ELSIF STATE=0 THEN UPDATE PMIS_MACHINE_STOP_LOG SET PMIS_MACHINE_STOP_LOG.START_TIME = SYSDATE, PMIS_MACHINE_STOP_LOG.MINUTE = ROUND((SYSDATE-PMIS_MACHINE_STOP_LOG.END_TIME)*24*60,0) WHERE PMIS_MACHINE_STOP_LOG.EAM_ID = SU_ID AND PMIS_MACHINE_STOP_LOG.START_TIME IS NULL AND PMIS_MACHINE_STOP_LOG.SYS_TYPE = 1; END IF; END;
create or replace PROCEDURE "PRO_SEQ_RESET" (v_seqname varchar2) as n number(10); tsql varchar2(100); begin execute immediate ‘select ‘||v_seqname||‘.nextval from dual‘ into n; n:=-(n); tsql:=‘alter sequence ‘||v_seqname||‘ increment by ‘|| n; execute immediate tsql; execute immediate ‘select ‘||v_seqname||‘.nextval from dual‘ into n; tsql:=‘alter sequence ‘||v_seqname||‘ increment by 1‘; --设置序列增量为1 execute immediate tsql; end pro_seq_reset;
存储过程
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。