📄 c_salesregion_trg.sql
字号:
CREATE OR REPLACE TRIGGER C_SalesRegion_Trg
AFTER INSERT
ON C_SalesRegion
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: C_SalesRegion_Trg.sql,v 1.2 2002/10/23 03:16:57 jjanke Exp $
***
* Title: SalesRegion new record
* Description:
* - create treenode
************************************************************************/
v_Tree_ID NUMBER;
v_Parent_ID NUMBER;
--
BEGIN
-- Create TreeNode --
-- get AD_Tree_ID + ParentID
SELECT c.AD_Tree_SalesRegion_ID, n.Node_ID
INTO v_Tree_ID, v_Parent_ID
FROM AD_ClientInfo c, AD_TreeNode n
WHERE c.AD_Tree_SalesRegion_ID=n.AD_Tree_ID
AND n.Parent_ID IS NULL
AND c.AD_Client_ID=:new.AD_Client_ID;
-- DBMS_OUTPUT.PUT_LINE('Tree='||xTree_ID||' Node='||:new.C_Project_ID||' Parent='||xParent_ID);
-- Insert into TreeNode
INSERT INTO AD_TreeNode
(AD_Client_ID, AD_Org_ID,
IsActive, Created, CreatedBy, Updated, UpdatedBy,
AD_Tree_ID, Node_ID,
Parent_ID, SeqNo)
VALUES
(:new.AD_Client_ID, :new.AD_Org_ID,
:new.IsActive, :new.Created, :new.CreatedBy, :new.Updated, :new.UpdatedBy,
v_Tree_ID, :new.C_SalesRegion_ID,
v_Parent_ID, DECODE(:new.IsSummary, 'Y', 100, 999)); -- Summary Nodes first
EXCEPTION
WHEN NO_DATA_FOUND THEN
RAISE_APPLICATION_ERROR (-20001, 'C_SalesRegion InsertTrigger Error: No ClientInfo or parent TreeNode');
END C_SalesRegion_Trg;
/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -