DECLARE
l_blob BLOB;
l_blob_length NUMBER;
l_amount BINARY_INTEGER := 10000;
l_offset INTEGER := 1;
l_buffer RAW(20000);
l_text_buffer VARCHAR2(32767);
l_break_at PLS_INTEGER := 250;
BEGIN
-- Get the BLOB from the APPLSYS.FND_LOBS table.
/* SELECT file_data
INTO l_blob
FROM fnd_lobs
WHERE file_id= 331001; --221148;
*/
select file_data into l_blob
from fnd_lobs
where file_id in (
SELECT media_id
FROM FND_ATTACHED_DOCS_FORM_VL
where function_name='CIM_PA_PAXPREPR_PROJECT'
and attached_document_id in (
SELECT attached_document_id
FROM FND_ATTACHED_DOCUMENTS
where pk1_value=5465 -- project id
and entity_name='PA_PROJECTS'
)
) and file_name='Mail from Chanakya K.txt';
-- Figure out how long the BLOB is.
l_blob_length := DBMS_LOB.GETLENGTH(l_blob);
-- loop through the BLOB as many times as necessary to
-- get all its data.
FOR i IN 1..CEIL(l_blob_length/l_amount) LOOP
-- Read in the given chunk of the BLOB.
DBMS_LOB.READ(l_blob,
l_amount,
l_offset,
l_buffer
);
-- The DBMS_LOB.READ procedure dictates that its output be RAW.
-- This next procedure converts that RAW data to character data.
l_text_buffer := UTL_RAW.CAST_TO_VARCHAR2(l_buffer);
-- DBMS_OUTPUT.PUT_LINE('==================================');
-- DBMS_OUTPUT.PUT_LINE('Text Buffer: 'length(l_text_buffer));
-- DBMS_OUTPUT.PUT_LINE('==================================');
-- Now that we have character data (up to l_amount characters long),
-- chunk it out so that we can do whatever we need to with it.
FOR j IN 1..CEIL(LENGTH(l_text_buffer) / l_break_at) LOOP
DBMS_OUTPUT.PUT_LINE(SUBSTR(l_text_buffer
,(((j - 1) * l_break_at) + 1)
,LEAST(LENGTH(l_text_buffer)-((j - 1) * l_break_at),l_break_at
)
)
);
END LOOP;
-- For the next iteration through the BLOB, bump up your offset
-- location, where you start reading from
l_offset := l_offset + l_amount;
END LOOP;
EXCEPTION
WHEN OTHERS THEN
DBMS_OUTPUT.PUT_LINE('ERROR: ' SUBSTR(SQLERRM,1,247));
RAISE;
END;
/
Subscribe to:
Post Comments (Atom)
Blog Archive
-
▼
2009
(44)
-
▼
October
(44)
- Steps to find pwd for an application user in oracl...
- Query to find Open invoce and customer information
- Query to get revenue distribution lines for Invoice
- Script to create customer,Party site,account site,...
- Query to retrive the PO and AP invoice information
- Query to Identify All Requistions errror out in WF
- Query To Identify All Purchase Orders errored out ...
- Query to find requisition number from PO number
- PO Requisitions and Project Details
- Purchase Orders with Project Details
- Employee Extraction
- Query to find Employee Contact information
- Check Provider and receiver projects for a project
- Query to find project, classfication and max trans...
- AP Invoice and PA Exp Details
- PA Revnue extract for exp and events
- Being Yogendra: Meebo Chat Gadget for iGoogle
- Find Customer information(bill&ship) for a Slaes O...
- Query to retrieve the line information of the Sale...
- Query to retrive the header information of the Sal...
- OM Flow and Table Level information
- Query to fetch all request groups attached to resp...
- Kill Locked Session
- To get all Conc Programs attached to a Reponsibility
- To Derive Module wise conc program count
- Calculate Request Time
- List of responsibilities assigned to specific user
- Finding Oracle Apps Version
- Query to find list of parameters used in Concurren...
- FNDLOAD(Ldt) Scripts
- Assign and Delete Responsibility to User from backend
- Assign Concurrent Prog to Reuest Group
- Change User passwrd in oracle application
- Sample query to build calendar
- Derive business days
- Derive Business Days Count
- Query to fetch Error workflow details
- Quickest way to generate the columns used in the c...
- Query to find all functions in a Menu
- fetch the values from a string separated by commas...
- Active alert information
- Steps to upload GIF, XLS, PDF, JPG and DOC files i...
- Reading and printing attachments in Oracle apps Te...
- Query to Check List of Form personalizations
-
▼
October
(44)
No comments:
Post a Comment