Images into db, what's wrong?

Hi,
I'm still trying to fetch some images into my database, gif or jpeg, but I have some problems. I used the following code but it gives me a compile error. I don't understand why! EXEC does'nt work.
CREATE TABLE MY_IMAGES_DB(
id NUMBER(10) NOT NULL,
name VARCHAR2(50) NOT NULL,
image BLOB NOT NULL
ALTER TABLE IMAGE_CBR.MY_IMAGES_DB ADD (
CONSTRAINT images_pk PRIMARY KEY (id)
ALTER TABLE IMAGE_CBR.MY_IMAGES_DB ADD (
CONSTRAINT images_uk UNIQUE (name)
CREATE SEQUENCE images_seq1;
CREATE OR REPLACE DIRECTORY image_dir AS 'C:\IMAGES';
CREATE OR REPLACE PACKAGE Images_API AS
PROCEDURE Load (p_name IN IMAGE_CBR.MY_IMAGES_DB.name%TYPE);
PROCEDURE Get (p_name IN IMAGE_CBR.MY_IMAGES_DB.name%TYPE,
p_type IN VARCHAR2 DEFAULT 'gif');
PROCEDURE Get_Gif (p_name IN IMAGE_CBR.MY_IMAGES_DB.name%TYPE);
PROCEDURE Get_Jpeg (p_name IN IMAGE_CBR.MY_IMAGES_DB.name%TYPE);
END;
CREATE OR REPLACE PACKAGE BODY Images_API AS
PROCEDURE Load (p_name IN IMAGE_CBR.MY_IMAGES_DB.name%TYPE) IS
v_bfile BFILE;
v_blob BLOB;
BEGIN
INSERT INTO IMAGE_CBR.MY_IMAGES_DB (id, name, image)
VALUES (images_seq1.NEXTVAL, p_name, empty_blob())
RETURN image INTO v_blob;
v_bfile := BFILENAME('image_dir', p_name);
Dbms_Lob.Fileopen(v_bfile, Dbms_Lob.File_Readonly);
Dbms_Lob.Loadfromfile(v_blob, v_bfile, Dbms_Lob.Getlength(v_bfile));
Dbms_Lob.Fileclose(v_bfile);
COMMIT;
EXCEPTION
WHEN OTHERS THEN
ROLLBACK;
RAISE;
END;
PROCEDURE Get (p_name IN IMAGE_CBR.MY_IMAGES_DB.name%TYPE,
p_type IN VARCHAR2 DEFAULT 'gif') IS
v_blob BLOB;
v_amt NUMBER := 30;
v_off NUMBER := 1;
v_raw RAW(4096);
BEGIN
SELECT image
INTO v_blob
FROM IMAGE_CBR.MY_IMAGES_DB
WHERE name = p_name;
Owa_Util.Mime_Header('image/' || p_type);
BEGIN
LOOP
Dbms_Lob.Read(v_blob, v_amt, v_off, v_raw);
Htp.Prn(Utl_Raw.Cast_To_Varchar2(v_raw));
v_off := v_off + v_amt;
v_amt := 4096;
END LOOP;
EXCEPTION
WHEN NO_DATA_FOUND THEN
NULL;
END;
END;
PROCEDURE Get_Gif (p_name IN IMAGE_CBR.MY_IMAGES_DB.name%TYPE) IS
BEGIN
Get (p_name, 'gif');
END;
PROCEDURE Get_Jpeg (p_name IN IMAGE_CBR.MY_IMAGES_DB.name%TYPE) IS
BEGIN
Get (p_name, 'jpeg');
END;
END;
EXEC Images_API.Load('sun201.gif');
Can someone help me?
Thanks

Hi,
I'm still trying to fetch some images into my database, gif or jpeg, but I have some problems. I used the following code but it gives me a compile error. I don't understand why! EXEC does'nt work.
CREATE TABLE MY_IMAGES_DB(
id NUMBER(10) NOT NULL,
name VARCHAR2(50) NOT NULL,
image BLOB NOT NULL
ALTER TABLE IMAGE_CBR.MY_IMAGES_DB ADD (
CONSTRAINT images_pk PRIMARY KEY (id)
ALTER TABLE IMAGE_CBR.MY_IMAGES_DB ADD (
CONSTRAINT images_uk UNIQUE (name)
CREATE SEQUENCE images_seq1;
CREATE OR REPLACE DIRECTORY image_dir AS 'C:\IMAGES';
CREATE OR REPLACE PACKAGE Images_API AS
PROCEDURE Load (p_name IN IMAGE_CBR.MY_IMAGES_DB.name%TYPE);
PROCEDURE Get (p_name IN IMAGE_CBR.MY_IMAGES_DB.name%TYPE,
p_type IN VARCHAR2 DEFAULT 'gif');
PROCEDURE Get_Gif (p_name IN IMAGE_CBR.MY_IMAGES_DB.name%TYPE);
PROCEDURE Get_Jpeg (p_name IN IMAGE_CBR.MY_IMAGES_DB.name%TYPE);
END;
CREATE OR REPLACE PACKAGE BODY Images_API AS
PROCEDURE Load (p_name IN IMAGE_CBR.MY_IMAGES_DB.name%TYPE) IS
v_bfile BFILE;
v_blob BLOB;
BEGIN
INSERT INTO IMAGE_CBR.MY_IMAGES_DB (id, name, image)
VALUES (images_seq1.NEXTVAL, p_name, empty_blob())
RETURN image INTO v_blob;
v_bfile := BFILENAME('image_dir', p_name);
Dbms_Lob.Fileopen(v_bfile, Dbms_Lob.File_Readonly);
Dbms_Lob.Loadfromfile(v_blob, v_bfile, Dbms_Lob.Getlength(v_bfile));
Dbms_Lob.Fileclose(v_bfile);
COMMIT;
EXCEPTION
WHEN OTHERS THEN
ROLLBACK;
RAISE;
END;
PROCEDURE Get (p_name IN IMAGE_CBR.MY_IMAGES_DB.name%TYPE,
p_type IN VARCHAR2 DEFAULT 'gif') IS
v_blob BLOB;
v_amt NUMBER := 30;
v_off NUMBER := 1;
v_raw RAW(4096);
BEGIN
SELECT image
INTO v_blob
FROM IMAGE_CBR.MY_IMAGES_DB
WHERE name = p_name;
Owa_Util.Mime_Header('image/' || p_type);
BEGIN
LOOP
Dbms_Lob.Read(v_blob, v_amt, v_off, v_raw);
Htp.Prn(Utl_Raw.Cast_To_Varchar2(v_raw));
v_off := v_off + v_amt;
v_amt := 4096;
END LOOP;
EXCEPTION
WHEN NO_DATA_FOUND THEN
NULL;
END;
END;
PROCEDURE Get_Gif (p_name IN IMAGE_CBR.MY_IMAGES_DB.name%TYPE) IS
BEGIN
Get (p_name, 'gif');
END;
PROCEDURE Get_Jpeg (p_name IN IMAGE_CBR.MY_IMAGES_DB.name%TYPE) IS
BEGIN
Get (p_name, 'jpeg');
END;
END;
EXEC Images_API.Load('sun201.gif');
Can someone help me?
Thanks

Similar Messages

  • By saving for web text-layer becomes a image in HTML what is wrong?

    By saving for web text-layer becomes a image in HTML what is wrong? In this way I can not use CSS in the editor.

    Right click on the layer, Duplicate Layer, set destination to the other image file in the dropdown.

  • Freehand into flash what is wrong ?

    Are there known issues with Freehand files opening into
    Flash, I find small circles (2mm downwards) take on a squarish look
    and a straight pecked line is no longer straight but now has
    straight sections in a zigzag way, (start and end points are as in
    FH file). What settings do I need to alter. No one on the flash
    forum has responded in weeks. Surely two progs both vector based
    should be able to communicate better than this by the same company
    ? FH9 and FHMX with Flash 2004 and latest patches.
    Envirographics

    DJRichCT.
    Thanks for replying,..no special effect with the circles, I
    even did a test page, file new, draw a small circle and make it
    0.1mm and 2mm diameter and get a suarish circle in flash.
    quote:
    For example, a dashed line in FH will not go in as a dashed
    line in Flash.
    So dashed lines cannot be taken into Flash, (well not without
    geting bent, as I see dashed lines ) ...thats a real total
    gut-wrenching let-down as I have technical drawings that require
    them to show hidden details, engineering drawing style. Basically
    then that shoots down all my hopes. Just trying here to get my FH
    files into CAD, also my mapwork, flash was the only option left to
    me for the engineering type drawings. For many of us £1000 or
    more of autocad is prohibitive for unpaid aviation plan drawing as
    can be seen in many magazines, involving years of research. Some of
    this is now required for aircraft building and I am left with
    creating jpgs of my work and the client using a printout, not quite
    PC to PC, and unable to use my demo CAD progs I am trying out on my
    own work. Stepping stone it via Illustrator failed the tests also.
    I just cant believe why Corel and Adobe allow CAD export and
    Macromedia not, and now they never will. Years of work to redo but
    what I see of Illustrator and its layers and guides, I need
    Freehand still for the work type !
    Makate, you say you are not seeing any problems dashed into
    Flash, this doesnt equate with DJRichCT ?
    I find the problem is evident at smaller sizes, circles 1mm
    diameter certainly exhibit it and dashed lines 3mm or 6mm long
    looking at the test just done go bent.
    Can a few peeps reading this try this test, draw a 3mm
    diagonal dashed line, then place the corners of a few solid line
    boxes touching that line, now do they still touch when imported
    into flash, is the line dead straight ?
    Also draw a 1mm solid line circle, import to flash, is it a
    perfect circle or flat sided ? use 0.1mm line weight for clarity.
    PC or Mac, what OS ?
    Cheers
    Envirographics

  • I can't see the raw thumbnail image when in download them to bridge.  what is wrong

    I can't see the raw thumbnail images when I download them into bridge what is wrong?

    What model camera?  for example: Nikon D50
    What version of Bridge? PC or Mac?
    What version of Adobe Camera Raw is installed? 
    Gene

  • I don't see my images when I publish, what's wrong?

    I created an app using Excel and everything works fine on my local machine. But when I publish all my images are missing, what's wrong?
    --Ben

    If you've included your assets locally (for example, coming from Excel) then when you publish remember to select "Publish resources locally". This option packages everything together in your app, including the local files on your computer.
     For more details on publishing, check out the end of our
    AdventureWorksTo video.
    --Ben

  • Trying to add album from iphoto into idvd slideshow.  Not all photos are loading.  Message "creating thumbnail images...(31 remaining).  Been there a long time.  What is wrong?

    trying to add album from iphoto into idvd slideshow.  Not all photos are loading.  Message "creating thumbnail images...(31 remaining).  Been there a long time.  What is wrong?

    Open your iPhoto Library, go to that particular album and verify that you can view the full sized version of each image by double clicking on them.  Report back with the results.
    OT

  • Edge Animate Ellipses Changing into Squares in Indesign preview play. What's wrong?

    Edge Animate Ellipses Changing into Squares in Indesign preview play. What's wrong? Previewing on a PC desktop.

    I'm using a OAM file. Placing it as I would an image. In EA, I grouped an ellipse with a text box and then applied the fade on effect to the group. Each fades on as the timeline progresses. I hope that answers your question. let me know if not. I also tried to ungroup the two layers and apply the fade to each individually but it produced the same effect in the content viewer.

  • HT2531 Spotlight lists items and shows preview images.  BUT what about showing the location address of an item in my computer. Especially important if I've put the item in the wrong folder and what to locate it without multi-steps. iMac OS 10.5 was more u

    Spotlight lists items and shows preview images.  BUT what about showing the path/location address of an item in my computer.
    Especially important if I've put the item in the wrong folder and what to locate it without multi-steps. iMac OS X 10.5 was more useful.
    Old OSX Spotlight function automatically displayed path/location within the machine:  e.g. desktop/folder/sub-folder/item.
    Can I make Spotlight show the path?

    Press option-command and the path is displayed at the bottom of the little preview window.  Press command-return and the enclosing folder opens. 

  • Hi my iph4s wont turn on or off and seems to be zoomed into a particular part of the screen, loads normally when rebooted the phone. what is wrong with it? and how would i go abouts fixing it?thanks

    hi my
    iph4s wont turn on or off and seems to be zoomed into a particular part of the screen, loads normally when rebooted the phone. what is wrong with it? and how would i go abouts fixing it?
    also recovery mode shows up as a red icon instead of a blue one, not jail broken or had any third party alterations
    thanks

    Reset the PRAM
    Reinstall the operating system from the dvd (you will not loose your data)

  • My Time machine won't back up.  Recently updated to OS x 10.7.5.  Error message is as follows:  "The backup disk image "/Volumes/Time Machine Backup/Scott's MacBook Pro.sparsebundle" is already in use."  What is wrong and how do I fix it?  Thanks.

    My Time machine won't back up.  Recently updated to OS x 10.7.5.  Error message is as follows:  "The backup disk image “/Volumes/Time Machine Backup/Scott’s MacBook Pro.sparsebundle” is already in use."  What is wrong and how do I fix it?  Thanks.

    Have you tried restarting the computer? Also, see Time Machine Error from this pages sidebar under More Like This.

  • TS1363 My iPod doesn't turn on anymore. Even when I plug it into the computer or a charger, nothing happens. What's wrong with my iPod?

    My iPod doesn't turn on anymore. Even when I plug it into the computer or a charger, nothing happens. What's wrong with my iPod?

    If you get an network timed out error, try disabling the security software on your computer.

  • I tried to import a PDF of a line drawing into Photoshop Elements. The thumbnail looks fine, but when imported the file is empty. This used to work in the past. What is wrong and how do I solve this?

    I tried to import a PDF of a line drawing into Photoshop Elements. The thumbnail looks fine, but when imported the file is empty. This used to work in the past. What is wrong and how do I solve this?

    Hi
    The value of the Channel Strip volume etc is not stored within the C Strip setting, as you have discovered.
    If you really wanted, you could add a Gain plug to the strip, with it set to give the correct output level with the Fader set to 0
    (Or just set the fader manually in MS)
    CCT

  • When logging into iCloud in Safari, Calendar doesn't display any events. They are displayed on the iPad, iPhone on even the iCal. What is wrong ?

    When logging into iCloud in Safari, Calendar doesn't display any events. They are displayed on the iPad, iPhone on even the iCal. What is wrong ?

    :S,
    Sorry, missed that fact. My memory is good, but short.
    Try moving the "Calendar Cache" file to your Desktop. Quit iCal, and find the "Calendar Cache" file in your Macintosh HD/Users/yourusername/Library/Calendars. Move that file to your Desktop. After that, (I remember that I recommended this before), as long as you are moving files to the Desktop, repeat the plist removal procedure once again, log out/in or restart.
    You should also consider removing the "To Do's" from Mail before restarting iCal. When you open iCal turn off "Show Birthdays calendar" in iCal>Preferences...>General.
    Are you syncing any data? If so, what method(s) are you using?
    ;~)

  • I can't drag my songs into playlists, or arrange them on a playlist. What's wrong?

    I can't drag my songs into playlists, or arrange them on a playlist. What's wrong?

    I have about 50 playlists that I created as playlists and have always been able to add songs to as I purchased them. The lists were originally created as regular playlists. Then, one day I opened up iTunes and all the existing playlists I had created as playlists, and has always added songs to, had the "gear" symbols and acted like genius playlists. How can I change them back and why did this happen...any ideas?

  • What is the best format to import images into iBA? How should I compress my images before importing? What is the best file format? PNG? Jpeg?

    What is the best format to import images into iBA? How should I compress my images before importing? What is the best file format? PNG? Jpeg? I'm trying to figure out the best file format / compression for importing images into iBA. Also, does anyone know how iBA will compress the file? Are the assets attached (like a website) or flattened out? Does anyone know how iBA handles this? Many many thanks to anyone with insight into this.

    This question is largely answered by the following thread...
    https://discussions.apple.com/message/17805700#17805700

Maybe you are looking for