Loading a picture or stream in BLOB

Dear experts,
I am able to update a BFILE field like the below example
update emp set emp_photo=BFILENAME('IMAGE_DIR','Tired.JPG') where empno='7566';
But is there any simple way to update BLOB field with a picture.
What i can find in my book is a procedure.
CREATE OR REPLACE PROCEDURE loadLOBFromBFILE_proc
(p_dest_loc IN OUT BLOB, p_file_name IN VARCHAR2,
p_file_dir IN VARCHAR2)
IS
v_src_loc BFILE := BFILENAME(p_file_dir, p_file_name);
v_amount INTEGER := 4000;
BEGIN
DBMS_LOB.OPEN(v_src_loc, DBMS_LOB.LOB_READONLY);
v_amount := DBMS_LOB.GETLENGTH(v_src_loc);
DBMS_LOB.LOADFROMFILE(p_dest_loc, v_src_loc, v_amount);
DBMS_LOB.CLOSE(v_src_loc);
END loadLOBFromBFILE_proc;
is there any update statement like the afore mentioned update statement of BFILENAME which will work for BLOB.
Regards
Rajat

There is  no built-in way to insert or update a blob column from a bfile using just SQL without PL/SQL.  What is wrong with your attempted method is that you are trying to use a procedure in a SQL insert or update statement.  You need to use a function in a SQL insert or update statement.  The following demonstrates how to create your own generic bfile_to_blob function and use it in a SQL insert or update statement.
SCOTT@orcl12c> ALTER TABLE emp ADD (emp_db_photo BLOB)
  2  /
Table altered.
SCOTT@orcl12c> CREATE OR REPLACE DIRECTORY image_dir AS 'c:\my_oracle_files'
  2  /
Directory created.
SCOTT@orcl12c> CREATE OR REPLACE FUNCTION bfile_to_blob
  2    (p_bfile     IN BFILE)
  3    RETURN           BLOB
  4  AS
  5    v_src_file      BFILE := p_bfile;
  6    v_amount        INTEGER;
  7    v_dest_lob      BLOB;
  8  BEGIN
  9    DBMS_LOB.OPEN (v_src_file, DBMS_LOB.LOB_READONLY);
10    v_amount := DBMS_LOB.GETLENGTH (v_src_file);
11    DBMS_LOB.CREATETEMPORARY (v_dest_lob, FALSE, DBMS_LOB.CALL);
12    DBMS_LOB.LOADFROMFILE (v_dest_lob, v_src_file, v_amount);
13    DBMS_LOB.CLOSE (v_src_file);
14    RETURN v_dest_lob;
15  END bfile_to_blob;
16  /
Function created.
SCOTT@orcl12c> SHOW ERRORS
No errors.
SCOTT@orcl12c> INSERT INTO emp (empno, deptno, emp_db_photo)
  2  VALUES (99, 40, bfile_to_blob (BFILENAME ('IMAGE_DIR', 'Bridge.JPG')))
  3  /
1 row created.
SCOTT@orcl12c> UPDATE emp
  2  SET    emp_db_photo = bfile_to_blob (BFILENAME ('IMAGE_DIR','Bridge.JPG'))
  3  WHERE  empno = 7698
  4  /
1 row updated.
SCOTT@orcl12c> COMMIT
  2  /
Commit complete.
SCOTT@orcl12c> SELECT empno, DBMS_LOB.GETLENGTH (emp_db_photo)
  2  FROM   emp
  3  WHERE  emp_db_photo IS NOT NULL
  4  /
     EMPNO DBMS_LOB.GETLENGTH(EMP_DB_PHOTO)
      7698                           511500
        99                           511500
2 rows selected.

Similar Messages

  • How to show a picture from my database (BLOB field) Oracle into my JSP

    Hi all, i got a problem trying to show a picture in my JSP.
    I have a servlet which loads my picture, the problem is that i dont know how to set into a session// session.setAttribute("xxx","aaa") // or if there is another way to set it up, in order to show it in my JSP, if someone could help me i really appreciate it... thanks

    The way you include it in your jsp is the standard way you download any image.
    With an image tag
    <img src="myImageServlet?imageId=42"/>
    and your imageServlet actually returns the picture via its output stream.
    ie it makes 2 requests. One for the jsp page, and then when it receives and parses the html, one to the servlet to get the image.

  • Load a picture ??

    I want to load a BLOB (in this case a .jpg) into a table. Our Forms run in Internet Explorer.
    Is there a way I can have a dialog box where the user selects the picture they want, then I load this picture into the table?
    Or is there some other way to do the same thing?
    Thanks, Wayne
    Forms [32 Bit] Version 9.0.4.0.19 (Production)
    Oracle Database 10g Enterprise Edition Release 10.1.0.3.0

    You can make use of webutil or a make a java bean which can upload the the file.
    webutil can be downloaded at the oracle site and ann example of the java bean can be found at http://forms.pjc.bean.over-blog.com/categorie-453384.html

  • My iPhone 4S has stopped receiving iMessages, cannot send/load any pictures over whatsapp, cannot join the wifi in my house anymore. What has happened to my iPhone i haven't made any changes?

    My iPhone 4S has stopped receiving/sending iMessages, cannot send/load any pictures over whatsapp and cannot join the wifi in my house anymore.
    Essentially all the things I use my phone for have now stopped working. I constantly have 3G connected (even though i dont want to use it, i want to connect to the wifi in my house) but still when I try to download/ send a picture over whatsapp it comes up with an error message saying the server is unverified, or something equally ridiculous.
    I deleted the app so i could reinstall it (as if that would help), but the app store is started saying "unable to connect", despite 3G, so that bright idea died out pretty sharpish.
    Whenever i try to turn on iMessage, it asks for my Apple ID password, which I know I've typed in correctly because I reset the **** thing about 4 times due to it apparently being "incorrect". Even so, it repeatedly asks for the password over and over as soon as I've entered it, saying it was "unable to connect" before a final "incorrect password" message pops up just to add an extra smack of annoyance.
    I haven't changed a single setting on my iPhone whatsoever. It just suddenly started spiralling into what is now £28/month-worth of pure frustration.
    I don't even have any music or photos on it as I had to free up 3.5GB of space on the **** thing to allow it to update, naively thinking that would solve the problem, but alas it did not.
    I have seen a few questions posted like this one, usually just one of the problems I have, but I seem to have rounded up the whole bunch (lucky me). None of the previously posted questions have received any replies.
    Can some please help me! Honestly, if i see another "unable to..." or "unverified source" pop up again I'll probably smash the thing against the side of my house.
    Cheers.

    On your iPad, go to [Settings > General > Reset > Reset Network Settings] Once that is done, re-connect your iPad to your wifi network.

  • Hi. After I have loaded a picture into Photoshop some of the menu tools are greyed out and I cannot use the keyboard short cut, for instance I cannot use Ctrl   T to enter free transform mode. Also the toolbar is so small I cannot see the icons without ge

    Hi. After loading a picture into Photoshop some of the menu tools are greyed out and I cannot use the keyboard short cuts, for instance I cannot use Ctrl + T for free transform, how do I resolve this problem. In addition the tool Icons are so small I have to get close to the screen to see them, is there anyway the Icons can be made bigger without reducing the resolution of the screen.
    Thanks
    Derek

    Are you working on a background layer? If so, Ctrl + T will not work. Press Alt and double-click your background layer to convert to a normal layer (or right-click BG layer and select Layer from Background) and try again.
    If you're working in Photoshop CC 2014 you can go to Preferences > Experimental Features and tick "Scale UI 200% for high-density displays" to make your buttons and icons larger.

  • How do I load a picture from the clipboard (either Windows clipboard or Labview clipboard) into image data that can then be processed in Labview?

    I want to load a picture from the Windows clipboard (and if not possible, then from the Labview clipboard) into actual numerical image data so that it can be processed in lab view. When I'm at the main screen where I can add controls, I see a section of controls called "Vision" in the tool bar where all the different controls can can be added from. When I go to the control called "Image" and put that on my form, and then look at the flowchart/blockdiagram programing window to see what inputs and outputs it has, I only see one output, and no inputs. And when I right click on it, I see NO way to load an image into the Image control. PLEASE help me.
    Message Edited by Ben321 on 11-09-2008 04:32 PM

    Hi Ben,
    National Instruments has an image processing software called Vision and although I am not completely sure, I think the controls that you found in the control pallet are used in conjunction with the software. Depending on what kind of image processing you want to conduct in LabVIEW, you might want to consider purchasing that product.
    If cost is an issue, there are functions in LabVIEW which allows you to take in image files and process them. However, please keep in mind that the capabilities are limited.
    Images should be loaded onto LabVIEW not via the clipboard but through loading it from folders or directories. (There might be a way to and so if you find a way please let me know! I would like to know myself =D) If you open the function pallet by right clicking on the block diagram, in the programming folder you should find a directory called "Graphic and Sound". There, you'll find functions in which allows you to process images.
     In the "Graphic Type" directory there should be a function called Read JPEG file.vi. There are also others which allows you to read png and bmp files. Please note that there are functions which write as well. Set a file path on the block diagram and inside the "Grahic and Sound" there is a "Picture Function" directory and inside there, there should be a function called "Draw Flattened Pixmap.vi" That changes the image into a format where you can process on LabVIEW. Inside the "Picture Function" directory there are several functions which allows you to process the specified image. Play around with it and see how it goes. And don't forget to Write the file in the end to save any changes.
    I hope this helps
    National Instruments Japan
    Applications Engineer Taiki Hoshi

  • I have an I pad 2 . I have put things for sale on Craigslist but I cannot put pictures on the ad. Is there an app or so etching I need to be able to load the pictures to the ad. I also have an I phone4s same thing with it. Appreciate any info. Thanks iPad

    I have an I pad 2 . I have put things for sale on Craigslist but I cannot put pictures on the ad. Is there an app or something I need to be able to load the pictures to the ad. I also have an I phone4s same thing with it. Appreciate any info. Thanks iPad

    Yes there is; http://itunes.apple.com/app/+craigslist+/id373576667?alreadyRedirected=1&mt=8

  • I have an I pad 2 . I have put things for sale on Craigslist but I cannot put pictures on the ad. Is there an app or so etching I need to be able to load the pictures to the ad. I also have an I phone4s same thing with it. Appreciate any info. Thanks

    I have an I pad 2 . I have put things for sale on Craigslist but I cannot put pictures on the ad. Is there an app or so etching I need to be able to load the pictures to the ad. I also have an I phone4s same thing with it. Appreciate any info. Thanks

    There are Craigslist apps that are nice, but trying using copy paste. Go to your photos, select the photo. Hold down your finger on it to copy. Then in the body of the post, hold down your finger and select paste.

  • How can I get a movie that I created in IDVD to load in ITunes and stream to Apple TV?

    How can I get a movie that I created in IDVD to load in ITunes and stream to Apple TV?

    Welcome to the Apple Community.
    You can't, but you have a few alternatives.
    Best option: If you made the movie on the DVD in iMovie (or even another editing application) and still have the project, go back to the project and export it for Apple TV (using the Apple TV preset)
    Next best option: If you still have the original movie that you put on the DVD, open it in QuickTime and export it for Apple TV (using the Apple TV preset)
    Worst option: Use something like Mpegstreamclip (Quicktime Mpeg2 playback component required) to convert the DVD to h264.

  • Is it possible to load a picture into another picture

    I need to put a  symbol(save as picture A) into another picture(shown on front panel).Is it possible?which  subvi can I use?
    Thank you

    If you actually want to load the pictures from the files while the program is running, you can use the picture VIs (found in the Graphics & Sound palette). They let you load a picture from a file, place it into a container and play around with it. You can easily load 2 pictures and overlay them
    but you will have to know how to this properly. There are probably some examples in the example finder.
    Try to take over the world!
    Attachments:
    pic.GIF ‏4 KB

  • Loading a picture in button.

    This is from the help file:
    'Load a picture into the OffImage of the CWButton
    Set CWButton1.OffImage.CWImage.Picture = LoadPicture("c:\winnt\Maple Trails.bmp")
    I get an error message when I try this in VB:
    Run time error '61837'
    Unable to write read-only property
    Any suggestions?
    Paul

    Paul,
    I tried that command that you mentioned above and it seemed to work correctly. I did notice that the command you are using above will only affect the picture of the button in the "ON" state. When I tried this, the picture only appeared when I clicked and held down the mouse on the button. You can have the picture appear during the off state as well using "CWButton1.OffImage.CWImage.Picture" instead of "OnImage".
    Also, make sure you are using the Bitmap button style for your CWButton. Otherwise the button will not have an image property that you can write to.
    Another suggestion is to make sure that there is not a problem reading in the picture from the resource file. You could try modifying one of the example programs that com
    e with Visual Basic and use the resource file. There is an example called atm.vbp that loads pictures from a resource file. It might be a good idea to add in a CWButton and see if you can add one of the pictures from the resource file to the CWButton.
    I hope that helps. If you continue to see this problem, please let us know. A small sample program may help.
    Regards,
    Shannon R
    Applications Engineer
    National Instruments

  • Loading a picture with as too fast than normal loading ?

    hello,
    i want to know if loading a picture from a server with a swf
    and show it on the stage, (to show it on the web browser) is slower
    than loading the picture normally (showing it with img tag).
    thank you for your answer

    Why don't you test it out yourself?

  • Iphoto is not able to load my pictures

    Hello I have a problem while running iphoto. The program is not able to load my pictures it gets stock searching for pictures and does not displays a single image, none of the commands respond
    Can you give an advice.
    How can I reinstall this program.
    as you can see I'm not an apple expert yet.
    ilamp   Mac OS X (10.3.9)  

    Oh dear!
    Well I would start by deleting iPhoto and it's files. Do not touch the iPhoto Library folder found in the Pictures folder.
    To reinstall iPhoto...
    Navigate to /Applications and drag iPhoto to the trash
    Navigate to /Library/Receipts and drag all iPhoto receipts to the trash
    Navigate to ~/Library/Preferences and drag com.apple.iPhoto.plist to the trash.
    Look at this link and see what info pertains to you to reinstall iPhoto from your computer discs.
    How to restore your Apple software
    Mac OS X 10.4: Restoring applications from a Mac OS X 10.2 Software Restore disc
    Look all the way down the page for a downloadable version of Software restore to use in Tiger that works with your OS 10.2 computer specific software.
    Install iPhoto.
    Run Software Update and update iPhoto.
    Hopefull you will be able to open your iPhoto Library.
    Lori

  • Load a picture - crop it and save it back as jpg

    Hi,
    I need to build a flash application In which I load a jpg, make a selection of it (a mask or something like crop tool) and save it back. Loading the picture and making the mask are not a problem. What I need is some help with saving the edited picture back.
    So can you help me with this, or can you give me some tips where to look at.
    Thank you in advance!

    Hi CaioToOn!
    First of all thanks a lot for the reply. Sorry for not doing that sooner, but I wanted to explore it a little before.
    My application is almost set, load the image, made the crop, save It to a server with a php and all good until here.
    Now I want to drag the image, make a scale of it and for that I used an Matrix (also done).
    My problem came when I wanted to position the image holder on X and Y, as soon the picture loads . After doing that my new cropped image goes strange.
    I know it seams like a noob question but I'm kinda of stuck.
    Can you please take a look at my code here, because it’s drives me crazy and I can’t figure it out.
    Thanks a lot,
    Andrei

  • Stopping loaded in swf from streaming in when preloaded?

    So! Here's there no way to stop a loaded in .swf from
    streaming in, through the use of the loader, other than having a
    stop action on the first blank keyframe of the loaded in movie
    itself?
    I can always get the video to not show up, but what about
    sound? How can I keep it from being heard, streaming in, during the
    preloading process?
    Thanks in advance.

    Nevermind! Issue sorted out!
    My last question above got me thinking and I found a
    workaround!

Maybe you are looking for

  • Can`t synch IPOD classic after 1.0.2 firmware

    I just boguht an Ipod 160 GB 2 days ago. Using the firmware 1.0 I could synch anbd load about 1gb of music. The itunes asked me to update the firmware to 1.0.2 and the problems started from here. After update, the itunes freezes, and ask for not disc

  • IWeb not showing up in Applications

    Went to go mess around with Automator today and found that iWeb is not listed on the left pane under applications. Its in my applications folder and the program works fine. Just wondering if there is a simple way to get it on the list. Thanks in adva

  • Lumia 520-Internet Explorer & UC browser close aft...

    Hi, I am using nokia Lumia 520 since 15 days, I am facing problem with browsing. Both internet explorer & uc browser close abruptly in the middle of browsing after browsing for sometime. If anybody knows the solution for this problem plz let me know

  • Import, package, connection

    Here's my problem. This a second forum, first one; no answer. I think here are all the necessary information, codes are quite long... I have 3 servlets, S1, S2, S3. and a java class Data. All these servlets, classes and build.xml are in a same folder

  • How to create "n" number of items in a region?

    Hi All, I have a requirement as given below: i) I have a table like: Col1 Col2 1 ABC 1 XYZ 1 PQR 2 AA 2 BB ii) Now what I need to do that item - Check Box need to be created on a region of page based on Col2. In this case, Check Boxes should be creat