运行 PLSQL 过程时抛出并错误 '[Error] ORA-00984 (361: 53): PL/SQL: ORA-00984: 此处不允许列'

问题描述 投票:0回答:1

我尝试运行一个程序将一些数据提取到临时表中并将该数据放入报告中。代码之前运行正常。但我在表中添加了名为 lot_num 的额外列,并尝试将一些数据加载到该表中,这导致了此错误。当我再次从代码中删除 lot_num 的列和值时,它正在工作。请帮我找出问题所在。

我的代码在这里, FOR inv_onhand_rec IN cur_inv_onhand_qtyvalue( v_location_id , p_org_id1 , p_org_id2 , var_whouse , p_subinv_id1 , p_subinv_id2 , p_asat_日期 , p_segment1 , p_segment2 , p_cost_type , p_zero_qty_cost ) 循环

              --assign the cursor values to record variable                                            
                                                                
                 v_tmptable_rec.asat_date      := inv_onhand_rec.asat_date;             l_stmt := 23;  
                 
                 v_item_code :=  inv_onhand_rec.item_code;
                                 
                 v_tmptable_rec.item_code      := inv_onhand_rec.item_code;             l_stmt := 24;
                 v_tmptable_rec.item_category  := inv_onhand_rec.item_category;         l_stmt := 25;             
                 v_tmptable_rec.description    := inv_onhand_rec.description;           l_stmt := 26;
                 v_tmptable_rec.inv_location   := inv_onhand_rec.inv_org_location;      l_stmt := 27;
                 v_tmptable_rec.inv_org_name   := inv_onhand_rec.inventory_org;         l_stmt := 28;
                 v_tmptable_rec.subinventory   := inv_onhand_rec.subinventory;          l_stmt := 29;              
                 v_tmptable_rec.uom            := inv_onhand_rec.unitof_measure;        l_stmt := 30;
                 v_tmptable_rec.onhand_qty     := inv_onhand_rec.onhand_qty;            l_stmt := 31;
                 
                 
                 
                 v_item_cost := inv_onhand_rec.item_cost; 
                 
                 dbms_output.put_line(inv_onhand_rec.item_code ||' '|| TO_CHAR(ROUND(inv_onhand_rec.item_cost, 4))) ;
                 
                 v_tmptable_rec.item_cost      := ROUND(inv_onhand_rec.item_cost, 4);   l_stmt := 32;    
                 v_tmptable_rec.inv_value      := ROUND(inv_onhand_rec.inv_value, 4);   l_stmt := 33;
                 v_tmptable_rec.lot_num      :=inv_onhand_rec.lot_num;           -- l_stmt := 34;
                 
                 
                 l_stmt := 35;
                 --call the  insert procedure the, insert INVENTORY  ONHAND QTY
                    APPS.XXCUST_INV_ONHAND_QTY_VALUE_P_NEW.insert_inv_onhand_qty_value(v_tmptable_rec);
           
                                                    
                
            END LOOP;
        
     l_stmt := 36;        
  
  EXCEPTION
     WHEN OTHERS THEN
        
        dbms_output.put_line('Error : ' ||  v_item_code || ' ' || TO_CHAR(v_item_cost) ||', '|| SQLERRM);
        
        --ROLLBACK TO eam_work_order_details;
        RAISE_APPLICATION_ERROR(-20010,'LN:' || TO_CHAR(l_stmt) ||', '|| SQLERRM); 
  
  END;                                      

  PROCEDURE insert_inv_onhand_qty_value( p_invonhand_rec IN apps.xxcust_inv_onhand_qty_value_new%rowtype) 
  
  IS
    
  BEGIN
            --dbms_output.put_line('hello') ;

            BEGIN
            
                INSERT INTO apps.xxcust_inv_onhand_qty_value_new(asat_date
                                                                , item_code
                                                                , item_category
                                                                , description
                                                                , inv_location
                                                                , inv_org_name
                                                                , subinventory
                                                                , uom
                                                                , onhand_qty
                                                                , item_cost
                                                                , inv_value 
                                                                ,lot_num )    
                
                    VALUES(  p_invonhand_rec.asat_date
                                , p_invonhand_rec.item_code
                                , p_invonhand_rec.item_category
                                , p_invonhand_rec.description
                                , p_invonhand_rec.inv_location
                                , p_invonhand_rec.inv_org_name
                                , p_invonhand_rec.subinventory
                                , p_invonhand_rec.uom
                                , p_invonhand_rec.onhand_qty
                                , p_invonhand_rec.item_cost
                                , p_invonhand_rec.inv_value 
                                ,inv_onhand_rec.lot_num) ;
            EXCEPTION
                WHEN OTHERS THEN
                    RAISE_APPLICATION_ERROR(-20010,'Error when insert :' || SQLERRM);
            
            END;
            
  END insert_inv_onhand_qty_value;
plsql oracle10g toad
1个回答
0
投票

找到错误原因。只是在值语句中错误地定义了循环参数名称。我使用了“inv_onhand_rec.lot_num”,但它应该是“p_invonhand_rec.lot_num”。谢谢

© www.soinside.com 2019 - 2024. All rights reserved.