Link to home
Start Free TrialLog in
Avatar of abdallah1973
abdallah1973

asked on

Store code inside oracle BLOB column

Dear all,

I am try to use the below code to insert picture inside oracle table using SQL Plus  to be display on crystal report.

insert into timeta(ID,BEIMAGE) values(1283,utl_raw.cast_to_raw('C:\photo_dir\test2.png'));

but it's not show anything in the crystal report.This is the first time I use to store image in BLOB field and I am not sure if I am do it right.

Can you please advice?
Avatar of johnsone
johnsone
Flag of United States of America image

I am not an expert on LOBs and haven't actually used them in a while.  UTL_RAW would be the wrong package to load a LOB from.  You are essentially storing a string in that column.

I believe what you are looking for is DBMS_LOB.LOADBLOBFROMFILE.  That should do what you are looking for.  The documentation is here -> http://docs.oracle.com/database/121/ARPLS/d_lob.htm#ARPLS66723

I would recommend searching around the web for example code.
Avatar of slightwv (䄆 Netminder)
slightwv (䄆 Netminder)

You use DBMS_LOB.LOADBLOBFROMFILE the file you load needs to be on the database server.

If you want to load the file from a remote client you can write custom code or use SQL Loader (if you installed the tools when you installed the client software).
What version of Crystal are you using?

mlmcc
ASKER CERTIFIED SOLUTION
Avatar of abdallah1973
abdallah1973

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of abdallah1973

ASKER

The version is 2008 and it's work fine. Than you all.
With CR2008 you don't need to store the picture in the database.  You can just store the full path and file name.

mlmcc
I test and enhance it  to me my requirements. The knowledge is taken from your portal.