Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2004

    Unanswered: how to store Images in DB

    hi all gurus!

    i am using 9.2 and Forms 6i/Reports 6i.
    i want to store images in DB and retrieve in Forms and Reports to display and print, how i can do it???
    if any other method instead store in DB like store location/path of image and retrieve in Forms and Reports???
    please give an example this will help alot.
    thanks for the help.

  2. #2
    Join Date
    Nov 2004
    i have done it.
    for those who don't know how to store pictures / images store in database and retrieve in Form / Report.

    created a table:
    m_code number(5),
    m_name varchar2(20),
    m_pic long raw

    created a form, added a block thru Data Block Wizard and selected all fields for Data Block and also for Canvas. when done this, opened Canvas and see that Developer created an Image Box for m_pic field, added a button to insert a picture in Image Box as:

      users_image_dir VARCHAR2(80) := 'c:\users\photos\'; 
      photo_filename VARCHAR2(80); 
    :System.Message_Level := '25';
    photo_filename := users_image_dir||LOWER(:test01.m_name)||'.jpg';
    READ_IMAGE_FILE(photo_filename, 'JPG', 'test01.m_pic');
       MESSAGE('The user '||trim(:test01.m_name)||' does not have a photo on file');
    END IF;
    as you can see the value of photo_filename variable as LOWER(:test01.m_name) this means (in this example) user have to enter a valid JPG filename (without extension .jpg and complete path) as it saved on HDD path (in this case c:\users\photos is the value of user_images_dir), when user will press button the picture / image file with the given name in m_name field will be display in m_pic field (Image Box) and user can save it on database.

    in Reports simply use SQL statement to retrieve all three columns but when you completed your layout / design go to the m_pic field's property and select file type as Image and thats all.

    this is only functionality, to resize image or to change place etc. play around and you will get better ideas.

    thanks to dbforums.


  3. #3
    Join Date
    Jul 2004
    Why do you use Blob?
    You can store image data in database and easy to show image in Oracle Form and Oracle Report.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts