DBA Data[Home] [Help]

PACKAGE BODY: APPS.PA_PLAN_RL_FORMATS_PKG

Source


1 package body Pa_Plan_RL_Formats_Pkg as
2 /* $Header: PARRFTTB.pls 120.0 2005/05/30 03:13:25 appldev noship $ */
3 /************************************************************
4  * This is a Table Handler Procedure for Inserting into
5  * pa_plan_rl_formats table. It takes in parameters from
6  * the Pa_Plan_RL_Formats_Pvt.Create_Plan_RL_Format procedure.
7  *********************************************************/
8  Procedure Insert_Row (
9  	P_Resource_List_Id		 IN Number,
10  	P_Res_Format_Id			 IN Number,
11  	P_Last_Update_Date		 IN Date,
12  	P_Last_Updated_By		 IN Number,
13  	P_Creation_Date			 IN Date,
14  	P_Created_By			 IN Number,
15  	P_Last_Update_Login 		 IN Number,
16 	X_Plan_RL_Format_Id	        OUT NOCOPY Number,
17 	X_Record_Version_Number 	OUT NOCOPY NUMBER  )
18 
19  Is
20 
21 	Cursor Return_RowId(P_Plan_RL_Format_Ident IN Number) is
22   	Select
23 		RowId
24 	From
25 		Pa_Plan_RL_Formats
26 	Where
27 		Plan_RL_Format_Id = P_Plan_RL_Format_Ident;
28 
29 	Cursor Get_ItemId is
30 	Select
31 		Pa_Plan_RL_Formats_S.nextval
32 	From
33 		Dual;
34 
35 	l_Plan_RL_Format_id NUMBER := Null;
36 	l_RowId 	    ROWID  := Null;
37 
38  Begin
39 
40 	-- Get next available id from sequence
41 	Open Get_ItemId;
42 	Fetch Get_ItemId Into l_Plan_RL_Format_Id;
43 	Close Get_ItemId;
44 
45 	Insert Into Pa_Plan_RL_Formats (
46  		Plan_RL_Format_Id ,
47 	 	Resource_List_Id ,
48 	 	Res_Format_Id ,
49 		Record_Version_Number ,
50 	 	Last_Update_Date ,
51 	 	Last_Updated_By ,
52 	 	Creation_Date ,
53 	 	Created_By ,
54 	 	Last_Update_Login)
55 	Values (
56 		l_Plan_RL_Format_Id ,
57 	 	P_Resource_List_Id ,
58 	 	P_Res_Format_Id	,
59 		1 , -- record_version_number always starts with 1
60 	 	P_Last_Update_Date ,
61 		P_Last_Updated_By ,
62 	 	P_Creation_Date ,
63 	 	P_Created_By ,
64 	 	P_Last_Update_Login );
65 
66 	-- Verify that the row was created
67 	Open Return_RowId(P_Plan_RL_Format_Ident => l_Plan_RL_Format_Id);
68 	Fetch Return_RowId Into l_RowId;
69 
70 	If (Return_RowId%NotFound) Then
71 
72 		Close Return_RowId;
73 		Raise No_Data_Found;
74 
75 	End If;
76 
77 	Close Return_RowId;
78 	X_Plan_RL_Format_Id := l_Plan_RL_Format_Id;
79 	X_Record_Version_Number := 1;
80 
81  End Insert_Row;
82 /********************/
83 
84 /************************************************************
85  * This is a Table Handler Procedure for Deleting from
86  * pa_plan_rl_formats table. It takes in parameters from
87  * the Pa_Plan_RL_Formats_Pvt.Delete_Plan_RL_Format procedure.
88  *********************************************************/
89  Procedure Delete_Row (
90 	P_Res_List_Id    	IN Number Default Null,
91 	P_Res_Format_Id		IN Number Default Null,
92 	P_Plan_RL_Format_Id	IN Number Default Null )
93 
94  Is
95 
96  Begin
97 
98 	If P_Plan_RL_Format_Id is Null Then
99 
100 		Delete from Pa_Plan_RL_Formats
101 		where
102 			Resource_List_Id = P_Res_List_Id
103 		and   	Res_Format_Id = P_Res_Format_Id;
104 
105 	Else
106 
107 		Delete from Pa_Plan_RL_Formats
108 		Where
109 			Plan_RL_Format_Id = P_Plan_RL_Format_Id;
110 
111 	End If;
112 
113  End Delete_Row;
114 /*******************/
115 
116 END Pa_Plan_RL_Formats_Pkg ;