for 循环就不需要打开关闭游标了,他自动就打开关闭了
还有你上面不是2个LOOP吗
结束就应该是2个END LOOP
start_date datet;这个数据该是date
这样试试
CREATE OR REPLACE Procedure Up_Cc_Stand_Bom_Io As
Cursor Cor Is
Select Item,
Item_Class,
Item_d,
Item_d_Class,
Net_Qty,
Start_Date,
End_Date,
Remark
From Cc_Stand_Bom_Temp_Io;
Item Varchar2(128);
Item_Class Varchar2(1);
Item_d Varchar2(128);
Item_d_Class Varchar2(1);
Net_Qty Number(18, 8);
Start_Date Datet;
End_Date Date;
Remark Varchar2(256);
v_Count Number;
Rec_Cor Cor%Rowtype;
Begin
For Rec_Cor In Cor Loop
While Fetch_Status = 0 Loop
Select Count(*)
Into v_Count
From Cc_Stand_Bom_Io
Where Item = Item
And Item_d = Item_d
And Start_Date = Start_Date;
If v_Count > 0 Then
Delete From Cc_Stand_Bom_Io
Where Item = Item
And Item_d = Item_d
And Start_Date = Start_Date;
End If;
Insert Into Cc_Stand_Bom_Io
(Item,
Item_Class,
Item_d,
Item_d_Class,
Net_Qty,
Waste_Qty,
Total_Qty,
Start_Date,
End_Date,
Remark)
Values
(Item,
Item_Class,
Item_d,
Item_d_Class,
Net_Qty,
0,
Net_Qty,
Start_Date,
End_Date,
Remark);
Delete From Cc_Stand_Bom_Temp_Io;
End Loop;
End Loop;
End Up_Cc_Stand_Bom_Io;