아래의 소스가 스토어 프로시저인데요~
데이타조회시 이스토어프로시저를 통해 데이타를 픽업해오도록 했는데
보시다 시피 파라미터3개를 써서 불러와야 할 데이타들이 어떤건 나오고 또 어떤건 안나와요~
왜이런거죠??
데이타들이 왜 다 나오질 않고 나오기도 하고 안나오기도 하는건지..
고수님들 제발 도와 주세요~
create or replace procedure ordrpr16(p_no_buyer in varchar2,
p_no_year in varchar2,
p_no_seq in number)
is
g_read_cnt number(01); /* Read Count */
Cursor C1 is Select order_no_buyer, order_no_year, order_no_seq,
pattern_1, pattern_2, comb_no,
fabric_code, order_unit, nvl(order_qty,0) order_qty
From ordr01ht
Where order_no_buyer = p_no_buyer
And order_no_year = p_no_year
And order_no_seq = p_no_seq;
C1_Rec c1%rowtype;
begin
Open C1;
Loop
Fetch C1 into C1_Rec.order_no_buyer, C1_Rec.order_no_year, C1_Rec.order_no_seq,
C1_Rec.pattern_1, C1_Rec.pattern_2, C1_Rec.comb_no,
C1_Rec.fabric_code, C1_Rec.order_unit, C1_Rec.order_qty;
Exit When C1%NotFound;
g_read_cnt := 0;
begin
select count(*)
into g_read_cnt
from ordr13mt
Where order_no_buyer = C1_Rec.order_no_buyer
And order_no_year = C1_Rec.order_no_year
And order_no_seq = C1_Rec.order_no_seq
And pattern_1 = C1_Rec.pattern_1
And pattern_2 = C1_Rec.pattern_2
And comb_no = C1_Rec.comb_no
And fabric_code = C1_Rec.fabric_code;
Exception
When others then
g_read_cnt := 0;
end;
if g_read_cnt = 0 then
begin
Insert into Ordr13mt (order_no_buyer,
order_no_year,
order_no_seq,
pattern_1,
pattern_2,
comb_no,
fabric_code,
order_unit,
order_qty,
ship_tot_qty,
ship_confirm)
values (C1_Rec.order_no_buyer,
C1_Rec.order_no_year,
C1_Rec.order_no_seq,
C1_Rec.pattern_1,
C1_Rec.pattern_2,
C1_Rec.comb_no,
C1_Rec.fabric_code,
C1_Rec.order_unit,
C1_Rec.order_qty,
0,
null);
end;
end if;
End Loop;
Close C1;
Commit;
end;