Professional Documents
Culture Documents
AS
BEGIN
END ten_proc;
TO PROCEDURE C THAM S :
( tham_so_1 IN kieu_cua_tham_so,
tham_so_2 IN kieu_cua_tham_so
AS
BEGIN
END ten_proc;
TO PROCEDURE C BIN :
bien_1 kieu_cua_bien_1(chieu_dai_kieu_bien);
bien_2 kieu_cua_bien_2(chieu_dai_kieu_bien);
AS
BEGIN
END ten_proc;
Hoc
bien_1 ten_table.ten_field_1%TYPE;
bien_2 ten_table.ten_field_2%TYPE;
AS
BEGIN
END ten_proc;
IS
BEGIN
DBMS_OUTPUT.PUT_LINE();
END ten_proc;
-- Buoc 2 :
insert into tmpTB_Org
select C.segment1, C.segment4, E.description, D.currency_code, D.Actual_Flag,
NVL((select sum(NVL(D1.Begin_Balance_Dr,0)) - sum(NVL(D1.Begin_Balance_Cr,0))
from gl.gl_balances D1, gl.gl_code_combinations C1, apps.fnd_flex_values_vl E1
where D1.Code_Combination_Id = C1.CODE_COMBINATION_ID
and C1.Segment4 = E1.FLEX_VALUE
and D1.period_num = v2 -- HERE is BEG_BAL
and D1.period_year = v4 -- HERE
and C1.segment1 = C.segment1 -- HERE
and C1.segment4 = C.segment4
and D1.currency_code = D.currency_code
and D1.Actual_Flag = D.Actual_Flag
group by C1.Segment4
),0) BEG_BAL,
sum(NVL(D.Period_Net_Dr,0)) DEBIT,
sum(NVL(D.Period_Net_Cr,0)) CREDIT,
(NVL((select sum(NVL(D1.Begin_Balance_Dr,0)) - sum(NVL(D1.Begin_Balance_Cr,0))
from gl.gl_balances D1, gl.gl_code_combinations C1, apps.fnd_flex_values_vl E1
where D1.Code_Combination_Id = C1.CODE_COMBINATION_ID
and C1.Segment4 = E1.FLEX_VALUE
and D1.period_num = v2 -- HERE is BEG_BAL = 1
and D1.period_year = v4 -- HERE
and C1.segment1 = C.segment1 -- HERE
and C1.segment4 = C.segment4
and D1.currency_code = D.currency_code
and D1.Actual_Flag = D.Actual_Flag
group by C1.Segment4
),0)
+
sum(NVL(D.Period_Net_Dr,0))
-
sum(NVL(D.Period_Net_Cr,0))
) END_BAL
from gl.gl_balances D, gl.gl_code_combinations C, apps.fnd_flex_values_vl E
where D.Code_Combination_Id = C.CODE_COMBINATION_ID
and C.segment4 = E.FLEX_VALUE
-- Chu y : neu chay ADJ thi o day phai go tu 1->13 neu la YTD
and D.period_num in (v2) -- HERE to get Debits Credits YTD
and D.period_year = v4 -- HERE
-- and C.segment1 = '04' -- HERE
and C.Segment4 between w_seg_fr and w_seg_to -- HERE
and D.currency_code = 'VND'
and E.summary_flag <> 'Y'
and D.Actual_Flag = 'A'
group by C.segment1, C.segment4, E.description, D.currency_code, D.Actual_Flag
having
(select sum(NVL(D1.Begin_Balance_Dr,0)) - sum(NVL(D1.Begin_Balance_Cr,0))
from gl.gl_balances D1, gl.gl_code_combinations C1, apps.fnd_flex_values_vl E1
where D1.Code_Combination_Id = C1.CODE_COMBINATION_ID
and C1.Segment4 = E1.FLEX_VALUE
and D1.period_num = v2 -- HERE is BEG_BAL = 1
and D1.period_year = v4 -- HERE
and C1.segment1 = C.segment1 -- HERE
and C1.segment4 = C.segment4
and D1.currency_code = D.currency_code
and D1.Actual_Flag = D.Actual_Flag
group by C1.Segment4
) <> 0
or sum(NVL(D.Period_Net_Dr,0)) <> 0
or sum(NVL(D.Period_Net_Cr,0)) <> 0
order by C.segment4;
end sp_TB_PTD_Crosstab_Org;
/
Exec raise_salary(1,400)
Vi du 1
delete trichloc3;
commit;
end my_sp;
/
Vi du 2 :
delete trichloc3;
commit;
end my_sp;
/
Function
exec my_sp('C20003')