script can be invoked only from a java stored procedure

I made a java procedure and called via a sql procedure that accepts a string input:

the string is passed to Runtime.getRuntime () .exec ("myString");


If this string is:
RM-f /test/test22.log

proc = Runtime.getRuntime () .exec ("rm-f /test/test22.log");

the test22.log file that is located in the test folder is deleted

but when I place the order. /test/batchstart.ksh to run a script, the script does not run.

proc = Runtime.getRuntime ().exec(".) (' / test/batchstart.ksh ");


received the permissions of files and also the rights of the executables.

If some bobdy can say why the script is not running which will be a great help

Hello

I had the chance to do something like the following without using oraenv

ORACLE_SID = GNVDEV
ORACLE_HOME=/U21/app/Oracle/product/10.2.0/Db_1/

PATH = / usr/local/bin: $ORACLE_HOME/bin: $PATH
export PATH

In some cases affecting LD_LIBRARY_PATH to include the libs oracle was also necessary.

Another option is to simply use the full paths everywhere for example use
$ORACLE_HOME/bin/sqlplus instead of just sqlplus.

Hope this helps,
Ravi.

Tags: Database

Similar Questions

  • My bank site refused my log in because of 'old' browser, but I don't want to upgrade the next operating system (Yosemite) because he ruined my computer before. How can I upgrade only from Safari?

    My bank site refused my log in because of 'old' browser, but I don't want to upgrade the next operating system (Yosemite) because he ruined my computer before. How can I upgrade only from Safari?

    Safari cannot be updated past 6.2.8 on Mountain Lion. If you want to, switch browsers.

    (144681)

  • How can I get rid of "securityagent only can be invoked only by the apple software"?

    How can I get rid of "securityagent only can be invoked only by the apple software"?

    This error can be fixed by Apple support, please see:

    The appellant not approved. Apple support communities

    Error "SecurityAgent can only be called by App... | Apple support communities

    Concerning

    Stéphane

  • Java stored procedure

    Hello

    I tried to register with the Java stored procedure and created a Java class for it. I am quite successful in compiling and executing the code using the Java compiler in Windows CMD, but I meet below error when I try to do the same thing via Java stored proc.
    PRAZY@orcl> CREATE OR REPLACE  FUNCTION WINREGREAD(REGKEY VARCHAR2,REGVALUE VARCHAR2) RETURN VARCHAR2
      2  AS
      3  LANGUAGE JAVA NAME 'WindowsRegistry.readString(java.lang.String,java.lang.String) return java.lang.String';
      4  /
    
    Function created.
    PRAZY@orcl> call winregread('Software\\MyApps','Test') into :mystring;
    call winregread('Software\\MyApps','Test') into :mystring
    *
    ERROR at line 1:
    ORA-29532: Java call terminated by uncaught Java exception: java.lang.NullPointerException
    
    
    Elapsed: 00:00:00.01
    PRAZY@orcl>
    Here's the Java code and its put
    //Uncomment the below like while compiling Java source in DB
    //CREATE OR REPLACE AND COMPILE JAVA SOURCE NAMED "WinRegistry" AS
    import java.lang.reflect.InvocationTargetException;
    import java.lang.reflect.Method;
    import java.util.HashMap;
    import java.util.Map;
    import java.util.ArrayList;
    import java.util.List;
    import java.util.prefs.Preferences;
    public class WindowsRegistry {
      public static final int HKEY_CURRENT_USER = 0x80000001;
      public static final int HKEY_LOCAL_MACHINE = 0x80000002;
      public static final int REG_SUCCESS = 0;
      public static final int REG_NOTFOUND = 2;
      public static final int REG_ACCESSDENIED = 5;
      private static final int KEY_ALL_ACCESS = 0xf003f;
      private static final int KEY_READ = 0x20019;
      private static Preferences userRoot = Preferences.userRoot();
      private static Preferences systemRoot = Preferences.systemRoot();
      private static Class<? extends Preferences> userClass = userRoot.getClass();
      private static Method regOpenKey = null;
      private static Method regCloseKey = null;
      private static Method regQueryValueEx = null;
      static {
        try {
          regOpenKey = userClass.getDeclaredMethod("WindowsRegOpenKey",
              new Class[] { int.class, byte[].class, int.class });
          regOpenKey.setAccessible(true);
          regCloseKey = userClass.getDeclaredMethod("WindowsRegCloseKey",
              new Class[] { int.class });
          regCloseKey.setAccessible(true);
          regQueryValueEx = userClass.getDeclaredMethod("WindowsRegQueryValueEx",
              new Class[] { int.class, byte[].class });
          regQueryValueEx.setAccessible(true);
        }
        catch (Exception e) {
          e.printStackTrace();
        }
      }
      private WindowsRegistry() {  }
    
      public static String readString(String key, String valueName)
       throws IllegalArgumentException, IllegalAccessException,
        InvocationTargetException 
      {
    
        int hkey = HKEY_LOCAL_MACHINE;
          return readString(systemRoot, hkey, key, valueName);
      }
    
    private static String readString(Preferences root, int hkey, String key, String value)
    throws IllegalArgumentException, IllegalAccessException,
        InvocationTargetException 
      {
        try
    {
        int[] handles = (int[]) regOpenKey.invoke(root, new Object[] {
            new Integer(hkey), toCstr(key), new Integer(KEY_READ) });
    
        if (handles[1] != REG_SUCCESS) {
          return null;
        }
        byte[] valb = (byte[]) regQueryValueEx.invoke(root, new Object[] {
            new Integer(handles[0]), toCstr(value) });
        regCloseKey.invoke(root, new Object[] { new Integer(handles[0]) });
        return (valb != null ? new String(valb).trim() : null);
    }
    catch (NullPointerException e)
    { 
    return e.getMessage();
    }
      }
    // utility
      private static byte[] toCstr(String str) {
        byte[] result = new byte[str.length() + 1];
        for (int i = 0; i < str.length(); i++) {
          result[i] = (byte) str.charAt(i);
        }
        result[str.length()] = 0;
        return result;
      }
    
    //Begin - Remove the following lines while compiling Java source in DB
    public static void main(String[] args) throws Exception 
      {
    String value = "";
    value = WindowsRegistry.readString("Software\\MyApps","Test");
        System.out.println("Reg key Value is: " +value);
      }
    //End
    
    };
    
    //Output
    d:\Java_Test>javac WindowsRegistry.java
    
    d:\Java_Test>java WindowsRegistry
    Reg key Value is: TEST VALUE
    
    -----------------------------------------------------------------------------
    
    Env. Details:
    =======
    Windows Vista 32 bit
    
    DB:
    ====
    BANNER
    --------------------------------------------------------------------------------
    Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
    As you can see, I get my results when I run the same command prompt class, but encounter an error when it is executed from the DB.

    Also, I have granted permission to the runtime using DBMS_JAVA. Is there an any other permission problem?

    Kindly help and let me know if you need another entry.

    Thank you!

    Kind regards
    Prazy

    The Pref class is not supported in Oracle. So I used Java SP for BACK orders executed and calling in turn REG QUERY command.
    Tested with Windows 2003, Win XP and Win Vista (32-bit).

    PRAZY@orcl> select banner from v$version;
    
    BANNER
    --------------------------------------------------------------------------------
    Oracle Database 11g Release 11.1.0.6.0 - Production
    PL/SQL Release 11.1.0.6.0 - Production
    CORE     11.1.0.6.0     Production
    TNS for 32-bit Windows: Version 11.1.0.6.0 - Production
    NLSRTL Version 11.1.0.6.0 - Production                                                                                                                                                                                                                    
    
    Elapsed: 00:00:00.00
    PRAZY@orcl> CREATE OR REPLACE AND COMPILE JAVA SOURCE NAMED "WindowsRegistry" AS
      2  import java.io.*;
      3  import java.lang.*;
      4
      5  public class WindowsRegistry {
      6
      7  public static String ReadKey(String key,String valueName)
      8  {
      9       String finalVal=null;
     10       String curVal=null;
     11       String command="reg query " + key + " /v " + valueName;
     12         try {
     13             // get runtime environment and execute child process
     14             Runtime systemShell = Runtime.getRuntime();
     15             Process output = systemShell.exec(command);
     16             // open reader to get output from process
     17             BufferedReader br = new BufferedReader (new InputStreamReader(output.getInputStream()));
     18             String line = null;
     19              while((line = br.readLine()) != null )
     20                  {
     21                 finalVal = curVal;
     22                      curVal = line;
     23                  }
     24                 output.waitFor();
     25            //get the value by calling findkeyval method
     26            finalVal=findKeyVal(finalVal.trim(),valueName);
     27             return finalVal;
     28             }
     29          catch (IOException ioe){ return "";}
     30          catch (Throwable t) { return "";}
     31  }
     32
     33  //Method to split the output and retrieve key value
     34  public static String findKeyVal(String keyLine,String valName)
     35  {
     36       String retVal="";
     37       String [] temp = null;
     38       temp = keyLine.split("\\s+");
     39       if (temp[0].equals(valName)) {
     40            for (int i=2; i CREATE OR REPLACE FUNCTION WinRegRead(keyPath varchar2,keyName varchar2) RETURN VARCHAR2
      2  AS
      3  LANGUAGE JAVA NAME 'WindowsRegistry.ReadKey(java.lang.String,java.lang.String) return java.lang.String';
      4  /
    
    Function created.
    
    Elapsed: 00:00:00.01
    PRAZY@orcl> var keyVal varchar2(50)
    PRAZY@orcl> print
    
    KEYVAL
    --------------------------------------------------------------------------------------------------------------------------------                                                                                                                          
    
    PRAZY@orcl> call WinRegRead('HKLM\Software\Oracle','inst_loc') into :keyVal;
    
    Call completed.
    
    Elapsed: 00:00:00.04
    PRAZY@orcl> print
    
    KEYVAL
    --------------------------------------------------------------------------------------------------------------------------------
    C:\Program Files (x86)\Oracle\Inventory                                                                                                                                                                                                                   
    

    Fact!

    I hope this might help someone!

    Kind regards
    Prazy

  • Java stored procedures

    Hello. I am quite new to this feature, and I know, java stored procedures are built and called with a static method. My questions are:

    receipt of several requests, are processed in parallel or they are serialized?
    * If, at the same time, it is possible that the son has and b b finishing in the first place, I get the result of b to a?
    * If it is sequential, isn't it a bottleneck?

    Thank you.

    fcallem wrote:
    Thanks for your help, but what I understand from your answer, that this means that, for example, in the case many processes accessing the same java stored procedure as all requests are serialized and handled one by one. Is this correct?

    N ° number of connections to the database simultaneously executes the same java stored procedure.

    fcallem wrote:
    It's not not clear to me what happens if I have multiple threads opening their own connections and access this stored procedure, or, on the other hand, if I have a process that opens up multiple threads, but with a shared connection.

    If you have multiple threads, each with their own connection to the database, they each will perform the same procedure at the same time. If you have multiple threads sharing a single connection to the database, then each thread won't be able to run the one-at-a-time procedure, given that the connection can only be used by only one thread at a time.

    The JVM in Oracle is NOT mono-thread. You can create a java stored procedure that creates multiple threads within the database, and they work simultaneously. However, there is NO case where this would be an appropriate design.

    Read this:
    http://download.Oracle.com/docs/CD/B28359_01/Java.111/b31225/chtwo.htm#sthref293

  • Cannot load the file DOC ID 109095.1 java stored procedure

    Hello. I'm trying to follow the documentation for 109095.1 (How to perform a system call to a Java Stored Procedure and capture the output) and after I try to load the java file I received the following two errors below. In some of the forum posts I met and performed various controls as well and from what I can tell, it seems that the java install my have broken or is not installed properly in the first place (unknown previous state). Some of the results of the checks are also lower.

    [dcampoy@prd oracle] $ loadjava u dcampoy / * - diagram t_super_user - v CaptureStream.java

    arguments: '-u' ' dcampoy / *' '-schema ' 't_super_user' '-v' "CaptureStream.java".

    creation: source T_SUPER_USER. CaptureStream

    loading: source T_SUPER_USER. CaptureStream

    Error creating source CaptureStream

    ORA-06550: line 1, column 75:

    PLS-00201: identifier ' DBMS_JAVA. SET_COMPILER_OPTION' must be declared

    ORA-06550: line 1, column 75:

    PL/SQL: Statement ignored

    ORA-06550: line 1, column 239:

    PLS-00201: identifier 'NameFromLastDDL' must be declared.

    ORA-06550: line 1, column 231:

    PL/SQL: Statement ignored

    Audits

    SQL > DESC DBMS_JAVA

    ERROR:

    ORA-04043: object DBMS_JAVA does not exist

    Runtime Environment Java was also (JAVA_HOME, $PATCH, and)$LD_LIBRARY_PATH)

    There are other tables with stored java information but I'm unable to find those queries I has used last week. I do remember every time they were ran zero rows were returned. I will try and get that information. Any assistance is much appreciated thank you.

    Thank you! That seemed to be the case because I had to install java in the database running the two files below sql. I also ran select it under check that java has not been installed. After installing both .sql files, I was able to download my java files successfully.

    SQL > @? / JavaVM/install/initjvm. SQL and

    SQL > @? / RDBMS/admin/catjava. SQL

    set line 200

    wrap off Set

    Col ComputerName format a20

    Select ComputerName, VERSION, dba_registry;

    COMPUTERNAME Version STATUS

    -------------------- ------------------------------ --------------------------------------------

    Oracle Enterprise Manager 11.2.0.3.0 VALID
    Oracle 11.2.0.3.0 database catalog VALID
    Oracle 11.2.0.3.0 database Pack VALID
    Oracle Real Application 11.2.0.3.0 VALID
  • Re: "insufficient privileges" error when you run the Java stored procedure in another schema

    I get an "insufficient privileges" error when you run the Java stored procedure in another schema, see details below.  I don't know what are missing privileges (I already granted the EXECUTE privilege), suggestions?  -Thank you.

    Define a simple java class and deploy it as a Java stored procedure to test:


    Schema: User1

    test of the package;

    public class HelloWorld {}

    public HelloWorld() {

    Super();

    }

    public static String Hello () {}

    Return "HELLO";

    }

    }

    CREATE or REPLACE FUNCTION HELLO RETURN VARCHAR2 AUTHID CURRENT_USER AS LANGUAGE JAVA NAME ' test. HelloWorld.hello () return java.lang.String';

    Grant execute on USER2 HELLO

    Test the Java stored procedure through the PL/SQL function call (in the same schema):


    Schema: User1

    SET SERVEROUTPUT ON

    DECLARE

    v_Return VARCHAR2 (200);

    BEGIN

    v_Return: = User1. HELLO;

    DBMS_OUTPUT. Put_line ('v_Return =' | v_Return);

    END;

    anonymous block filled

    v_Return = HELLO

    Test the Java stored procedure through the PL/SQL function call in a different pattern:


    Schema: USER2

    SET SERVEROUTPUT ON

    DECLARE

    v_Return VARCHAR2 (200);

    BEGIN

    v_Return: = User1. HELLO;

    DBMS_OUTPUT. Put_line ('v_Return =' | v_Return);

    END;

    Error report-

    ORA-01031: insufficient privileges

    ORA-06512: at "User1." HELLO', line 1

    ORA-06512: at line 4 level

    01031 00000 - "insufficient privileges".

    * Cause: An attempt was made to change the user name or password

    without the privilege appropriate. This error also occurs if

    trying to install a database without the need for employment

    access privileges.

    When Trusted Oracle is configure in DBMS MAC, this error may occur

    If the user has been granted the privilege necessary for a higher label

    that the connection is active.

    * Action: Ask the database to perform the operation or grant administrator

    the required privileges.

    For users Trusted Oracle get this error, well that granted the

    the privilege that is suitable for the top label, ask the database

    administrator to grant the privilege to the appropriate label.

    You have created the function with AUTHID CURRENT_USER, which means that the function is executed with the rights of the applicant (but not with the rights of the author). This means that the applicant must have grants (directly or through roles) on all used/accessible objects in the service. In your case the user USER2 has not granted with EXECUTE on the class/source Java test. Class HelloWorld, causing the ORA-01031 exception. You create service without AUTHID CURRENT_USER (i.e. with AUTHID DEFINE, which is by default, if you do not have a specific reason to use AUTHID CURRENT_USER) or grant EXECUTE on JAVA test SOURCE. Class HelloWorld to User2.

    Dimitar

  • Can we do non-mandatory parameter of stored procedure?

    Can we make a parameter in the stored procedure as a non-mandatory? so that we can call the stored procedure with parameters?

    Assign a default value, for example

    p_someparameter IN INTEGER DEFAULT 0
    

    or

    p_someparameter IN INTEGER := 0
    

    Syntax of the parameter

  • Use the utilities from the Oracle stored procedure

    Hi all

    I use Oracle Import to load the data from .dmp file to Oracle table.

    Test/test leader IMP = Data .dmp fromuser = user1 touser = test tables = emp

    But my requirement is to create a stored procedure that will import data into the table and identify the number of loaded records and how impossible to import.

    Can I keep inside the procedure import statement?

    Thank you.

    No, not possible.

    IMP is an exe like sql more who can evoke to the command prompt.

    If you need all the actions on the imported... table export for example/test table, and then go further.

  • Delete records from sys.aud$ stored procedure

    We have a stored procedure that attempts to move the records from the table of sys.aud$ to a history table (in order to keep sys.aud$ to a more reasonable size, I guess - full disclosure, I have not written this proc). Base flow is:
    Select count (*) in the number of lines of sys.aud$
    If {(rowcount > 1000)
    copy all rows in sys.aud$ in the history table
    remove from sys.aud$
    }

    I says this proc used to work perfectly in a troubled past (I'm new on the client) but now has not worked for a while. When we try to compile the proc, we get the error
    "table or view does not exist", and the line is the "deletion of sys.aud$. The line "select count (*) from sys.aud$ ' seems to cause no problems, but the proc does not compile as is. If I comment out the line "remove from sys.aud$", however, the proc compiles very well.

    Confusingly, if I log in as the same account that owns this proc, I can run both the count (*) select from sys.aud$ AND remove clauses sys.aud$ with no complaint at all (by modifying slightly to work with 1 single record at a time, of course), but I can't seem the same to compile in a stored proc.

    I guess that it is related permissions? Can someone point me to the permissions of the owner needs to be able to remove from sys.aud$ in a stored procedure? Or is there something else that needs to be done here? Pointers much appreciated.

    Thank you.

    956928 wrote:
    We have a stored procedure that attempts to move the records from the table of sys.aud$ to a history table (in order to keep sys.aud$ to a more reasonable size, I guess - full disclosure, I have not written this proc). Base flow is:
    Select count (*) in the number of lines of sys.aud$
    If (rowcount 1000 >) {}
    copy all rows in sys.aud$ in the history table
    remove from sys.aud$
    }

    I says this proc used to work perfectly in a troubled past (I'm new on the client) but now has not worked for a while. When we try to compile the proc, we get the error
    "table or view does not exist", and the line is the "deletion of sys.aud$. The line "select count (*) from sys.aud$ ' seems to cause no problems, but the proc does not compile as is. If I comment out the line "remove from sys.aud$", however, the proc compiles very well.

    Confusingly, if I log in as the same account that owns this proc, I can run both the count (*) select from sys.aud$ AND remove clauses sys.aud$ with no complaint at all (by modifying slightly to work with 1 single record at a time, of course), but I can't seem the same to compile in a stored proc.

    I guess that it is related permissions? Can someone point me to the permissions of the owner needs to be able to remove from sys.aud$ in a stored procedure? Or is there something else that needs to be done here? Pointers much appreciated.

    Thank you.

    acquired through ROLE privileges are NOT applicable within the named PL/SQL procedures.

    GRANT DELETE ON SYS. AUD$ ;

  • The JNI in Java, stored procedure call

    Dear,
    I want to know how to call stored procedure JNI Java. How to configure my java.library.path in Oracle to get a specific directlry containing DLLs file inorder to System.loadLibrary ("< dll_file_name >");

    Not sure if I'm on the right track, but it seems that Oracle does not support JNI.

    http://download.Oracle.com/docs/CD/B19306_01/Java.102/b14187/chthree.htm#CACFCDJF


    Oracle database does not support the use of JNI in Java applications. If you use JNI, then your application is not 100% pure Java and native methods need porting between platforms. Native methods can result in a server crash, violating the security and corrupted data.

  • How can I extract audio from a movie stored on the Photos?

    I have a new 6 iPhone more. Great phone and it records very well.

    On my Mac, OS X 10.11.1 El Capitan

    I used the phone and recently recorded a concert. I had a guy time to get the movies my phone is off. Is there a way to view the files from my phone directory?

    I finally got the film in Photos. Now, I can't do anything with them. I want to extract audio from movies and a CD of the concert.

    I found some third-party software, , but they cannot see the pictures.

    Also, the movies seem to have maxed out my iCloud storage. Another problem, but related. What is the best way to store/backup these images on my computer so that they are accessible from the finder, and will not be removed by synchronization?

    It is a bit nuts, IMO. Should be much more consistent and intuitive.

    Thanks for your help.

    Export the photo sequence: file-> Export, export unmodified: Original

    It's all about Photos.

    Further, use the Image Capture (in the Applications folder) for material like this.

    As for extract the soundtrack. Open the movie in QT player and then export it in Audio-only mode

    Export only the audio using QuickTime Player 10


    QuickTime Player gives you the option to export and share only the audio portion of your video. To export only the audio portion of your video, you can open your video in QuickTime Player. Choose export from the file menu. Type a name in the field "export as. Then on the Format menu, choose 'Audio Only' and click on export

    .

  • How to use the nocopy with java stored procedures parameters

    
    --------------------------------------------------------------------------------
    Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
    PL/SQL Release 11.2.0.3.0 - Production
    CORE    11.2.0.3.0      Production
    TNS for Linux: Version 11.2.0.3.0 - Production
    NLSRTL Version 11.2.0.3.0 - Production
    
    

    I'm a PL/SQL programmer, but not a Java programmer. I have the following java function that does what it's supposed to add a pdf at the end of another pdf document:

    import oracle.sql.BLOB;
    import org.apache.pdfbox.util.PDFMergerUtility;
    import oracle.jdbc.OracleConnection;
    import oracle.jdbc.driver.OracleDriver;
    import java.io.OutputStream;
    
    public class PDFUtilities {
    public static BLOB appendPDF(BLOB pdfdoc1, BLOB pdfdoc2) throws Exception {
           
            //create a connection object to the current instance
              OracleConnection conn = (OracleConnection)new OracleDriver().defaultConnection();
            //create the output blob using the connection
              BLOB outPDF = BLOB.createTemporary(conn, true ,BLOB.DURATION_SESSION);
            //create an output stream to the output blob
              OutputStream os = outPDF.setBinaryStream(0);               
            //instantiate the pdf merger utility
              PDFMergerUtility mergerUtility = new PDFMergerUtility();       
            //connect the merger to the output stream
              mergerUtility.setDestinationStream(os);
            //stream from each input blob into the merger utility
              mergerUtility.addSource(pdfdoc1.getBinaryStream());
              mergerUtility.addSource(pdfdoc2.getBinaryStream());
            //merge the 2 input pdfs
              mergerUtility.mergeDocuments();             
            //do not close the output stream
            //return the blob
            return outPDF;
        }
    
    }
    

    CREATE OR REPLACE package PDFTOOLS.pkg_pdf_utilities
    as
    function f_get_merged_pdf (
              pi_pdf1       blob
            , pi_pdf2    blob
      )
      return blob;
    end pkg_pdf_utilities;
    /
    
    CREATE OR REPLACE package body PDFTOOLS.pkg_pdf_utilities
    as
    function f_get_merged_pdf (
              pi_pdf1       blob
            , pi_pdf2    blob
      )
      return blob
      as language java name 
      'com.mycode.pdftools.PDFUtilities.appendPDF(oracle.sql.BLOB, oracle.sql.BLOB) return oracle.sql.BLOB';
    end PDFTOOLS.pkg_pdf_utilities;
    /
    

    It's very basic, but doesn't seem to work. However, I want to my function from PL/SQL to a procedure that looks like this:

    CREATE OR REPLACE package PDFTOOLS.pkg_pdf_utilities
    as
    procedure sp_append_pdf (
              pio_pdf2append2   IN OUT NOCOPY blob
            , pio_pdf2append   IN OUT NOCOPY blob
      )
    end pkg_pdf_utilities;
    /
    

    What is important, what I'm trying to do is to NOCOPY the BLOBs. Otherwise, I have to read my PDF files into 2 BLOBs and create a 3rd blob as output. I prefer to be able to keep the pio_pdf2append2 as the final output. What I actually do call thing in a loop to gradually add a PDF file to a big. I'm not linking this in one operation because of concerns over the use of the system and because the pdfbox library java has would have been question after 850 in PDF format, which is not completely unrealistic in my approach.

    How could I achieve this?

    Post edited by: Pollocks01 only formatted code blocks because atlassian {code} tags didn't work.

    Passage of an argument as input/OUTPUT requires the mapping to a Java array.

    Simplified example that adds one FOR the other:

    create or replace and compile java source named blob_appender_src as
    import oracle.sql.BLOB;
    import java.sql.SQLException;
    import java.io.OutputStream;
    import java.io.InputStream;
    import java.io.IOException;
    
    public class BLOBAppender {
        public static void run (BLOB[] p1, BLOB p2) throws SQLException, IOException { 
    
            InputStream is = p2.getBinaryStream();
            OutputStream os = p1[0].setBinaryStream(p1[0].length()+1);                
    
            byte[] buffer = new byte[1024];
            int len;
            while ((len = is.read(buffer)) != -1) {
                os.write(buffer, 0, len);
            }
            os.close();
            is.close();
        }
    }
    
    create or replace procedure blob_append (
      p_lob1  in out nocopy blob
    , p_lob2  in            blob
    )
    as language java name 'BLOBAppender.run(oracle.sql.BLOB[], oracle.sql.BLOB)' ;
    /
    
    SQL> declare
      2    p_lob1  blob := utl_raw.cast_to_raw('ABC');
      3    p_lob2  blob := utl_raw.cast_to_raw('DEF');
      4  begin
      5    blob_append(p_lob1, p_lob2);
      6    dbms_output.put_line(utl_raw.cast_to_varchar2(p_lob1));
      7  end;
      8  /
    
    ABCDEF
    
    PL/SQL procedure successfully completed.
    
  • Impossible to use Java stored procedure java.nio.file package

    Hello

    I want to use the classes in the java.nio.file package but I have the problem that the classes are not loaded in the database (oracle 12 c with jvm) installed. I can't put my class in the database and use it in my procedure. It is always invalid because of the java.nio.file dependencies. Is it possible to load the java.nio.file package for use in my PB? I tried to load it via loadjava but then I get the error ORA-29552 java.lang.SecurityException: prohibited package name: java.nio.file.

    Thank you and best regards,

    Kai

    Java.nio.file package is available starting with Java 1.7, while Oracle 12 c JVM is 1.6, simple as that.

  • call a packed stored procedure from within another stored procedure

    I have a stored procedure (STROKEQC) on a scheme that is not in a package. I want to be able to call a procedure stored that IS inside a package on the same scheme of STROKEQC. When I try the syntax below, I get an error "no function with name 'PARTICIPANTSPECIFICEDITS' exists in this area." That the procedure exists.
    /*Generate admin field data*/
        execute immediate QCPROCEDURES.PARTICIPANTSPECIFICEDITS('ALL');        
        execute immediate QCPROCEDURES.GENERATE_SURGYEAR_ERRFLAG;
    Is not the way to do inside a stored procedure?

    Thank you!
    Eva

    Hi, Eva,.

    You need not EXECUTE IMMEDIATE to call a stored procedure (including a procedure in a package) on the other. Just use the name and the arguments (if any):

    QCPROCEDURES.PARTICIPANTSPECIFICEDITS('ALL');
    QCPROCEDURES.GENERATE_SURGYEAR_ERRFLAG;
    

    I guess qcprocedures is the package name, and participantspecificedits and generate_surgyear_errflag are procedures in this package.

    In case you're wondering, the error was probably because you do not have a variable called participantspecificedits. If you had a dynamic code in a string called variable x, then "EXECUTE IMMEDIATE x"; would be the way to run it.

Maybe you are looking for