Create packages from the SqlDeveloper 1.5 Extension API

How do you CREATE and EXECUTE packages and procedures from the SqlDeveloper 1.5 Extension API?
Not from the GUI... but from the Extension API.
Any kind of package, for example...
create or replace package MY_PKG is
procedure my_procedure (a number, b number) ;
end;
create or replace package body MY_PKG is
procedure my_procedure (a number, b number) is
begin
select 'x' from dual;
end ;
end;
And then EXECUTE a package from the API...
For example...
exec MY_PKG.my_procedure (1, 2)

Just use ordinary JDBC:
Using the API, you can execute a query the following way:
oracle.dbtools.db.DBUtil dbutil = oracle.dbtools.db.DBUtil.getInstance();
dbutil.execute(oracleConnection, sql, binds);
// There are various overloads and/or similar methods such as the following:
String s = dbutil.executeReturnOneCol(oracleConnection, sql, binds);
// (binds is a java.util.HashMap<String, Object>)
It's interesting to note that you can turn on and off the notification of exceptions:
dbutil.setRaiseError(false); //off
dbutil.setRaiseError(true); //on
Because of these methods, I was half expecting similar methods for executing PL/SQL.
Apparently, there isn't any equivalent method for PL/SQL and you should just use ordinary JDBC instead.

Similar Messages

  • Jar file is not working after deleting all packages from the same directory

    hello
    i have created a jar file named as server.jar in the same directory in which i have all the packages(for which i have created this jar file).This jar file was working correctly when i had all the packages in the same directory.But after deleting all the packages from the same working directory, this jar file is neither working nor giving any error message..
    Please tell me what may be the reason???
    thanks in advanced

    hello
    i have created a jar file named as server.jar in the same directory in which i have all the packages(for which i have created this jar file).This jar file was working correctly when i had all the packages in the same directory.But after deleting all the packages from the same working directory, this jar file is neither working nor giving any error message..
    Please tell me what may be the reason???
    thanks in advanced

  • Md5 checksums of all packages from the specified directory

    How to check md5 checksums of all packages from the specified directory with pacman?

    karol wrote:It's 4.30 AM, the sun comes up and I'm going to bed.
    Hmmm, the blue sky and violet-pink clouds remind me of Arch homepage ;P
    Hehe, it's a nice feeling, nevertheless.
    @dkorzhevin: here's a script I've made when I needed this:
    #!/bin/bash
    echo -n "" > pkgNotFound
    echo -n "" > pkgSums
    names=`pacman -Slq`
    for name in $names
    do
    versionLine=`pacman -Si $name | grep "Version : "`
    version=`echo -n $versionLine | sed -e 's/Version : //g'`
    md5Line=`pacman -Si $name | grep "MD5 Sum : "`
    md5=`echo -n $md5Line | sed -e 's/MD5 Sum : //g'`
    pkgPath=`find /var/cache/pacman/pkg/ -name $name"-"$version"*"`
    if [ "$pkgPath" = "" ]
    then
    echo "Error: "$name" package not found in cache." >> pkgNotFound
    else
    echo $md5" "$pkgPath >> pkgSums
    fi
    done
    exit 0
    So your output will be located in the file "pkgSums" and it will look like this, these are the checksums that pacman displays, and the paths of your local packages:
    4ce0d40359bfa1a4a0f47a0e53e65fa5 /var/cache/pacman/pkg/acl-2.2.49-1-x86_64.pkg.tar.xz
    24df396b3146d1a203e0d4f4d6edd67b /var/cache/pacman/pkg/ar9170-fw-1.0-2-any.pkg.tar.gz
    8454e0fc947f9c8ce4ac5c39ed6ef165 /var/cache/pacman/pkg/attr-2.4.44-1-x86_64.pkg.tar.gz
    9ef6b0ce43a4660170df21ead2f8e711 /var/cache/pacman/pkg/autoconf-2.65-2-any.pkg.tar.xz
    505fe675565601f6ca803779601837cf /var/cache/pacman/pkg/automake-1.11.1-1-any.pkg.tar.gz
    To check the checksums against the packages, just run md5 with the newly created file, if you get output then something stinks :
    # md5sum -c --quiet pkgSums
    There's another file "pkgNotFound" for the packages which are found in pacman but not on your disk. So make sure you don't have these two files already, in the current directory, containing important information - they will be overwritten.

  • RBDMIDOC creates duplicateIDocs from the change pointers

    Hi,
    SAP program RBDMIDOC creates IDocs from the change pointers for a
    specified message type(ZHRMDA06_PREHIRE, an extension of standard
    HRMD_A06 ) and then marks the change pointer as processed.
    HCM has an instance of this program that runs for PreHire employees,
    creating 1 Idoc per employee. When this job runs in background via
    production batch, a single change pointer for a single employee creates
    3 or 4 identical IDocs in that one run of the program. This results in
    duplicate records in the resulting interface file to Hewitt.
    Please suggest solution for that.
    Thanks and Best Regards,
    Binod K singh.

    hi, try to check the distribution model: BD64, find whether there are mutiple receiving system for your message type...just a suggestion

  • How to call a package from the Report in Oracle Application Express

    How to call a package from the Report in Oracle Application Express

    Hello,
    What do you mean? Something like SELECT mypackage.function( par1, par2) from dual?
    Or do you want to execute a procedure when something happens on the page, like clicking a button?
    Greetings,
    Roel
    http://roelhartman.blogspot.com/
    You can reward this reply by marking it as either Helpful or Correct ;-)

  • Can't create Project from the Template or access project template

    Dear Experts,
    We are facing a issue while trying to access the project template/create the project from project template.
    we have 4 project template in place and of these two are working perfectly fine but
    From remaining two we are not being able to create project and even templates are not accesible , whenever we are trying to access the project template system rotates a circle for some time and keeps us on the same page.
    Even when we are trying to create project from the same template, system does the same again rotates the circle for some time and keeps us on the same screen.
    And System is not throwing any error for the same (we have checked in the log as well) just not letting us in and not allowing us to create project.
    Any Help Will be Highly Appreciated.
    Regards,
    Rakesh Daiya

    Dear Experts,
    We were able to find out the issue,
    We added 3 groups to the template with "Reviewer" access with "Document Only" Type in the project template.
    When we changed the type to "Template and Document" from "Document Only" and  system started allowing us to create projects from the template.
    Can anyone please help me with one query,
    Can we add a group(which includes all the buyers) with reviewer access and with Document only type?
    Does this really be a reason behind projects are not getting created from template?
    Any help will be appreciated
    Regards,
    Rakesh Daiya

  • Need a way to start the package from the point of failed record

    Hi,
    I have a package which loads billions of records, the problem i am having is when it fails after 1 billion record have to start from the beginning. Is there a way where I can start my load process from the failed record instead of starting from the beginning.
    Thanks in advance

    Simply implementing checkpoint wont restart package from the failed record onwards. It depends on how you do data transfer. For example if its a data flow task and if its an intermediate step that fails, then it wont start from failed record onwards next
    time.
    A much better option would be to implement it like this. Have a OnError event handler for the task and inside that use execute sql task to populate a control table with the max key/timestamp value of record which has been extracted. 
    Each time check if table has a entry and if present take max date/key value from it. Use the value to filter the source data to take only records with value > fetched value to start from next record onwards.
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • Unable to create DIR from the objects

    Hi,
    I want to create the DIR from the object  transaction, eg., Purchase Order, I have set "1" - Create Simple Document under Define Object Links for that particular Document type, But despite this config, I am not getting the "create" button. whereas I have assigned the same document type to another Object link Appropriation Request, and I am able to create DIR from the object transaction itself. Upon, exploring the system, I found that the Purchase order uses the Program "SAPLCVOB" screen"0200" whereas Appropriation request has Program "SAPLCV140" screen"0204" So, I presume that the configuration affects only SAPLCV140 and it has no affect to SAPLCVOB. Or is there any other way to create the DIR directly from the objects which uses SAPLCVOB program? My user wants to create DIR directly from PO.

    Dear Mohamed,
    To grant that allways the currenct screens and authorizations were
    called please maintain also the value "1" into the "Authorization"
    column. For further informations on this maintainance please see the
    SAP note 1066915. It's important that you not enter the mentioned
    screen number wihtout the leading "1" as this number is added
    automatically by the system (e.g. object MARA 1201 maintain like MARA
    201). You can do this in customizing under:
    Transaction SPRO
    > Cross-Application-Component
        > Document Management
             > Control Data
                 > Define screen for object links
    If you need the dynpro number or object you will find all standard SAP
    objects and their screen number in function module CV130 (Screens) by
    transaction SE80. Please maintain all necessary SAP objects.
    Best regards,
    Christoph

  • Installing a Separate package from the Solaris CD

    Hi .,
    I installed Solaris on my Sparc Station .,
    But now I want to install few packages which are not installed during the OS installation.
    Example:
    If i want to install the package SUNWarc from the Installation cd., Can anybody tell me the Easiest way to find out the Location of the package from the CD and to install it.
    Thanks & regards
    Suseendran .A

    Sorry to say NONE of the operation helps
    I am inside the Solaris cd1
    In my Solaris 1 CD for Solaris 10
    I am inside the
    /SOLARIS_10/PRODUCT directory,, here I found all the
    package folders.Please don't tell me what you are doing, show me exactly the screen output.
    But when I give the packageadd command inside the
    folder It is not working ans giving the Error
    Message..You are probably typing the command incorrectly.
    I asked if you would show (as in exactly cut and paste) the 'cd' and 'pkgadd' commands you are using. Without showing them exactly, it is very difficult to help you.
    Darren

  • Error Received When Trying To Create DSN From The Command Line

    All,
    Your help is greatly appreciated in advance. I am having trouble packaging Oracle 10G for a batch file deployment. Everything is done except for getting the DSN created which is causing me major problems. We am working with the Oracle 10G R2 10.2.0.1.0 Client on Windows XP Professional SP2. The Oracle database resides on a Windows 2000 Professional Server SP4 running Oracle 9i.
    Our Environment: I am creating two packages of the Oracle 10G client. The first is for a batch file distribution via LANDesk and the other package is for normal batch file install if someone from IT is installing this from a user's desk. Both scripts are really identical the only differences are how they are laid out. I only need help with the DSN creation as everything else is ready to go. I am going to focus on the Non-LANDesk batch file as once I fix this in one script the other one should also be fixed.
    The Problem: The batch script copies the neccesary files to the temporary directory. I then extract the setup files to the temp folder. I run a custom Oracle install using the RSP file from a recorded install. After the install is complete I copy the TNS Names file to the proper location. I then try to call a CMD file with the ODBC command seen below the main script.
    Script (May be easier to read if you download using link below):
    @ECHO ON
    ::This batch files installs Oracle 10G Release 2 Version 10.2.0.1.0 with a Custom Response File
    ::Installation is Interactive
    ::All files are extracted from the ZIP file via the 7-Zip command line tool
    ::The Net Configuration Assistant TNS Names File is copied to its proper location
    ::The CCR ODBC connection is created once the install is complete
    ::All folders used for installation are cleaned up-deleted
    @ECHO Setting Variables
    set NetworkPath=\\dc-landesk\SoftwareForLDAgent\Oracle10G-R2-10.2.0.1.0\Non-LD
    set DefaultPackagePath=C:\Program Files\LANDesk\LDClient\sdmcache\SoftwareForLDAgent\Oracle10G-R2-10.2.0.1.0\Non-LD
    set ExtractionPath=C:\Temp_Oracle10G
    set TempInstallFromPath=C:\Temp_Oracle10G\SetupFiles
    set FileFolderCleanupPath=C:\Program Files\LANDesk\LDClient\sdmcache\SoftwareForLDAgent
    @ECHO Creating Directories
    mkdir "C:\Program Files\LANDesk\LDClient\sdmcache\SoftwareForLDAgent\Oracle10G-R2-10.2.0.1.0\Non-LD"
    @ECHO Copying Files to DefaultPackagePath
    copy /Y "%NetworkPath%\7za.exe" "%DefaultPackagePath%"
    copy /Y "%NetworkPath%\CCR-ODBC.cmd" "%DefaultPackagePath%"
    copy /Y "%NetworkPath%\Oracle10GCustom.rsp" "%DefaultPackagePath%"
    copy /Y "%NetworkPath%\SetupFiles.zip" "%DefaultPackagePath%"
    copy /Y "%NetworkPath%\tnsnames.ora" "%DefaultPackagePath%"
    @ECHO Changing to Extraction Directory
    cd "%DefaultPackagePath%"
    @ECHO Extracting Files to path with no spaces
    "%DefaultPackagePath%\7za.exe" x SetupFiles.zip -o%ExtractionPath% -aoa
    @ECHO Please Open the "Task Manager" manager, Sort by "CPU" Descending
    @ECHO Watch Task Manager For Javaw.exe, press any key when the process Disappears
    @ECHO Install using Custom Response File
    "%TempInstallFromPath%\setup.exe" -responseFile "%DefaultPackagePath%\Oracle10GCustom.rsp" -force -silent -noconsole
    pause
    @ECHO Copying NETCA (Net Configuration Assistant) TNS Names File to proper Location in Oracle Product Directory
    copy /Y "%DefaultPackagePath%\tnsnames.ora" "C:\oracle\product\10.2.0\client_1\NETWORK\ADMIN\tnsnames.ora"
    @ECHO Creating ODBC Connections Using Oracle Driver installed by this Batch File
    call "%DefaultPackagePath%\CCR-ODBC.cmd"
    @ECHO Waiting 20 seconds before proceeding
    ping -n 21 127.0.0.1 >NUL
    @ECHO Remove Temp Files and Folders created during Install
    rmdir /S /Q %ExtractionPath%
    del /Q "%DefaultPackagePath%\*.exe"
    del /Q "%DefaultPackagePath%\*.ora"
    del /Q "%DefaultPackagePath%\*.rsp"
    del /Q "%DefaultPackagePath%\*.reg"
    del /Q "%DefaultPackagePath%\*.zip"
    rmdir /S /Q %FileFolderCleanupPath%
    @ECHO The Oracle 10G installation has been Completed
    pause
    ODBC Script
    odbcconf.exe /a {CONFIGSYSDSN "Oracle in OraClient10g_home1" "DSN=CCR|Description=CCR_data|SERVER=BWB|Database=CCR"}
    As soon as the command is called I see the following error message appear.
    "CONFIGSYSDSN: Unable to create a data source for the 'Oracle in OraClient10g_home1' driver: Could not load the setup or translator library with error code -2147467259"
    The really strange thing though is that if I let the main part of the script run (Not the ODBC call) and then immediately manually start the ODBC call script it works just fine. So, I don't really understand why the script can't add it itself. Or, I can go the Administrator Tools>Data Sources (ODBC)>and then add it manually which also works. I have tried just pasting the command directly in the main script, therefore, bypassing the call feature but it doesn't make a difference.
    Link (Zip with all scripts mentioned above): http://www.cbridegum.com/Fourms/Oracle/Files.zip
    Has anyone ever seen this kind of issue before? Does anyone have any idea on how to fix this? Any thoughts or suggestions would be great.
    Thanks so much for your help in advance,
    Clif Bridegum

    All,
    I thought it may be related to spaces in the path in which the script was called from. I tried having the ODBC command script in another directory but the same thing happens. It will give me the "CONFIGSYSDSN: Unable to create a data source for the 'Oracle in OraClient10g_home1' driver: Could not load the setup or translator library with error code -2147467259". As soon as the script is done running I can manually double click the script and it adds the DSN fine.
    Thanks,
    Clif Bridegum

  • ORA-12571 error while creating packages from Windows clients

    Hello,
    We are facing the ORA-12571 error while creating / replacing packages from Windows Clients connected to a 8.1.7.2.0 db on a Solaris server.
    However, there are
    1. no errors in connecting and creating transactions from a Sql session
    2. no errors in creating / replacing unwrapped/wrapped small (few lines) packages
    3. no errors in connecting from a Unix session (remote telnet sessions inclusive).
    This happens only when creating wrapped/unwrapped packages, source code of which is greater than 500 kb approx.
    Can somebody help me resolve this issue. Any Help would be greatly appreciated.
    Regards.
    Lakshmanan, K

    Update: I had unintentionally left my custom tablespace in READONLY state after an earlier experiment with transportable tablespaces. After putting the tablespace back into READ WRITE mode and creating a new template, I was successfully able to create a new db from the template.
    I'm still a little curious why this procedure wouldn't work properly with a READONLY tablespace, however.
    Ben

  • 1.5.4 ora-00904 when opening a package from the connections navigator

    Hi
    I downloaded 1.5.4 for windows and immediately checked to see if this long standing bug has been fixed
    1.5.0.53 New file types not opened as plsql (and now neither a
    However it hasn't so next thing I do is go the connections navigator to open a package which is the workaround for the above bug (any update on when that is going to be fixed would be appreciated).
    If I double click to open a package I get an error message
    ORA-00904: "ATTRIBUTE": invalid identifier
    A single click on a package does not give any error. Double clicking on the same package in 1.5.1 does not give any error message
    Any ideas?
    thanks
    paul
    Edited by: paul.schweiger on Mar 4, 2009 10:36 AM
    Stupidly used the rich text editor which doesn't seem to work too well

    JB,
    There actually is a post from the team in this thread ;-)
    The patch on 3/30 was not scheduled to fix any other errors other than the import issue we encountered. We included an LDAP fix and a 9i performance query issue. The exact bugs fixed are listed in the check for updates detail before you download the fix.
    All bugs can be logged with Metalink, that is the primary place for logging and tracking bugs. The forum is for discussions on how to use the product - for pointers and advice.
    Paul,
    By your long standing bug, I assume you mean that .pks, pkb and .plb files are opened in the PL/SQL Editor. This has been fixed in 1.5.4.
    What has not been done and has been scheduled for 2.0 is the ability to associate any extension with a file and then open that file with the pl/sql editor.
    For all encountering the ora-00904 error, this is specifically related to opening PL/SQL in a 9i database and we have a bug logged for that.
    Sue

  • 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.

  • Mitigating DRM creating packages from Steam games?

    In the light of recent events (http://www.reddit.com/r/Steam/comments/ … irst_game/), do you think it will be wise to create AUR packages from Steam games? These packages could be rebuilt everytime we want, considering that games can be updated.
    Before you said it, i know, this is our fault for accepting Steam with all its DRM crap included. That's why this is a mitigation, not a solution.
    Thanks!

    You have a naive undestanding of how steam and DRM works in general. (And possibly AUR, hard to tell)
    If a binary is locked to steam and valve says you can no longer play this game then you cannot start it even if you have all the files.
    In theory it could work in the so called "offline mode" for a while, but it will demand an internet connection sooner or later and then no game for you.
    Steam is DRM and they made it clear you are not buying the games, you just buy a license to play. If you want to create backups that will work don't buy steam games, use DRM free shops like the Humble Store or GOG.

  • Can't create invoice from the delivery

    Hello.
    Ship out the trade order then i created the delivery and PGI successfully.
    But when i went to VF01 to invoice the delivery i can´t create it.
    I take a look to the LOG and this is what i found:
    Error Log
                 6910517662 000010 The item is blocked for billing
    I double click the item and in the configuration of Financial processing there is a field called "Block" but there is nothing selected over there. Do you have any suggestion?
    I appreciate your help

    The item is blocked for billing
    Apart from the suggestions, if that particular material is kept open in some other system, then also, system will throw this error.  Also ensure that in material master Sales Org.1 view, this material is not blocked against the field "X-distr.chain status"
    thanks
    G. Lakshmipathi

Maybe you are looking for

  • A problem occured with this webpage so it was reloaded

    Hi all, I am continuously getting this error during normal web browsing. - Only 1 or 2 tabs are open - Page hangs and un-responsive, then it reloads with the following error at the top of safari - happenss in private and normal browsing modes - Tried

  • FCP X freezes on title background rendering?

    Turned rendering off to animate title. every time I turn on background render FCPX will stop responding. Working on a new iMac i5 with 8 gigs memory. it should be flowing. what's the deal? Will re-organizing my Font library or removing fonts help? (s

  • VEPVG Table Updation

    Is anybody aware of how exactly VEPVG table gets updated ? Functionally VEPVG gets updated when we create an order with some schedule line data. But is anybody aware of the include/program where exactly VEPVG table gets populated ?? Also i believe th

  • Settings for Video Podcast?

    I don't have a video iPod, but a friend told me that my video didn't sync with her new iPod Nano via iTunes. Trying to figure out if there's something wrong with the encoding. I read in the new video capable iPod specs... H.264 video, up to 1.5 Mbps,

  • Location of the 'save file' for games on memory ca...

    Hey, im playing the game 'air hockey' on my nokia 5800, but its stuffing up a bit so i want to re-install it just in case it got damaged a bit from a previous update... But iv got so far into the game that i dont want to lose my progress, so does any