-
hi all,
can u walk me thru this code?
i dont under standanything :(
CREATE TABLE blob_table(id number, src BLOB);
----------------
CREATE DIRECTORY util AS '/opt/oracle/utldir';
----------------
declare
LobRef BLOB;
FilRef BFILE := bfilename('UTIL','Acct.txt');
NextId number := 1;
begin
insert into blob_table values (NextId,empty_blob());
select src into LobRef from blob_table where id = NextId;
dbms_lob.open(LobRef,dbms_lob.lob_readwrite);
dbms_lob.fileopen(FilRef, dbms_lob.file_readonly);
dbms_lob.loadfromfile(LobRef,FilRef,dbms_lob.getlength(FilRef));
dbms_lob.fileclose(FilRef);
dbms_output.put_line( 'Len='||dbms_lob.getlength(LobRef));
dbms_lob.close(LobRef);
end;
Cheers!
OraKid.
-
OK.
- You create a table containing a BLOB and a directory object that points to the location of your file.
- You create a reference to an external file as a bfile.
- You insert a new record with an empty BLOB, then return the reference (locator) of the BLOB. This could be done in one go using the following syntax:
insert into blob_table values (NextId,empty_blob()) return src into LobRef;
- The external file is opened and it's whole contents is read into the LOB referred to by the LobRef locator.
- The external file is then closed.
This is the standard whay to load a BLOB or CLOB.
See:
http://www.oracle-base.com/Articles/8i/ImportBlob.asp
Cheers
-
thnx a lot Tim
geme some Oracle Proc*C examples.
Rgds,
Cheers!
OraKid.
-
Inserting pdf files in a blob column
In this example you have inserted empty_blob() in the blob column. how do i insert a value in it. say the value which is stored in FilRef BFILE := bfilename('UTIL','Acct.txt');
i.e, i want to insert the ACCT.txt & also retriev it. how can I retrieve it.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|