近來發現料號主檔的描述信息中竟然包括chr(9) Tab跳格符號&chr(10)Enter換行符號,導致部份報表異常。
--檢查
SELECT organization_id "組織", segment1 "料號", description "描述", INSTRB(description, CHR(9)) "TAB符號出現位置", SUBSTRB(description, 1, INSTRB(description, CHR(9)) ) "描述前段", SUBSTRB(description, INSTRB(description, CHR(9)), LENGTHB(description) ) "描述後段" FROM mtl_system_items_b WHERE 1 = 1 AND INSTRB(description, CHR(9)) ;
--修正
UPDATE mtl_system_items_b SET description = REPLACE(description, CHR(9)) WHERE 1 = 1 AND INSTRB(description, CHR(9)); UPDATE mtl_system_items_tl SET description = REPLACE(description, CHR(9)) WHERE 1 = 1 AND INSTRB(description, CHR(9)); UPDATE mtl_system_items_b SET segment1 = REPLACE(segment1, CHR(9)) WHERE 1 = 1 AND INSTRB(segment1, CHR(9)); UPDATE po_requisition_lines_all SET item_description = REPLACE(item_description, CHR(9)) WHERE 1 = 1 AND INSTRB(item_description, CHR(9)); UPDATE mtl_system_items_b SET description = REPLACE(description, chr(10)) WHERE 1 = 1 AND INSTRB(description, chr(10)); UPDATE mtl_system_items_tl SET description = REPLACE(description, chr(10)) WHERE 1 = 1 AND INSTRB(description, chr(10)); UPDATE mtl_system_items_b SET segment1 = REPLACE(segment1, chr(10)) WHERE 1 = 1 AND INSTRB(segment1, chr(10)); UPDATE po_requisition_lines_all SET item_description = REPLACE(item_description, chr(10)) WHERE 1 = 1 AND INSTRB(item_description, chr(10));
沒有留言:
張貼留言