Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> LOBs Questions. Need help.
--0-1658667313-1031676917=:89218
Content-Type: text/plain; charset=us-ascii
Hi All,
I want to load PDF files into the database and view the content of the lobs column. Below is what I did step by step. Anyone please point out what did I do wrong in my procedure. I am still unable to view the content of the Lobs column. I need you all for your help.
Please note that I already stored the PDF file (‘6117cdsapx.pdf’) on my Oracle server site at /Disk05/test
CREATE TABLE MY_BOOK_TEXT (
FILE_DESC VARCHAR2 (200),
BOOK_FILE BFILE);
CREATE DIRECTORY TEST AS ‘/Disk05/test’;
DECLARE pdf BFILE;
BEGIN pdf := BFILENAME (‘TEST’, ‘6117cdsapx.pdf’);
END; /
INSERT INTO MY_BOOK_TEXT (FILE_DESC, BOOK_FILE ) VALUES (‘IBM Microprocessor’, BFILENAME(‘TEST’, ‘6117cdsapx.pdf’);
This procedure has been executed on the server site. When executing the procedure, it got a warning message: Procedure created with compilation errors.
CREATE OR REPLACE PROCEDURE displayLOB_proc IS
Lob_loc BLOB;
Buffer RAW(1024);
Amount BINARY_INTEGER := 1024;
Position INTEGER := 1;
BEGIN
/* Select the LOB: */
SELECT m.Map_obj.Drawing INTO Lob_loc
FROM Multimedia_tab m WHERE m.Clip_ID = 1;
/* Opening the LOB is optional: */
DBMS_LOB.OPEN (Lob_loc, DBMS_LOB.LOB_READONLY);
LOOP
DBMS_LOB.READ (Lob_loc, Amount, Position, Buffer); /* Display the buffer contents: */ DBMS_OUTPUT.PUT_LINE(utl_raw.cast_to_varchar2(Buffer)); Position := Position + Amount;
WHEN NO_DATA_FOUND THEN DBMS_OUTPUT.PUT_LINE('End of data');End;
Thank you all for your help in advance
Lenka
<P>Hi All,
<P>I want to load PDF files into the database and view the content of the lobs column. Below is what I did step by step. Anyone please point out what did I do wrong in my procedure. I am still unable to view the content of the Lobs column. I need you all for your help.
<P>Please note that I already stored the PDF file (‘6117cdsapx.pdf’) on my Oracle server site at /Disk05/test
<P class=MsoNormal>CREATE TABLE MY_BOOK_TEXT<SPAN style="mso-spacerun: yes"> </SPAN>(</P>
<P class=MsoNormal>FILE_DESC VARCHAR2 (200),</P>
<P class=MsoNormal>BOOK_FILE BFILE);</P>
<P class=MsoNormal><?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p> </o:p></P>
<P class=MsoNormal>CREATE DIRECTORY TEST AS ‘/Disk05/test’;</P>
<P class=MsoNormal><o:p> </o:p></P>
<P class=MsoNormal>DECLARE </P>
<P class=MsoNormal style="TEXT-INDENT: 0.5in">pdf<SPAN style="mso-spacerun: yes"> </SPAN>BFILE;</P>
<P class=MsoNormal>BEGIN</P>
<P class=MsoNormal><SPAN style="mso-tab-count: 1"> </SPAN>pdf<SPAN style="mso-spacerun: yes"> </SPAN>:= BFILENAME<SPAN style="mso-spacerun: yes"> </SPAN>(‘TEST’, ‘6117cdsapx.pdf’);</P>
<P class=MsoNormal>END;<o:p> </o:p></P>
<P class=MsoNormal><o:p>/</o:p></P>
<P class=MsoNormal>INSERT INTO MY_BOOK_TEXT (FILE_DESC, BOOK_FILE )</P>
<P class=MsoNormal>VALUES (‘IBM Microprocessor’, BFILENAME(‘TEST’, ‘6117cdsapx.pdf’);</P>
<P class=MsoNormal><FONT color=#bf005f><o:p> This procedure has been executed on the server site. When executing the procedure, it got a warning message: Procedure created with compilation errors.</o:p></FONT></P>
<P class=MsoNormal><SPAN style="FONT-FAMILY: monospace; FONT-SIZE: 10pt; mso-bidi-font-family: Tahoma">CREATE OR REPLACE PROCEDURE displayLOB_proc IS <BR>Lob_loc BLOB; <BR>Buffer RAW(1024); <BR>Amount BINARY_INTEGER := 1024; <BR>Position INTEGER := 1; <BR>BEGIN <BR> /* Select the LOB: */ <BR> SELECT m.Map_obj.Drawing INTO Lob_loc <BR> FROM Multimedia_tab m WHERE m.Clip_ID = 1; <BR> /* Opening the LOB is optional: */ <BR> DBMS_LOB.OPEN (Lob_loc, DBMS_LOB.LOB_READONLY); <BR> LOOP <BR> DBMS_LOB.READ (Lob_loc, Amount, Position, Buffer); <BR> /* Display the buffer contents: */ <BR> DBMS_OUTPUT.PUT_LINE(utl_raw.cast_to_varchar2(Buffer)); <BR> Position := Position + Amount; <BR> END LO!
OP; <BR> /* Closing the LOB is mandatory if you have opened it: */ <BR> DBMS_LOB.CLOSE (Lob_loc); <BR> EXCEPTION <BR> WHEN NO_DATA_FOUND THEN <BR> DBMS_OUTPUT.PUT_LINE('End of data'); <BR style="mso-special-character: line-break">End;<BR style="mso-special-character: line-break">/</SPAN></P>
<P class=MsoNormal><FONT face="">Thank you all for your help in advance</FONT></P>
<P class=MsoNormal>Lenka</P><p><br><hr size=1>Yahoo! - We Remember<br>
<b>9-11: A tribute to the more than 3,000 lives lost</b>
Received on Tue Sep 10 2002 - 11:55:17 CDT
![]() |
![]() |