Help on BFILE and lob locators.

I need to load images on my directory(IMGDIR) going to database table(T_IMG) but an error message Invalid lob locator appears. What seems to be the problem on my code, thanks
CREATE TABLE T_IMG
rec_id VARCHAR2(10 BYTE),
image BLOB,
rev_date TIMESTAMP(6),
image_name VARCHAR2(50 BYTE),
mime VARCHAR2(50 BYTE)
DECLARE
v_bfile BFILE;
v_image BLOB;
v_dot_pos NUMBER;
v_mime VARCHAR2(50);
v_filename VARCHAR2(100);
v_rec_id VARCHAR2(12);
BEGIN
v_bfile := BFILENAME('IMGDIR', v_filename);
dbms_lob.fileopen(v_bfile,dbms_lob.file_readonly);
LOOP
BEGIN
SELECT 'PIC' || TO_CHAR (images_seq.NEXTVAL, 'FM0XXXXXXX') INTO v_rec_id FROM DUAL;
v_dot_pos := INSTR(v_filename,'.');
v_mime := 'image/'||SUBSTR( v_filename,v_dot_pos+1,LENGTH(v_filename) );
INSERT INTO T_IMG (rec_id, image, rev_date, image_name, mime)
VALUES (v_rec_id, EMPTY_BLOB(), SYSTIMESTAMP, v_filename, v_mime)
RETURNING image INTO v_image;
dbms_lob.loadfromfile(v_image,v_bfile,dbms_lob.getlength(v_bfile) );
COMMIT;
EXCEPTION
WHEN no_data_found THEN
exit;
END;
END LOOP;
dbms_lob.fileclose(v_bfile);
END;
ORA-06502: PL/SQL: numeric or value error: invalid LOB locator specified: ORA-22275
ORA-06512: at "SYS.DBMS_LOB", line 635
ORA-06512: at line 12

Hi,
I have no problem with this (I removed the loop):
DECLARE
   v_bfile    BFILE;
   v_image    BLOB;
   v_dot_pos  NUMBER;
   v_mime     VARCHAR2(50);
   v_filename VARCHAR2(100) := 'test.jpg';
   v_rec_id   VARCHAR2(20);
BEGIN
   v_bfile := BFILENAME('EXT_FILES' /*'IMGDIR'*/,
                        v_filename);
   dbms_lob.fileopen(v_bfile,
                     dbms_lob.file_readonly);
   BEGIN
      SELECT 'PIC' || TO_CHAR(images_seq.NEXTVAL,
                              'FM0XXXXXXX')
        INTO v_rec_id
        FROM DUAL;
      v_dot_pos := INSTR(v_filename,
      v_mime    := 'image/' || SUBSTR(v_filename,
                                      v_dot_pos + 1,
                                      LENGTH(v_filename));
      INSERT INTO T_IMG
         (rec_id,
          image,
          rev_date,
          image_name,
          mime)
      VALUES
         (v_rec_id,
          EMPTY_BLOB(),
          SYSTIMESTAMP,
          v_filename,
          v_mime)
      RETURNING image INTO v_image;
      dbms_lob.loadfromfile(v_image,
                            v_bfile,
                            dbms_lob.getlength(v_bfile));
      COMMIT;
   EXCEPTION
      WHEN no_data_found THEN
         NULL; -- You must replace this for proper handling
   END;
   dbms_lob.fileclose(v_bfile);
END;
/Regards,

Similar Messages

  • About Lob Locators

    Could any body of u help me to understand the functions done by LOB LOCATORS and how it is used to return the Actual value of LOB Columns, as i am unable to visualize even after reading the Documentation.
    Thanks in advance
    Rajan .

    You can use a PL/SQL table of raw(32767) to transfer blob data to a remote site. Simply write a proc which reads blob into this table and pass it to remote proc which converts it back to blob.
    =============================================
    type vc_ary is table of raw(32767) index by binary_integer;
    function lob_to_ary (loc in blob) return vc_ary
    is
    ary vc_ary;
    pos integer := 1;
    len integer := DBMS_LOB.getlength (loc);
    begin
    loop
    ary(ary.count) := DBMS_LOB.substr (loc, 2000, pos);
    pos := pos + 2000;
    exit when pos > len;
    end loop;
    return ary;
    end;
    procedure ary_to_lob (loc in out nocopy blob, ary in vc_ary) is
    begin
    if ary.count > 0 then
    for j in ary.first..ary.last loop
    DBMS_LOB.writeappend (loc, length (ary(j)), ary(j));
    end loop;
    end if;
    end;
    null

  • PL/SQL: ORA-22992: cannot use LOB locators selected from remote tables

    Dear ALL,
    My O/S is Redhatlinux 5.2 and i had Migrated my Oracle databse to 11g2. But after that while i am retrieving records through dblinks from one of my other Oracle 9.2.0.8 databse it's throwing the error : PL/SQL: ORA-22992: cannot use LOB locators selected from remote tables.* This error i am getting in TOAD as well as SQL Developer.
    Can anybody tell me how to fix this error ? Because am not able to get the records.
    Also am getting another error during retrieving data from some of my tables after migrating i.e the table which having CLOB data type while am accessing to retrieve the records using select query it's throwing the error :
    +(The following error has occurred:+
    A query with LOB's requires OCI8 mode, but OCI7 mode is used.)
    If anyone having any idea kindly share.
    Thanks and Regards
    Biswa

    Hi,
    Ya what u sent that is fine. But already am using one procudure which is accessing LOB data from another databse through DBlink and working fine. But there Both the databse are 9.2.0.8.
    But while am executing the same procedure in oracle 11g where the Dblink accessing the data from Oracle 9i , there am getting this error.
    Kindly tell if u know any resolution.
    Thanks

  • LOB locators cannot span transactions

    Hi,
    I'm trying to call an Oracle stored procedure with one of the parameters being a Clob.
    First I select a clob from a temporary table, manipulate it and then call the stored procedure.
    I always get the error "java.sql.SQLException: ORA-22990: LOB locators cannot span transactions"
    Until then neither the Oracle Connection nor the Statement are closed.
    Here's the part of code:
    // get the CLOB
    String sql = "SELECT XMLDOC,DOCNAME FROM XML_DOCUMENTS WHERE DOCNAME = 'Auftrag_2001-00018.xml' FOR UPDATE";
    stmt = oracleConnection.createStatement();
    ResultSet rs = stmt.executeQuery(sql);
    while (rs.next()) {
    ClobOut = (CLOB)rs.getObject("XMLDOC");
    // Call the stored procedure
    OracleCallableStatement cs = (OracleCallableStatement) oracleConnection.prepareCall("begin ? :=setAuftrag(?,?); end;");
    cs.registerOutParameter(1, Types.INTEGER);
    cs.setString(2,"tmp_schaetzauftrag");
    cs.setClob(3, ClobOut);
    cs.execute();

    I'm afraid yout solution won't work for me
    I need to send the contents of an xml file to this stored procedure. The procedure contains a mechanism to store the data from the xml file into different tables.
    Since I cannot create a new CLOB in Java I take an existing one, change it and send it to the stored procedure.
    If I had only one procedure with a Clob as Parameter I would store it in a temporary table and access it from the procedure itself, but I already have several existing procedures that need an Clob so I was looking for a way to do it without having to change them.

  • EXCEPTION: ORA-22990: LOB LOCATORS CANNOT SPAN TRANSACTIONS

    We hit a brand new BPEL error during Volume Test:
    EXCEPTION: ORA-22990: LOB LOCATORS CANNOT SPAN TRANSACTIONS
    Anyone seen this ? The OC4J BPEL java process started to consume vast amounts of CPU but I'm not sure if this was the cause of effect. I'm sort of hoping it was the result of this error - if it isn't we have another root cause to try and figure out! We're using BPEL 10.1.2.0.2.
    Rob J

    sorry for the delay, i was not checking the otn forum for a while.
    Do you see any other errors before this LOB errors in the log file? This is important, you should see some errors (e.g. cmt error or some other error related to jta transaction)
    we had this lob locater issue in 10.1.2.0.0 and a mandatory oc4j patch is available for 10.1.2.0.0.
    But if you are using 10.1.2.0.2 the patch should be included but i suspect the patch is not taking effect because patch gets applied after the bpel ejb-bean class generation.
    the solution
    -remove the application-deployments/orabpel directory completely (just to be safe...please backup before delete)
    - restart the server with -DKeepWrapperCode=true system property in opmn.xml for OC4J_BPEL, this flag would generate stub .java files under j2ee/home or j2ee/home/application-deployments/orabpel/generated directory
    - please upload these regenerated java files to SR
    this will force to regenerate the bpel ejb stub classes which should fix this issue.

  • I need help to find and open a job app that I exported, was able to fill out and sign and saved and now can't open it? What did I do wrong?

    I need help to find and open a job app that I exported, was able to fill out and sign and saved and now can't open it? What did I do wrong?

    What file format did you export it to?

  • HT4623 please help - installed IOS7 and now I am having problems playing Words Free on my Iphone.  It gives me a pop up telling me to connect to ITunes but will not connect.  Cannot get out and have to continually shut down my phone and start over.

    please help - installed IOS7 and now I am having problems playing Words Free on my Iphone.  It gives me a pop up telling me to connect to ITunes but will not connect.  Cannot get out and have to continually shut down my phone and start over.

    Hi, jeantwin.
    Thank you for visiting Apple Support Communities.
    The steps in the article below may help you resolve the issue with push notifications.
    iPad and iPod touch: Unable to use YouTube or Push notifications
    http://support.apple.com/kb/ts3305
    If the issue persists, try signing out of your Apple ID and then sign back in.
    iOS: Changing the signed-in iTunes Store Apple ID account
    http://support.apple.com/kb/HT1311
    Cheers,
    Jason H.

  • Does any update help to install and run myFaces components?

    Hi.
    I have JSC trial. And didn't make update.
    I can't install myFaces component library. Why?
    Does any update help to install and run myFaces components, and other component library?
    Thanks.

    Hi,
    The following thread could be of help for you:
    http://swforum.sun.com/jive/thread.jspa?forumID=123&threadID=48666
    Cheers :-)
    Creator Team

  • Need help to import and syncronize HCM pagelets with Interaction Hub, how can I do that?

    Hi,
    I need help to import and synchronize HCM pagelets with Interaction Hub, how can I do that? The default page "Select Remote Content" of the WorkCenter "Unified Navigation WorkCenter" is not working as well, when I run the import/sync button I get the following error message:
    Integration Gateway: General Connection Failed (158,10836)
    This error is thrown when there is no valid response.
    Possible errors include:
    Bad gateway URL
    Sync Service Timeout set and Service actually timed out.
    Java exception thrown - Check Application Server for possible Java exception

    Do you have integration configured between the two systems?  It sounds like you don't from the error.  Here is a walk-through on setting up Unified Navigation although it assumes you have integration already working.  If you haven't done that, it's documented a hundred different places.
    http://remotepsadmins.com/2013/03/04/peoplesoft-unified-navigation-with-peoplesoft-applicatations-portal-interaction-hub/

  • My account is locked, i cant remember my security question, and I accidentally entered my itunes card in here instead of my other account, so can someone from apple help me out and fix my account

    my account is locked, i cant remember my security question, and I accidentally entered my itunes card in here instead of my other account, so can someone from apple help me out and fix my account (and no, i dont have any rescue email address or whatsoever)
    please help me because i dont to waste money for nothing

    Alternatives for Help Resetting Security Questions and/or Rescue Mail
         1. If you have a valid rescue email address, then use this procedure:
             Rescue email address and how to reset Apple ID security questions.
         2. Fill out and submit this form. Select the topic, Account Security. You must
             have a Rescue Email to use this option.
         3. This is the only option if you do not already have a valid Rescue Email.
             These are telephone numbers for contacting Apple Support in your country.
             Apple ID- Contacting Apple for help with Apple ID account security. Select
             the appropriate country and call. Ask to speak to the Account Security Team.
         4. Account security issues almost always require you to speak directly to an
             Apple representative to securely establish your identity as the account holder.
             You can set it up so that Apple calls you, either immediately or at a time
             convenient to you.
                1. Go to www.apple.com/support.
                2. Choose Contact Support and click Contact Us.
                3. Choose Other Apple ID Topics and choose the appropriate topic for
                    your issue.
                4. Follow the onscreen instructions.
             Note: If you have already forgotten your security questions, then you cannot
             set up a rescue email address in order to reset them. You must set up
             the rescue email address beforehand.
    Your Apple ID: Manage My Apple ID.
                            Apple ID- All about Apple ID security questions.

  • Help with writing and retrieving data from a table field with type "LCHR"

    Hi Experts,
    I need help with writing and reading data from a database table field which has a type of "LCHR". I have given an example of the original code but don't know what to change it to in order to fix it and still read in the original data that's stored in the LCHR field.
    Basically we have two Function modules, one that saves list data to a database table and one that reads in this data. Both Function modules have an identicle table which has an array of fields from type INT4, CHAR, and type P. The INT4 field is the first one.
    Incidentally this worked in the 4.7 non-unicode system but is now dumping in the new ECC6 Unicode system.
    Thanks in advance,
    C
    SAVING THE LIST DATA TO DB
    DATA: L_WA(800).
    LOOP AT T_TAB into L_WA.
    ZDBTAB-DATALEN = STRLEN( L_WA ).
    MOVE: L_WA to ZDBTAB-RAWDATA.
    ZDBTAB-LINENUM = SY-TABIX.
    INSERT ZDBTAB.
    READING THE DATA FROM DB
    DATA: BEGIN OF T_DATA,
                 SEQNR type ZDBTAB-LINENUM,
                 DATA type ZDBTAB-RAWDATA,
               END OF T_TAB.
    Select the data.
    SELECT linenum rawdata from ZDBTAB into table T_DATA
         WHERE repid = w_repname
         AND rundate = w_rundate
         ORDER BY linenum.
    Populate calling Internal Table.
    LOOP AT T-DATA.
    APPEND T_DATA to T_TAB.
    ENDLOOP.

    Hi Anuj,
    The unicode flag is active.
    When I run our report and then to try and save the list data a dump is happening at the following point
    LOOP AT T_TAB into L_WA.
    As I say, T_TAB consists of different fields and field types whereas L_WA is CHAR 800. The dump mentions UC_OBJECTS_NOT_CONVERTIBLE
    When I try to load a saved list the dump is happening at the following point
    APPEND T_DATA-RAWDATA to T_TAB.
    T_DATA-RAWDATA is type LCHR and T_TAB consists of different fields and field types.
    In both examples the dumps mention UC_OBJECTS_NOT_CONVERTIBLE
    Regards
    C

  • My Macbook is not working properly, I went to a Genius Bar appointment, they were not helpful at all and just told me to go off and reboot my Mac and then restore via TimeMachine. I dont know how to do this. I am extremely displeased with Apple, help me?

    My late 2011 Macbook Pro is not working properly it is very slow and extremely painful to use, I went to a Genius Bar appointment, they were not helpful at all and just told me to go off and reboot my Mac and then restore via TimeMachine. I dont know how to do this. I am extremely displeased with Apple at the moment, can someone please help me?

    Your problem description is generalized and non-specific. I would make another appointment at the Apple store and insist they help you execute their suggested fixes.
    Incidentally, if you search this site, Apple has excellent articles re: restoring a system.
    Barry

  • HT1926 hey guys,i tried to install the latest version of itunes but when i try to open it,it just comes up windows error 2 apple application support was not found,can anyone help me out and tell me what i need to do pls ?

    hey guys,i tried to install the latest version of itunes but when i try to open it,it just comes up windows error 2 apple application support was not found,can anyone help me out and tell me what i need to do pls ?

    If you run into the "another installation" message even after the reboot of the PC (which is an excellent idea by HTP ProXy), reregistering your Windows Installer Service is worth a try.
    First, launch a command prompt as an administrator. In your Start search, type cmd then right-click on the cmd that comes up and select "Run as administrator".
    At the command prompt:
    Type %windir%\system32\msiexec.exe /unregister and hit enter.
    Type %windir%\syswow64\msiexec.exe /unregister and hit enter.
    Type %windir%\system32\msiexec.exe /regserver and hit enter.
    Type %windir%\syswow64\msiexec.exe /regserver and hit enter.
    Restart the PC and try another reinstalll.

  • Using Search Help with ALV and Dynamic context node

    The topic subject already describes my situation.
    I have to create, populate and remove context nodes at runtime, and bind them to an ALV, to let user display the data or modify the data. The nodes I create are always typed with a table name, but the table name is of course, dynamic.
    This is all working: what's not working is help for entries inside the ALV; since the table has foreign keys and domains with check tables or fixed values, I expected that search helps were detected and managed by the framework.
    Instead, no help search is displayed except the input help based on data-type of the one "Date" input fields.
    I think I have to work on the dynamic node creation, and not on the ALV itself, since the latter only takes the node/attributes information, but i could be wrong. I tried with both the two following codings:
      CALL METHOD lo_nd_info_root->add_new_child_node
        EXPORTING
          static_element_type          = vs_tabname
          name                         = 'SAMPLE_NODE_NAME'
    *    is_mandatory                 = abap_false
    *    is_mandatory_selection       = abap_false
         is_multiple                  = abap_true
         is_multiple_selection        = abap_false
    *    is_singleton                 = abap_false
          is_initialize_lead_selection = abap_false
          is_static                    = abap_false
        RECEIVING
          child_node_info              = lo_nd_info_data .
    cl_wd_dynamic_tool=>create_nodeinfo_from_struct(
          parent_info = lo_nd_info_root
          node_name = 'SAMPLE_NODE_NAME'
          structure_name = vs_tabname
          is_multiple = abap_true ).
    The result is the same...is there any way to let the ALV know what search helps it has to use, and doesn't force me to manually build a VALUE_SET to be bound on the single attributes? There are many tables, with many fields, and maintaining this solution would be very costly.

    I have checked with method GET_ATTRIBUTE_VALUEHELP_TYPE of interface IF_WD_CONTEXT_NODE_INFO, on an attribute which i know to have a search help (Foreign key of a check table).
    The method returns 'N', that is the constant IF_WD_VALUE_HELP_HANDLER~CO_VH_TYPE_NO_HELP. So, the framework was not able to find a suitable search help.
    Using method GET_ATTRIBUTE_VALUE_HELP of the same interface, on the same attribute, returns me '111', which is constant C_VALUE_HELP_MODE-AUTOMATIC.
    Therefore, the WD framework knows it has to automatically detect a value help, but fails to find one.
    Also, this means in my opinion that the ALV and the dynamic external mapping are not the culprits: since node creation, no help is detected for any attribute but the date. Honestly, I don't have a clue on what's happening.

  • Tax with the help of idoc and EDI

    Dear gurus,
    how can we process tax data that is used between two systems through the help of IDOC and EdI? It would be great for ur kind support.

    Hi Amit,
         I do not understand how a non-sap system having an idoc adapte?
    Do you mean the non-sap system has the ability to understand the IDOC files?
    If yes, then your scenario is typically a IDOC-to File scenario.
    Read this:
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/e07dcaa0-a92b-2a10-3a96-b3d942bd1539
    If you do not intend to use XI in between, then you can just configure the outbound IDOCs in your SAP system and configure a file port in we21 transaction and create the partner profile in we20 transaction.
    Regards,
    Ravi

Maybe you are looking for