從EXCEL導PRICE LIST到OM單價庫
因應組織變更或年度報價或批次調整後,往往要重新匯入或修改單價,以下SCRIPE就是例項.
先在EXCEL中整理好機型與單價 兩欄
然後在 第二行第三欄 用FUNCTION
=CONCATENATE("insert into lsitem values('",A2,"',",B2,");")
將此FUNCTION拉到最後一筆
然後將此第三欄COPY TO TOAD
begin
delete lsitem;
insert into lsitem values('FS1B4055CP-KFA2',34.12);
insert into lsitem values('A239001CCP-50-NDB1',1.65);
......
commit;
end;
將資料INSERT INTO到臨時TABLE: LSITEM
再將要匯入的PRICE LIST ID找出來,並替換SCRIPT中的LIST_HEADER_ID,其中1174是我的USER_ID.
select NAME,LIST_HEADER_ID,creation_date
from qp_list_headers
where name like
'%GUCS 2011%'[@more@]/*
select * from LSITEM
----------
begin
delete lsitem;
insert into lsitem values('FS1B4055CP-KFA2',34.12);
insert into lsitem values('A239001CCP-50-NDB1',1.65);
......
commit;
end;
------------
commit
INSERT INTO LSITEM VALUES('PS139617ECPD',8);
=CONCATENATE("insert into lsitem values('",A2,"',",B2,");")
select NAME,LIST_HEADER_ID,creation_date
from qp_list_headers
where name like
'%GUCS 2011%'
select * from ls_item
where item='A663341'
*/
DECLARE
IFHAVE NUMBER;
V_LIST_LINE_ID NUMBER;
V_LIST_header_ID NUMBER;
old_LIST_LINE_ID number;
cursor curadd is
select a.item,a.price price,b.inventory_item_id ,7427815 LIST_HEADER_ID
from lsitem a, mtl_system_items_b b
where b.segment1=a.item
and b.organization_id=1
-- and 1=2
and a.ITEM IS NOT NULL
and b.inventory_item_id not in
(select PRODUCT_ATTR_VALUE from qp_pricing_attributes
where list_header_id =7427815
);
cursor curupd is
select a.item,round(a.price,3) price,b.inventory_item_id ,
i.LIST_HEADER_ID,i.list_line_id
from lsitem a,
mtl_system_items_b b,
qp_list_headers h,
qp_pricing_attributes i
where b.segment1=a.item
and b.organization_id=1
and a.ITEM IS NOT NULL
and h.list_header_id=7427815
and i.list_header_id=h.list_header_id
and i.product_attr_value=to_char(b.inventory_item_id);
begin
for recu in curupd loop
update qp_list_lines
set operand=recu.price,
last_update_date=sysdate,
last_updated_by=1174
--start_date_active=to_date('20110101','yyyymmdd')
where list_line_id=recu.list_line_id;
end loop;
for reca in curadd loop
SELECT qp_list_lines_s.nextval INTO V_LIST_LINE_ID FROM DUAL;
/*
select pricing_attribute_id,creation_date,created_by,last_update_date,last_updated_by,last_update_login,
list_line_id,excluder_flag,accumulate_flag,product_attribute_context,product_attribute,product_attr_value,
product_uom_code,attribute_grouping_no,product_attribute_datatype,comparison_operator_code,
list_header_id,pricing_phase_id,qualification_ind from qp_pricing_attributes
WHERE LIST_HEADER_ID=152767
where list_line_id=1886828
*/
insert into qp_pricing_attributes a
(pricing_attribute_id,creation_date,created_by,last_update_date,last_updated_by,last_update_login,
list_line_id,excluder_flag,accumulate_flag,product_attribute_context,product_attribute,product_attr_value,
product_uom_code,attribute_grouping_no,product_attribute_datatype,comparison_operator_code,
list_header_id,pricing_phase_id,qualification_ind )
values
(qp_pricing_attributes_s.nextval,sysdate,1174,sysdate,1174,1,
v_list_line_id,'N','N','ITEM','PRICING_ATTRIBUTE1',to_char(RECa.INVENTORY_ITEM_ID),
'PCS',QP_PRICING_ATTR_GROUP_NO_S.nextval,'C','BETWEEN',
RECa.list_header_id,1,4);
/*
select list_line_id,creation_date,created_by,last_update_date,last_updated_by,last_update_login,
list_header_id,list_line_type_code,start_date_active,automatic_flag,modifier_level_code,
revision_date,arithmetic_operator,operand,reprice_flag,list_line_no,
pricing_phase_id,pricing_group_sequence,incompatibility_grp_code,product_precedence,
qualification_ind from qp_list_lines
where list_line_id=1886828
select * from qp_list_lines
where list_line_id=2498577
*/
insert into qp_list_lines
(list_line_id,creation_date,created_by,last_update_date,last_updated_by,last_update_login,
list_header_id,list_line_type_code,start_date_active,automatic_flag,modifier_level_code,
revision_date,arithmetic_operator,operand,reprice_flag,list_line_no,
pricing_phase_id,pricing_group_sequence,incompatibility_grp_code,product_precedence,
qualification_ind)
VALUES
(v_list_line_id,sysdate,1174,sysdate,1174,1,
RECa.list_header_id,'PLL',SYSDATE,'Y','LINE',
SYSDATE,'UNIT_PRICE',reca.price,'Y',V_LIST_LINE_ID,
1,0,'EXCL',220,
4);
END LOOP;
COMMIT;
END ;
/*
update qp_list_lines
set operand=round(operand,3)
where list_header_id =7435743
*/
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/92289/viewspace-1049398/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- SQL : OM Price ListSQL
- java 從EXCEL匯入到資料庫JavaExcel資料庫
- 從Excel到匯入MYSQL資料庫ExcelMySql資料庫
- oracle software price軟體產品定價--價格資訊Oracle
- 從list到struts和springSpring
- 從Excel到ERP(轉)Excel
- BestCoder Round #861001Price List(數學)
- 用python庫openpyxl操作excel,從源excel表中提取資訊複製到目標excel表中PythonExcel
- 從程式導向到物件導向物件
- SAP Cloud for Customer Price-計價簡介Cloud
- 用excel檔把item與price匯入oracle erpExcelOracle
- java 從EXCEL匯入到系統JavaExcel
- RAC從帶庫到單例項的恢復單例
- 將excel中資料從window上匯入到linux中oracle資料庫ExcelLinuxOracle資料庫
- 同一個server內將資料從A資料庫導到B資料庫Server資料庫
- 效能優化資料庫篇-從單機到叢集優化資料庫
- 匯入excel資源到資料庫Excel資料庫
- 將資料從 Visual Basic 傳輸到 ExcelExcel
- 領導力:從個人到團隊(轉)
- 從物件導向到模式再到真正的物件導向 (轉)物件模式
- Excel讀寫合集:Excel讀寫小白從不知所措到輕鬆上手Excel
- 從資料庫到雲Oracle持續創新成就市場領導力資料庫Oracle
- 4.0體驗站|OceanBase 4.0,從分散式到單機,從單機到分散式分散式
- .NET8 Blazor 從入門到精通:(三)類庫和表單Blazor
- maatwebsite/excel匯入從2.1升級到3.xWebExcel
- 從Gitlab中匯出issue到Excel檔案中GitlabExcel
- MongoDB從入門到刪庫MongoDB
- 資料庫數字參考表的妙用OM資料庫
- Java基礎01 從HelloWorld到物件導向Java物件
- 從 Java 到 Scala(一):物件導向談起Java物件
- 從入門到入獄------物件導向(二)物件
- EBS:OM Sales Order銷售訂單【Open Interface、Open API】API
- C#使用 NPOI 新增圖片到 Excel 單元格C#Excel
- easyExcel匯出多個list列表的excelExcel
- C4C Product Price List的模型中和有效期相關的兩個欄位模型
- ROS機器人導航一 : 從英雄聯盟到ROS導航ROS機器人
- excel導資料到PostgresqlExcelSQL
- 【LeetCode從零單排】No83 Remove Duplicates from Sorted ListLeetCodeREM