s_resourceunavailable_trg.sql

来自「Java写的ERP系统」· SQL 代码 · 共 36 行

SQL
36
字号
CREATE OR REPLACE TRIGGER S_ResourceUnavailable_Trg
BEFORE INSERT OR UPDATE
	ON S_ResourceUnavailable
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-2002 Jorg Janke, ComPiere, Inc. All Rights Reserved.
 *************************************************************************
 * $Id: S_ResourceUnavailable_Trg.sql,v 1.2 2002/10/23 03:16:57 jjanke Exp $
 ***
 * Title:	Resource Unavailability
 * Description:
 *			- Truncate + Fill date
 *			- Endure that start < end
 ************************************************************************/
BEGIN
	--	Truncate + Fill Date
	:new.DateFrom := TRUNC (:new.DateFrom);
	IF (:new.DateTo IS NULL) THEN
		:new.DateTo := :new.DateFrom;
  	ELSE
		:new.DateTo := TRUNC (:new.DateTo);
   	END IF;

	--	start < end
	IF (:new.DateFrom > :new.DateTo) THEN
		RAISE_APPLICATION_ERROR(-20403, 'End Date greater than Start Date');
	END IF;

END S_ResourceUnavailable_Trg;
/

⌨️ 快捷键说明

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