Quering on blob fields that contain XML

Hi All,
I need to query on blob fields that contain XML data. So I wanna say give me XML docs where ELEMENT[@ATTRIBUTE='VALUE']. So, I need to be able to query on attributes. Is there any way to do that?
Thanks.

Thanks for the attempt, but tried what you suggested and it will only pull records where the Asterisk is the ONLY character in that data field.
Maybe I wasn't clear enough.
I have in access of 200,000 records in KNA1, out of which some of them have one or more * values in the some of the fileds, eg: Comany ABC At XXXX road Workshop  is stored in the Name 1 field, I want all records like this where * is one of the characters in that field.
May have to download the entire lot and use Excel to filter.

Similar Messages

  • Velocity Template that contains XML

    I have found an annoying issue with .vm velocity template files that contain XML within JDeveloper 10.1.3.0.4 (SU3). The .vm file is being picked up as an XML file and XML validation is failing due to the velocity commands. This is stopping me building the application. The issue is due to the first line containing <?xml version="1.0" encoding="UTF-8"?>.
    I have a work around with the following as the first lines of .vm file.
    #set($foo = '<?xml version="1.0" encoding="UTF-8"?>')
    $foo
    Is there a way to associate .vm files with a velocity syntax checker such as the VelocityWebEdit plug in for eclipse? (https://sourceforge.net/project/showfiles.php?group_id=126011)

    Preloaders tend to sit in the first few frames of a timeline,
    If you are using any of the XML component objects then they
    have to be also registered in the first frame so that their
    respective bindings can be set before use.

  • Search for  a big varchar2 field that contains specific string

    Hi to all,
    I've created a table with VARCHAR2 column and size of 4000 and a CONTEXT index for it. I use this SQL statement to search for a field that contains a specific word:
    SELECT text_body
    FROM my_table
    WHERE CONTAINS(text_body,'my_word')>0;
    this goes so well in SQL plus, so how can I implement this in my form?
    Thanks.

    Dear Craig,
    I installed forms 10g R2 ,besides I corrected a fault in the LOOP syntax.Thanks, The code now is correct with the function CONTAINS. but when I run my form and push the button, my form takes lots of time and return two errors:
    frm-41839 "Disc I/O error on temporary record buffer file%s".
    and frm-40900 "Unable to locate record buffer. Clear form to continue".
    the second error occurs due to memory low space I think.
    Dear Morgan,
    You are totally right with the function INSTR, but I use the function CONTAINS as it has large capabilities in my search. I even use CTXCAT index instead of CONTEXT index ,with function CATSEARCH but the problem still exists. All of the previous ways run better in SQL but not in forms(without cursor). Suppose I'm wrong with this technique. Is there another way to make such a search?!
    This is the new code:
    DECLARE
         CURSOR cc IS
    SELECT *
    FROM my_table
    WHERE CONTAINS(MY_TEXT_FIELD,'first_word AND second_word')>0;
    copy_cc my_table%rowtype;
    BEGIN
         OPEN cc;
         FETCH cc INTO copy_cc;
              LOOP
              :FORM_TEXT_FIELD:=copy_cc.my_text_field;
         EXIT WHEN cc%notfound;
              NEXT_RECORD;
              END LOOP;
              CLOSE cc;
    END;
    Regards.
    Waleed.

  • Can we use BLOB fields (that store images) in Crystal Report ?

    I'm developing with ASP.NET, VS.NET 2003.
    Using Crystal Report for VS.NET
    DataBase: Oracle 10g
    I store a BLOB field in a table. This field store images, like jpg files.
    The Stored Procedure that I use to fill the report is:
    OPEN MyCursor FOR
    SELECT MyId , MyImg
    FROM MyTable
    MyImg is BLOB field
    However, when I try to use the stored procedure in Crystal Report at design mode, any field can be displayed and then drag and drop to the report, but MyImg is not possible.
    There is an error message:
    Details: ADO Error Code: 0x80004005
    Source: Microsoft OLE DB Provider for Oracle
    Description: Data type is not supported
    I'm afraid that is not so easy for me to change DB connector drivers.
    My question is:
    - Is it possible to use BLOB fields in Cyrstal Reports?
    - Or should I convert them previously to something, so they can be displayed in Crystal Report at desing mode ?
    - If I should change DB connector drivers, which one should I use and from where should I download it and then install it in my Web Server?
    Thank you very much!

    Hi,
    I dont know much at all about CR, but I do know Microsoft's OLEDB Provider for Oracle doesnt support Blob datatype.. http://support.microsoft.com/kb/q244661/
    Oracle's OLEDB provider does though, you can get it as part of the ODAC download on OTN.
    Hope that helps,
    Greg

  • Visio Drawing Using Data Graphics with data that has a field that contains Multiple Values.

    I am working on creating a drawing for SMTP connectors.  I decided I would use a Data Graphic connecting to a spreadsheet.  In the spreadsheet there are a few fields that are Multi-Value fields.  For instance SmartHosts contains multiple Ip
    address.  I am trying to get this to format things so that the IPs show on the next line down instead of continuing on the same line until it wraps. 
    Does anyone know a way I could do this?
    Jeff C

    Hi Jeff,
    Arrange the IP values in spreadsheet using Alt+Enter (Use this key pair as a separator between two IP values). Now link this spread sheet to Visio. The values should appear in the same manner in data graphics as your expectation.
    Let me know if you meant something else.
    Thanks,
    Dheeraj 

  • Creating a form with a field that contains a simple math problem.

    I am creating a form in Acrobat 9 Standard that contains a field that requires a simple math function (divide).
    if (QuantityRow1 > 0)
    ExtensionRow1 / QuantityRow1
    Take the value input in ExtensionRow1 and divide it by the value in QuantityRow1. I have included an IF statement to prevent an error that occur if QuantityRow1 were equal to zero.
    After inputting the data into the two fields I tab past the field where I expect to see my result and the field remains blank. I don't receive any error messages.
    Any ideas? Thanks - jb

    This is a duplicate of your question on Acrobatusers.com (
    http://answers.acrobatusers.com/Need-simple-math-operation-function-Acrobat-9-Standard-cre ating-form-q142800.aspx
    Did the information provided there not help you with your problem?
    Karl Heinz Kremer
    PDF Acrobatics Without a Net
    PDF Software Development, Training and More...
    [email protected]
    http://www.khkonsulting.com

  • Creating interMedia substring index on a CLOB that contains XML

    I have a CLOB column that has an existing XML_SECTION_GROUP index on certain tags within the XML content of the CLOB. (see script below)
    begin
    ctx_ddl.create_section_group('XMLDOC','XML_SECTION_GROUP');
    end;
    begin
    ctx_ddl.add_zone_section ('XMLDOC','title','title');
    ctx_ddl.add_zone_section('XMLDOC','keywords','keywords');
    ctx_ddl.add_zone_section('XMLDOC','author','author');
    end;
    create index xmldoc_idx on xml_documents(xmldoc)
    indextype is ctxsys.context
    parameters ('section group xmldoc') ;
    I have a requirement to search on the 'author' zone section by the first letter only. I figure a substring index is the way to go but I'm not sure of the syntax to create a substring index. Especially when I have already declared a SECTION_GROUP preference on this column and I would need to create a WORDLIST preference as well I think. Can someone help me out here?
    null

    Here is the answer from Oracle Text Help:
    "the main problem here is that you cannot apply that fancy substring
    processing just to the author section -- it will apply to everything,
    which will probably blow up the index size.
    Anything you do will require reindexing the documents, so you cannot
    really get around having to rebuild the index entirely.
    Here are various ways to tackle the problem:
    1. do nothing. Query just like: Z% WITHIN AUTHOR
    PRO: don't have to rebuild index
    CON: query is slow. some queries cannot be executed due to
    wildcard maxterms limits.
    2. create a wordlist preference with PREFIX_INDEX set to TRUE,
    PREFIX_MIN_LENGTH set to 1 and PREFIX_MAX_LENGTH set to 1.
    Query looks like: Z% WITHIN AUTHOR
    PRO: moderately fast query
    CON: must be on 8.1.7 or above
    get a lot of junk from words from other sections
    3. 2) as above, plus make AUTHOR, KEYWORDS, TITLE field sections
    PRO: faster query than 2)
    CON: field sections are less flexible w.r.t. nesting and
    repeating occurrences
    4. use a user_datastore or procedure_filter to transform the data
    so that <AUTHOR>Steven King</AUTHOR> becomes
    <AUTHORINIT>AIK</AUTHORINIT><AUTHOR>Steven King<AUTHOR>
    Use field section for AUTHORINIT and query becomes:
    AIK within AUTHORINIT (I used AIK instead of just K so that you
    don't have to make I and A non-stopwords)
    PRO: fastest query, smallest index
    CON: most work
    have to massage data so slows down indexing"

  • How to retreive data from a field that contains a "|" symbol

    Hi,
    Hopefully my title won't confuse anyone .
    Well I am trying to create a group which would display an employee name(s).
    In my case, the value comes from a field which can contain multiple values separated by a "|" symbol. See picture below.
    I am pretty sure I will have to write a formula for this but simply don't know where to begin or how to write it.
    Table use in this example is "ProductionProjectGroups" and will be linking this table to the "Employees" table which will display the actual employee name.
    Does anyone knows how to display data if there is a "|" symbol in the field?
    If you request more info please let me know.
    Thank you in advance for the help.
    Joe

    Hi Abhilash,
    I am looking for help on how to extract the employee's name from this field.
    I have also posted more pictures with details as requested.
    Thank you
    Joe

  • Where is the B1 field that contains the ITEM DESCRIPTION in the ecommerce

    Is there a place in B1 where we can put in the ITEM DESCRIPTION?
    I lookever all over but I don't think the ITEM description in the ecommerce side exists in B1.
    Mike

    Mike, I think you might be referring to the Part Name (which is really the description), "PartsMaster.PartName," from Web Tools. If so, the matching field in B1 is Item Name, "OITM.ItemName."

  • Poor quality in images from blob field

    Post Author: pbrand
    CA Forum: .NET
    I am using Visual Studio 2005 SP1 along with Crystal Reports XI R2SP1.  I have created a dataset for my report which has several BLOB fields that contain images.  One of the images is of a National Instruments graph control.  All images appear to be of lower quality than the original images when I print the report.  For instance the graph shows quite a bit of compression artifacts around the plots and text.  I have tried turning on the "Retain Original Image Color Depth" setting which had no effect on the quality of the printout that I could see.  It appears that Crystal Reports is compressing the images. Is there a better way of printing images in a Crystal Report?  Basically what I am doing now is taking the images, converting them to byte arrays and loading them into the dataset's BLOB fields.  Then printing the report.  I have thought about using the chart control in Crystal Reports but it does not have all the functionality that I require.  Is there some way to copy the NI graph control directly to the report?  I can live with lower quality on the other images, but I need the graph to be as sharp as possible.If I can't find a solution to this I will have to drop Crystal Reports and find something else.

    Post Author: pbrand
    CA Forum: .NET
    I am using Visual Studio 2005 SP1 along with Crystal Reports XI R2SP1.  I have created a dataset for my report which has several BLOB fields that contain images.  One of the images is of a National Instruments graph control.  All images appear to be of lower quality than the original images when I print the report.  For instance the graph shows quite a bit of compression artifacts around the plots and text.  I have tried turning on the "Retain Original Image Color Depth" setting which had no effect on the quality of the printout that I could see.  It appears that Crystal Reports is compressing the images. Is there a better way of printing images in a Crystal Report?  Basically what I am doing now is taking the images, converting them to byte arrays and loading them into the dataset's BLOB fields.  Then printing the report.  I have thought about using the chart control in Crystal Reports but it does not have all the functionality that I require.  Is there some way to copy the NI graph control directly to the report?  I can live with lower quality on the other images, but I need the graph to be as sharp as possible.If I can't find a solution to this I will have to drop Crystal Reports and find something else.

  • Parsing text from CLOB field that's stored as XML

    I have a CLOB field that contains an XML string. That looks like the text below. Is it possible to parse out the text string Denied NOW!!!. I basically want to parse out the data between the first encounter of the <CommentBody> tag.
    <CommentHeader>Whatever<CommentDate>2010-01-21-15.16.48.000000
    </CommentDate></CommentHeader><CommentBody>Denied NOW!!!</CommentBody>
    <CommentHeader>Whatever<CommentDate>2010-01-21-15.10.38.000000
    </CommentDate></CommentHeader><CommentBody>Denied YESTERDAY!!!</CommentBody>
    Thanks all!!
    Edited by: user11938977 on Jun 28, 2010 11:32 AM

    Thanks everyone! I'm using Oracle 11.1.0.7.0
    It seems to work as long as the Text Contents of CommentBody tag is one word without spaces. If there are spaces in between the tags it errors out. Here's the SQL:
    SELECT extractvalue( xmltype('<root>'||t.comments||'</root>'),
    'root/CommentBody[1]' ) as "CommentBody"
    FROM AP_VCHR_AW t
    When COMMENTS contains this data it errors out:
    <CommentHeader> <CommentDate>2010-03-04-17.52.53.000000
    </CommentDate></CommentHeader><CommentBody>This is an approved vuocher</CommentBody>
    <CommentHeader> <CommentDate>2010-03-04-17.52.53.000000
    </CommentDate></CommentHeader><CommentBody>This is an approved vuocher</CommentBody>
    When COMMENTS contains this data the SQL succeeds:
    <CommentHeader>at <CommentDate>2010-01-21-15.16.48.000000
    </CommentDate></CommentHeader><CommentBody>Denied!!!</CommentBody>
    <CommentHeader> at <CommentDate>2010-01-21-15.10.38.000000
    </CommentDate></CommentHeader><CommentBody>Denied!!!</CommentBody>

  • Hide form field based on name that contains certain characters

    I think this is an easy one.
    We're looking for help with a script that will hide all instances of text fields that contain a certain value. We have a function running that applies to the same text fields, however, each text field had to be tagged with a number at the end. Also running with this is a custom save button that flattens the page and hides certain elements before saving out. The hide function works pretty straightforward with "this.getField… = display.hidden;". The issue is that we don't want to repeat this for every single instance of the text fields that share the same name.
    We need it look for every text box that has a similar title so for instance if we had multiple fields like this…  "my-text-field-01", "my-text-field-02" and "my-text-field-03" we want the script to look for the name "my-text-field" and hide all instances of that.
    Hope this makes sense, sorry, our programming skills are still amateur. Thanks in advance for any help.

    You can do that if you use a heirarchical naming convention. So instead use something like: my-text-field.1, my-text-field.2, etc.
    You can then hide them all like:
    // Hide all of the "my-text-field" fields
    getField("my-text-field").display = display.hidden;

  • Downloading data from a BLOB Field using mod_plsql

    Hi,
    I am trying to use the mod_plsql to download data from a blob field, I have a web page where I can pick the file name to be downloaded from the documents table This table has the BLOB field that has the Data formatted in a text file format(contains carriage returns), when I open it up in the browser it is displaying it correctly , but when I right click on the file name and choose "Save Target As" and save it as text file it is ignoring the carriage returns and displaying entire blob in one line.
    Can somebody help me figure out why it's not recognizing the carriage returns?
    Any help would be greatly appreciated.
    Thanks

    Hi and welcome to the forum.
    Is there a way to retrieve data from a blob field and save it to temp table.Why would you want to do that?
    Can you provide some more details regarding your requirement?
    (Don't forget to mention your database version as well)
    Also, I wonder why you've added a 'decompress' tag to your question?
    edit, after seeing Tubby's reply
    Dang, the connection must be frozen here ;)
    Edited by: hoek on Jan 6, 2010 9:06 PM

  • How to display image in blob field in ResultSet in SiteStudio?

    I am running Site Studio 10gR4. For a custom page, I created a component that basically runs a query. The structure of the underlying data is a combination of Varchar2, Date and a single BLOB field. The blob field either contains a simple jpeg image, or nothing.
    In my Page where I am looping through the data, how do I display the blob as an image?
    Currently the code looks like this:
         <!--$loop SQLRoutes-->
              <tr>
                   <td><!--$getValue("SQLRoutes",rsFieldByIndex("SQLRoutes", 0))--></td>
                   <td><!--$getValue("SQLRoutes",rsFieldByIndex("SQLRoutes", 1))--></td>
                   <td><!--$getValue("SQLRoutes",rsFieldByIndex("SQLRoutes", 2))--></td>
                   <td><!--$getValue("SQLRoutes",rsFieldByIndex("SQLRoutes", 3))--></td>
                   <td><!--$getValue("SQLRoutes",rsFieldByIndex("SQLRoutes", 4))--></td>
                   <td><!--$getValue("SQLRoutes",rsFieldByIndex("SQLRoutes", 5))--></td>
                   <td><!--$getValue("SQLRoutes",rsFieldByIndex("SQLRoutes", 6))--></td>
              </tr>
         <!--$endloop-->Field 1 is a blob and fields 5 and 6 are dates.
    So really two questions:
    1. How do I display field1 as an image?
    Example:
    <!--$getValue("SQLRoutes",rsFieldByIndex("SQLRoutes", 1))-->doesn't do it. Is there a different function then getValue() that I should be using to get the blob contents?
    2. I want to compare the date fields to todays date, and either change the color or conditionally display the fields. I could do this with basic taglibs from jsp. How do I do this with IDocScript?
    Example:
    <!--$if getValue("SQLRoutes",rsFieldByIndex("SQLRoutes", 6)) > dateCurrent-->
      <span class="red"><!--$getValue("SQLRoutes",rsFieldByIndex("SQLRoutes", 6))--></span>
    <!--$endif-->Thanks, Ken

    I actually don't know the answer to #1. If I were to guess, there's nothing out-of-the-box to handle blobs, so your best option is to write your own idoc function. Take a look at the How To component if you don't know how.
    For #2, you almost have it right. Insert bold:
    &lt;!--$if <b>parseDate(formatDate(</b>getValue("SQLRoutes",rsFieldByIndex("SQLRoutes", 6))<b>)) gt</b> dateCurrent<b>()</b>--&gt;
    &lt;span class="red"&gt;<!--$getValue("SQLRoutes",rsFieldByIndex("SQLRoutes", 6))-->&lt;/span&gt;
    <!--$endif-->

  • Creating Packages from BLOB field contents, line wrap problems

    Good afternoon,
    we use an in-house developed database-driven update system to update both our databases and filesystems, the system itself performs really well but there is still one problem I can't fix without some expert help:
    the code of to-be-updated Oracle packages is stored inside of a BLOB field, the BLOB field will contain both the package specification and package body and needs to be split into two parts to first execute the spec and then to execute the package body (I tried to execute both in a single step but this didn't work). This works for packages with less than 32767 characters and also works in some other cases but I found one case where the executed code contains an extra line wrap right in the middle of a word.
    To make it more clear (I hope it's comprehensible), imagine the following database content:
    CREATE OR REPLACE Package
    MyPack
    AS
    [... a lot procedure headers ...]
    END MyPack;
    CREATE OR REPLACE
    Package Body MyPack AS
    [... a lot more procedures ...]
    PROCEDURE myTest (intID OUT integer)
    AS
    BEGIN
      SELECT count (*) into intID FROM MyTa[--this is where the dbms_lob.substr() ends --]ble;
    END;
    END MyPack;My code searches for the second occurrence of the "Create or replace package", splits the code into spec and body, executes the specification and keeps on adding the rest of the code to a VARCHAR2A variable called "storedCode" from the BLOB. Now in the above example, after the specification has been removed from the string, the remaining characters (ending with the "MyTa" string) are added to the varchar2a variable, the next line is fetched from the BLOB via "dbms_lob.substr()" and added as long as dbms_lob.substr() does not return a NULL value (end of BLOB). When the code is executed after all has been fetched, the generated Package Body will contain an extra line wrap right in the middle of the "MyTable" word compiling the package invalid.
    This is the procedure code I use (definitely improvable, I'm better in MSSQL and MySQL dialects ...) to load, parse and execute the BLOB content:
       -- to run package code
      procedure runPackageCode (stepRef integer)
      AS
        numLines integer default 1;
        pos     integer default 1;
        storedCode    LOG_CHANGEDOBJECT.STOREDOBJECT%type;
        objectCursor  integer;
        lSqlOut     integer;
        sqlCommand  dbms_sql.varchar2a;
        emptyCommand dbms_sql.varchar2a;
        pIsError integer := 0;
        pErrorMsg varchar2(200) := '';
        updateRef integer := 0;
        currentUpdate integer := 0;
        schemaReference varchar2(20);
        -- required to do string cutting
        strLine varchar2(32767);
        strLeftFromSlash varchar2(32767);
        strRemaining varchar2(32767);
        intDelimiterPos integer := 0;
      begin
        -- retrieve update ID
        SELECT log_update_ref INTO currentUpdate FROM link_update_with_taskstep WHERE log_taskstep_ref = stepRef;
         begin
            select storedobject, change_area
            into storedCode, schemaReference
            from vw_storedobjects
            where step_id = stepRef;
         exception
          when no_data_found then
            pIsError := 1;
            pErrorMsg := 'Invalid SQL ID ' || stepRef;
            pkg_generic.LogError(updateRef, 'LocalUpdater', stepRef, 'Run package code failed: ' || pErrorMsg);
         end;
          if pIsError = 0 then     
            begin
              -- change schema
              execute immediate 'alter session set current_schema = ' || schemaReference;         
              objectCursor := dbms_sql.open_cursor;   
              loop
                strLine := UTL_RAW.CAST_TO_VARCHAR2(dbms_lob.substr(storedCode, 32767, pos));
                intDelimiterPos := regexp_instr(strLine, '\s*Create\s*or\s*Replace\s*Package', 2, 1, 0, 'i');
                while intDelimiterPos > 0
                loop
                  -- '/' found, execute currently stored statement
                  strLeftFromSlash := substr(strLine, 1, intDelimiterPos-1);
                  strLine := substr(strLine, intDelimiterPos);
                  -- execute the extracted part without any '/' in it
                  sqlCommand(numLines) := regexp_replace(strLeftFromSlash, '(^|\s+)/(\s+|$)', '', 1, 0, 'm');
                  if (sqlCommand(numLines) is not null) then
                    objectCursor := dbms_sql.open_cursor;   
                    dbms_sql.parse(objectCursor, sqlCommand, 1, numLines, true, dbms_sql.native);
                    lSqlOut := dbms_sql.execute(objectCursor);
                    dbms_sql.close_cursor(objectCursor);
                  end if;
                  -- reset sqlCommand
                  sqlCommand := emptyCommand;
                  -- reset line counter and store remaining string
                  numLines := 1;
                  -- check for further '/'s           
                  intDelimiterPos := regexp_instr(strLine, '\s*Create\s*or\s*Replace\s*Package', 2, 1, 0, 'i');
                end loop;
                -- add the remaining strLine to the sqlCommand
                strLine := regexp_replace(strLine, '(^|\s+)/(\s+|$)', '', 1, 0, 'm');
       --> I assume this line breaks the code, lpad()'ing the content to move it to the end of a varchar2a line didn't help
                sqlCommand(numLines) := strLine;
                exit when sqlCommand(numLines) is null;
                pos := pos+32767;
                numLines := numLines+1;
              end loop;
              objectCursor := dbms_sql.open_cursor;   
              dbms_sql.parse(objectCursor, sqlCommand, 1, numLines, true, dbms_sql.native);   
              lSqlOut := dbms_sql.execute(objectCursor);
              dbms_sql.close_cursor(objectCursor);
              commit;
              -- reset schema
              execute immediate 'alter session set current_schema = UPDATE_DB';
              -- set state to installed
              pkg_update.setstepstate(stepRef, 'Installed');
        exception
        when others then
              -- reset schema
              execute immediate 'alter session set current_schema = UPDATE_DB';
              -- set state to installFailed
              pkg_update.setstepstate(stepRef, 'InstallFailed');
              pkg_generic.LogError(updateRef, 'Database', stepRef, 'Run package code failed: ' || sqlerrm);
        end;
        end if;
      END;    Thanks if you kept on reading so far, I would really appreciate any feedback!
    Regards, Sascha

    Welcome to the forum!
    Whenever you post provide your 4 digit Oracle version (result of SELECT * FROM V$VERSION).
    Thanks for providing an easy-to-understand problem statement and for using code tags.
    >
    the code of to-be-updated Oracle packages is stored inside of a BLOB field
    >
    This should be stored in a CLOB since it is character data. Why are you using BLOB?
    >
    the BLOB field will contain both the package specification and package body and needs to be split into two parts to first execute the spec and then to execute the package body
    >
    Good, clear problem statement. So why doesn't your code do just what you said it should do: 1) split the code into two parts, 2) execute the spec and 3) execute the body.
    Instead of writing code that does these three relatively simple steps your code tries to combine splitting and executing and mushes/mashes it all together. The result, as you found, is code that is hard to understand, hard to debug, doesn't work and doesn't report on what it is doing.
    Code like this doesn't have a performance issue so the code should implement the simple step-by-step process that you so elegantly stated in your problem description:
    1. split the code into two parts
    2. execute the spec
    3. execute the body
    My advice is to refactor your code to perform the above steps in the proper order and to add proper exception handling and reporting for each step. Then when a step isn't working you will know exactly where and what the problem is.
    Here are my recommendations.
    1. Add two CLOB variables - one will hold the spec, the second will hold the body
    2. Add a comment (you have some good ones in the code now) for every step no matter how trivial it may be
    3. Add exception/error handling to EVERY STEP
    Your code for the first step has a comment but no exception handling. What should happen if you don't get any data? Why aren't you validating the data you get? Dynamic SQL using table-driven data is great, I love it, but you MUST validate that the data you get is what you expect to get.
        -- retrieve update ID
        SELECT log_update_ref INTO currentUpdate FROM link_update_with_taskstep WHERE log_taskstep_ref = stepRef;Recommended
        -- step 1 - retrieve update ID - This is the id that determines BLAH, BLAH, BLAH - add appropriate to tell a new developer what this ID is and what it means.
        BEGIN
            SELECT log_update_ref INTO currentUpdate FROM link_update_with_taskstep WHERE log_taskstep_ref = stepRef;
        EXCEPTION
            WHEN ??? THEN -- what should happen if step 1 fails? Do it here - don't default to an exception handler that is several pages away.
        END;Your code
         begin
            select storedobject, change_area
            into storedCode, schemaReference
            from vw_storedobjects
            where step_id = stepRef;
         exception
          when no_data_found then
            pIsError := 1;
            pErrorMsg := 'Invalid SQL ID ' || stepRef;
            pkg_generic.LogError(updateRef, 'LocalUpdater', stepRef, 'Run package code failed: ' || pErrorMsg);
         end;
    Good - except there is no comment that says what this does - I assume that the query above and this block are the 'retrieve update ID ' step?
    You log an error message and set the error flag to '1'. But since you don't want to continue why aren't you exiting the procedure and returning right here?
          if pIsError = 0 then     
            beginSo now you check the error flag and do several pages of code if there were no errors.
    I don't like that 'inverted' logic.
    If you don't want to continue then STOP right now! Don't make a developer scan through pages and pages of code to find out you really aren't doing anything else if there was an error.
    Either put a RETURN statement in the exception handler above or change your code to
          if pIsError = 1 then     
            RETURN;
          end if;Now the rest of the code doesn' t have to be indented; you will never get there if there is an error. Check for errors after every step and exit right then as appropriate.
              -- change schema
              execute immediate 'alter session set current_schema = ' || schemaReference;         
              objectCursor := dbms_sql.open_cursor;   
              loop
                strLine := UTL_RAW.CAST_TO_VARCHAR2(dbms_lob.substr(storedCode, 32767, pos));
                intDelimiterPos := regexp_instr(strLine, '\s*Create\s*or\s*Replace\s*Package', 2, 1, 0, 'i');
                while intDelimiterPos > 0
                loopThis code mixes all of the steps together into one giant mess. You open a cursor, try to split the BLOB into spec and body and try to parse and execute both all within a double nested loop.
    Even if that works correctly another developer will have a hard time understanding what the code is doing and fixing it if it goes wrong. And it will go wrong if you let me test if for you because I will put garbage into the BLOB for the spec, body or both to make sure it breaks and to see how your code handles it.
    I suggest you rewrite this double nested loop to perform the three steps separately.
    1. split the code into two parts
    a. put the spec into one new CLOB variable and the body into the other.
    b. use DBMS_OUTPUT (or a work table) to output the spec and body so you can see what the code is and make sure the 'split' process worked properly. You probably created that BLOB by manually concatenating the SPEC and BODY to begin with so now create a SPLIT process to split them again and give them back to you. This is such a fundamental component that I suggest creating a new SPLIT_MY_BLOB procedure. This procedure would take a BLOB and return two CLOBS as OUT parameters: one CLOB is the spec and one is the body. Then you can reuse this 'split' procedure in other code or more complex versions of code. Modular programming is the key.
    2. execute the spec - Now have a step that executes the spec and does something appropriate if the step succeeds or if it fails. I mean, do you really want to do execute the body if the spec execution fails? What do you want to do? Should you delete the body and spec? If you don't you might wind up with an INVALID body based on old code and an INVALID spec based on the new code you were trying to use. How will anyone, including you, know that the spec and body in the ALL_SOURCE view is really two different versions of things?
    This suggests that for your use case you may want to consider DROPPING the entire package, spec and body, before trying to recreate them both. At least if the package is totally missing anyone will know that the entire thing needs to be put back. Ahhhh - but to do that you need to know the package name so you can drop it. Than may require adding another step to get the package name from your data-driven table and adding a DROP PACKAGE step.
    3. execute the body - This step executes the body. Hmmmm - we have two nearly identical steps. So why don't you create a new function/procedure that takes a CLOB as input, uses dynamic sql to execute it and returns a result code. That would be useful. Then you could execute ANY sql stored in a CLOB and have a generic function that you can use for other things.
    Right now you are using the VARCHAR2 table version of DBMS_SQL.PARSE but you would change this to use the CLOB version.
    The end result of this refactoring is a main function/procedure that acts as the CONTROL - it decides what to do and what data (BLOB) to do it with. But it doesn't actually do ANY of the work. It just controls what is done.
    And you have a couple of generic, reuseable functions that actually do the work. One knows how to split a CLOB into spec and body. The other knows how to use dynamic SQL to execute a CLOB.
    Now you have a modular architecture that is easy to understand, easy to code and easy to test.

Maybe you are looking for

  • How do u make new folders in mail when I press edit only move delete or mark comes up nowhere can u make new folder

    I can't make new folder in mail on my normal acc or icloud

  • Is there a thumbnail view in Pages like in Adobe Acrobat?

    I imported a label making template and there is some funky formatting that has created a second page that I can't seem to delete. I am trying to view the document in the "thumbnail view" a la Adobe Acrobat so I can just "see" the page in the sidebar

  • Changes in master data.

    hello SAP Gurus, Please tell me how can we check the changes donne by user in master data Material Master Record, BOM, Work center & routing. without activating ECM in SAP. In changes can we trace last valu & changed value for master data. Regards, d

  • Custom document number at UpdateHistoryAction

    Hi We are using SAP B2B application with ECC. Whenever the Update History Action action is called and History is saved , we wish to pass custom document number. Just want to understand how can we achieve this..... Regards Sumit

  • EEM TCL Programming

    Is it possible to program a question and response logic into TCL scripts?  I'd like to be able to capture user input and take action based on that input.  Is that possible?  If so, could you please point me to a resource where I can learn more about