1. Get rid of all advertisements and get unlimited access to documents by upgrading to Premium Membership. Upgrade to Premium Now and also get a Premium Badge!

Problem in inserting pictures

Discussion in 'SQL PL/SQL' started by pgudur, Jul 22, 2009.

  1. pgudur

    pgudur Active Member

    Messages:
    18
    Likes Received:
    1
    Trophy Points:
    90
    Here i am using this procedure to insert pictures into table

    after executing procedure i am getting succefully procedure completed
    but i am unable to see the pictures in table as +ve number in respective column.

    can anyone help me regarding this please.....
    where i am going wrong here
    please help me

    Code (SQL):

    CREATE OR REPLACE PROCEDURE insert_image (p_catalogn NUMBER, p_photo VARCHAR2)
    AS
       f_photo   BFILE;
       b_photo   BLOB;
    BEGIN
       UPDATE    sh_photo
             SET picture = EMPTY_BLOB ()
           WHERE catalogn = p_catalogn
          RETURN picture
            INTO b_photo;

       f_photo := BFILENAME ('photos', p_photo);
       DBMS_LOB.fileopen (f_photo, DBMS_LOB.file_readonly);
       DBMS_LOB.loadfromfile (b_photo, f_photo, DBMS_LOB.getlength (f_photo));
       DBMS_LOB.fileclose (f_photo);
       COMMIT;
    EXCEPTION
       WHEN OTHERS
       THEN
          DBMS_OUTPUT.put_line ('**** error ***** check your procedure');
    END;
     
  2. Sadik

    Sadik Community Moderator Forum Guru

    Messages:
    1,906
    Likes Received:
    252
    Trophy Points:
    1,455
  3. pgudur

    pgudur Active Member

    Messages:
    18
    Likes Received:
    1
    Trophy Points:
    90
    Yes thank you
    I tried in several ways like this.......
    but in the table i am unable to see the pictures in the table
    what would cause is I need
    can any one help me
     
  4. rajavu

    rajavu Forum Guru

    Messages:
    815
    Likes Received:
    52
    Trophy Points:
    610
    Location:
    @ Bangalore , India
    As I meantioned in your another post, You didn't update the BLOB back to you table sh_photo once its captured in the variable in the above code.
     
  5. pgudur

    pgudur Active Member

    Messages:
    18
    Likes Received:
    1
    Trophy Points:
    90
    Hi Rajavu,
    Thanks for the reply
    I updated the table in procedure
    i am getting the same error that as it does'nt exsist

    could you please tell me what could cause for this kind of errors
    please........
     
  6. rajavu

    rajavu Forum Guru

    Messages:
    815
    Likes Received:
    52
    Trophy Points:
    610
    Location:
    @ Bangalore , India
    Just paste the SQL*PLUS session to show that the new procedure is compiled and exceted successfully and and no field is updated (Select statement) in the table.

    Please forget not to set the SERVEROUTPUT ON