⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ad_pinstance_trg.sql

📁 Java写的ERP系统
💻 SQL
字号:
CREATE OR REPLACE TRIGGER AD_PInstance_Trg
AFTER UPDATE OF IsProcessing
	ON AD_PInstance
FOR EACH ROW
DECLARE
/*************************************************************************
 * The contents of this file are subject to the Compiere License.  You may
 * obtain a copy of the License at    http://www.compiere.org/license.html
 * Software is on an  "AS IS" basis,  WITHOUT WARRANTY OF ANY KIND, either
 * express or implied. See the License for details. Code: Compiere ERP+CRM
 * Copyright (C) 1999-2001 Jorg Janke, ComPiere, Inc. All Rights Reserved.
 *************************************************************************
 * $Id: AD_PInstance_Trg.sql,v 1.1 2002/01/20 20:53:58 jjanke Exp $
 ***
 * Title:	Update Process Statistics
 * Description:
 ************************************************************************/
 	v_Seconds		NUMBER;
BEGIN
	IF (:old.IsProcessing='Y' AND :new.IsProcessing='N') THEN
		--	Calculate Seconds
		v_Seconds := (:new.Updated-:new.Created) * 86400;	-- 24*60*60
		IF (v_Seconds = 0) THEN
			v_Seconds := 1;
	   	END IF;

		UPDATE AD_Process
			SET Statistic_Count = NVL(Statistic_Count, 0) + 1, 
				Statistic_Seconds = NVL(Statistic_Seconds,0) + v_Seconds
		WHERE AD_Process_ID = :new.AD_Process_ID;
	END IF;
END AD_PInstance_Trg;
/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -