Oracle EBS ATTACHMENT with file
DECLARE
v_entity_name VARCHAR2(30) := 'ENG_ENGINEERING_CHANGES';
v_media_id NUMBER;
v_category_id NUMBER;
v_seq_num NUMBER;
v_datatype_id NUMBER;
p_entity_id NUMBER := 9008;
p_document_desc VARCHAR2(120) := 'TEST';
p_file_name VARCHAR2(100) := '11-a.pdf';
b_file BFILE;
b_lob BLOB;
BEGIN
fnd_global.apps_initialize(user_id => 1,
resp_id => 2,
resp_appl_id => 3);
dbms_application_info.set_client_info(4);
SELECT category_id
INTO v_category_id
FROM fnd_document_categories_tl
WHERE user_name = 'ECO Attachments';
SELECT datatype_id
INTO v_datatype_id
FROM fnd_document_datatypes
WHERE NAME = 'FILE'
AND LANGUAGE = 'US';
SELECT (nvl(MAX(seq_num),
0) + 10)
INTO v_seq_num
FROM fnd_attached_documents
WHERE entity_name = v_entity_name
AND pk1_value = to_char(p_entity_id);
fnd_webattch.add_attachment(seq_num => v_seq_num,
category_id => v_category_id,
document_description => p_document_desc,
datatype_id => v_datatype_id,
text => NULL,
file_name => p_file_name,
url => NULL,
function_name => NULL,
entity_name => v_entity_name,
pk1_value => to_char(p_entity_id),
pk2_value => NULL,
pk3_value => NULL,
pk4_value => NULL,
pk5_value => NULL,
media_id => v_media_id,
user_id => fnd_global.user_id);
COMMIT;
SELECT media_id
INTO v_media_id
FROM fnd_attached_docs_form_vl
WHERE entity_name = v_entity_name
AND pk1_value = to_char(p_entity_id)
AND function_name = 'ENGFDECN'
AND seq_num = v_seq_num;
INSERT INTO fnd_lobs
(file_id,
file_name,
file_content_type,
file_data,
upload_date,
expiration_date,
program_name,
program_tag,
LANGUAGE,
oracle_charset,
file_format)
VALUES
(v_media_id,
p_file_name,
'application/pdf',
empty_blob(),
SYSDATE,
NULL,
'FNDATTCH',
'',
'US',
'UTF8',
'BINARY') RETURN file_data INTO b_lob;
b_file := bfilename('JACK',
p_file_name);
dbms_lob.open(b_file,
dbms_lob.file_readonly);
dbms_lob.loadfromfile(b_lob,
b_file,
dbms_lob.getlength(b_file));
dbms_lob.close(b_file);
COMMIT;
EXCEPTION
WHEN OTHERS THEN
dbms_output.put_line(SQLERRM);
END;
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/59792/viewspace-1049096/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Oracle EBS log file (R12.1.3)Oracle
- 解決The jar file has no source attachment問題JAR
- ORACLE EBS中檢視某個Request的Output FileOracle
- Oracle EBS R12 Packaging File 和MakeCD 終於完成..Oracle
- Oracle EBS R12.1.1 system09.dbf file corruption BugOracle
- oracle ebsOracle
- mail with attachmentAI
- 【EBS】Oracle EBS 之 OM 模組整理(1)Oracle
- Oracle EBS log file (R12.1.3) - R12安裝log及其他logOracle
- Oracle ebs patch typeOracle
- Oracle EBS基礎學習:Oracle EBS啟用診斷功能Oracle
- ORACLE EBS INSTALL of ebs12 install packagesOraclePackage
- Oracle EBS Monitoring ScriptsOracle
- ORACLE EBS 簡稱大全Oracle
- [轉載] Oracle EBS 入門Oracle
- Oracle EBS R12 "OutOfMemoryError"OracleError
- How to gather statistics on Oracle eBS.Oracle
- Oracle EBS AD Merge PatchOracle
- ORACLE EBS中的bne logOracle
- Oracle EBS中打補丁Oracle
- oracle is not in the sudoers fileOracle
- Oracle EBS DBA 常用命令Oracle
- 談談Oracle EBS R12Oracle
- Oracle EBS11i Clone 文件Oracle
- Oracle EBS 如何生成trace檔案Oracle
- Oracle ebs R12.1.1 完成。。Oracle
- ORACLE EBS - 檢視OPP Service LogOracle
- oracle EBS在中國的客戶Oracle
- ORACLE EBS R 12解決方案Oracle
- Oracle ASM File DirectoryOracleASM
- oracle utl_fileOracle
- OMF (Oracle Managed File)Oracle
- Oracle Password File 理解Oracle
- Oracle DBA 和Oracle EBS DBA 的最大區別Oracle
- background-attachment屬性進階
- oracle EBS R12 FORM 編譯OracleORM編譯
- Oracle EBS R12.1.3克隆文件Oracle
- Oracle Database In-Memory Certified with EBS 12.2OracleDatabase