Passing % ROWTYPE array to a stored procedure using JDBC

Hello

I have the following code:

create or replace package PCK_COLLECT_MESSAGES_CSR
as
TYPE TY_TA_KPMESSAGE_ROWTYPE IS TABLE OF M_MESSAGECOLLECTION % ROWTYPE;
procedure insert_messages (messages IN TY_TA_KPMESSAGE_ROWTYPE);
end PCK_COLLECT_MESSAGES_CSR;

I would like to pass an array of M_MESSAGECOLLECTION % ROWTYPE to the stored procedure using JDBC, because I want to use the FORALL statement to perform a quick insert in the procedure.

Is this possible using JDBC? Oracle version is 10g.

Thank you in advance,
Kind regards

Markus.

% rowtype declarations are native to pl/sql and are not accessible from outside its limits, something to think about when you're designing apis.

To work around the problem, you can create an anonymous pl/sql block that can access the definitions of % rowtype.

  String sql = "declare r dual%rowtype; begin r.dummy := :x; end;";

  CallableStatement cs = conn.prepareCall(sql);

  cs.setString(1, "x");

  cs.execute();

Tags: Oracle

Similar Questions

  • How pass an array into a php url using the flex http service?

    How pass an array into a php url using the flex http service?
    im making something like this:
    http://localhost/flex_php/example_return_xml.php?id= {mylist}
    -mylist? TABLE
    -If I try to use a text variable it works for example. {myvar.text} where myvar is a text input

    Any idea!

    How can I get using XML?
    I tried to push the table in a textinput & sent the text of entry in php, it worked!

  • How to pass an object of the stored procedure?

    Hello.

    After reading the documentation online 'The JDBC Oracle9i developer reference Guide' how to use oracle.sql.STRUCT to pass the java classes to database objects and how do the same thing in the sense opposite, I still don't know how to do what I need, I would like to know a few resourse online where I could find more examples.
    I guess it must be quite easy to do.

    I learned to create a java class that will be used to call a stored procedure (9i database) that has a single input/output parameter whose type is a user-defined object.

    I'm trying to do something similar, by I was not able. This is my essay:

    CREATE OR REPLACE TYPE                  FERNANDO.TIPOBD AS OBJECT (   ID INTEGER,   NOMBRE VARCHAR2(50),   HORA TIMESTAMP ); / CREATE OR REPLACE PACKAGE FERNANDO.prueba_java AS   PROCEDURE prueba (objetoJava IN OUT TIPOBD); END prueba_java; / CREATE OR REPLACE PACKAGE BODY FERNANDO.prueba_java AS   PROCEDURE prueba (objetojava IN OUT TIPOBD)   AS   BEGIN       NULL;   END prueba; END prueba_java; /
    import java.sql.*; //import oracle.sql.*; import oracle.jdbc.*; import oracle.sql.*; public class Prueba { public static void main(String[] args) { Connection conexion = GestorConexion.getConexion(); if (conexion != null) {   try {     DatabaseMetaData meta = conexion.getMetaData();     System.out.println("JDBC driver version is " + meta.getDriverVersion()); int num = 0; String consulta = "select 1 from dual"; PreparedStatement ps = conexion.prepareStatement(consulta); ResultSet rs = ps.executeQuery(); if (rs.next()) { num = rs.getInt(1); } System.out.println("num == "+num); ObjetoOracle oo = new ObjetoOracle(1, "Fernando", new Timestamp(1) ); System.out.println("id: "+oo.getId()+"; nombre: "+oo.getNombre()); // Se llama al procedimiento almacenado String llamada = new String(); llamada += "BEGIN "; llamada += "  FERNANDO.prueba_java.prueba(?)"; llamada += "END;"; StructDescriptor structdesc = StructDescriptor.createDescriptor("FERNANDO.TIPOBD", conexion); STRUCT struct = new STRUCT(structdesc, conexion, null); OracleCallableStatement ca = (OracleCallableStatement)conexion.prepareCall(llamada); //ca.setObject(1, oo); ca.setObject(1, null); ca.registerOutParameter(1, OracleTypes.JAVA_OBJECT); ca.execute(); } catch (SQLException sqle) { System.out.println(sqle.toString()); } } else { System.out.println("CONEXIÓN con bd nula"); } } }

    My if intend to create an oracle.sql.STRUCT object that I'll pass to the procedure and then get back to the procedure, but I can not even create the StructDescriptor.
    It is the output that I get:

    Conexión con BD ok JDBC driver version is 9.2.0.8.0 num == 1 id: 1; nombre: Fernando java.sql.SQLException: Tipo no definido: get_next_type

    Any help would be welcome. Thanks in advance.

    You must add the name of the type of your call registerOutParameter (.).
    ca.registerOutParameter ("", OracleTypes.JAVA_OBJECT, FERNANDO. TIPOBD);

    You can consider using OracleTypes.STRUCT instead of JAVA_OBJECT.

    You must also change your call set *;.
    ca.setObject ("", FERNANDO of the object. TIPOBD, OracleTypes.STUCT);

    You can use the same string parameter "" to the two parameters or
    You can use the same parameter INT for both parameters.

    You cannot combine parameters named and numbered together. I was using both for a single method or both using the other.
    The syntax may be different according to the method you in order to verify the Java Doc.

  • How can I transfer content from an XML file in a MS SQL database of the stored procedure using LabWindows/CVI SQL Toolkit?

    Hello

    I have a problem to transfer content to an XML file in a MS SQL database through a stored procedure data/fixed. I am able to transfer the content of the file using method...

    HSTMT = DBPrepareSQL (hdbc, EXEC usp_InsertReport " ... ");

    resCode = DBExecutePreparedSQL (hstmt);

    resCode = DBClosePreparedSQL (hstmt);

    ... but in this case, I am not able to read the return value of the stored procedure.

    I tried to follow the example of the stored procedure in the help documentation (DBPrepareSQL), but I miss a xml data type?

    No idea how to solve my problem?

    Cake of KR

    DianaS salvation,

    Thanks for your comments. During this time I found another way which fullfill my needs:

    resCode = DBSetAttributeDefault (hdbc, ATTR_DB_COMMAND_TYPE, DB_COMMAND_TEXT);

    sprintf (sz_SqlStatement, "DECLARE @TESTID INT EXEC @TESTID = usp_InsertReport ' SELECT 'RetVal' %s = @TESTID", sz_Buffer ");
    HSTMT = DBActivateSQL (hdbc, sz_SqlStatement);

    While ((resCode = DBFetchNext (hstmt)) == DB_SUCCESS)

    {

    / * Enter values in the record. */

    resCode = DBGetColInt (hstmt, 1, & s32_TestId);
    }

    resCode = DBDeactivateSQL (hstmt);

    sz_Buffer is the content of the XML file.

    Cake of KR

  • Join vs stored procedure using Decode

    We have a huge table lines and I noticed that the data architect has incorporated a descriptor column extend the length of line so that violate the rules of normalization.

    Given that the column descriptor is not accessible often (with the exception of reports), I propose to eliminate and replace it with a separate table to reach via FK in the big picture.

    There are less than 100 entries in the reference table.

    I see an advantage by creating a stored procedure that returns the descriptor based on the passed key?

    Or is smart enough to perform a join that is essentially as effective as this approach in Oracle memory?

    Yes, there are relevant reasons

  • Insert or update trigger by passing the value to the stored procedure

    My task is to write a trigger that will pass a value for an insert or update to a stored procedure.

    It's Friday and I am not clear thinking, forgive me...


    Create or replace trigger < name of the trigger >

    After you insert or update table XXX
    for each line


    Run the Just_Do_It procedure
    (userid = new.user_id).


    If the table XXX has the userid column, and I want the trigger to get it and send it to Just_Do_It.
    what Miss me?

    Thank you.
    CREATE OR REPLACE TRIGGER trigger_name
      AFTER INSERT OR UPDATE ON table_name
      FOR EACH ROW
    BEGIN
      just_do_it( :new.user_id );
    END;
    

    Justin

  • Passing the params in mysql stored procedure

    Makes no mistake, but when I hard code the values in the stored procedure, I get results, I leave as params - if not.
    Something must be a miss with how I said, but I can't understand that:

    Can anyone help? details below:

    : the stored procedure:

    Create procedure keyword_getBySource (in sourceRecordName varchar (20), in sourceRecordId varchar (50))
    Start
    Select
    tblkeyword.*
    Of
    tblkeyword,
    tblrecordlink
    where
    tblrecordlink.sourceRecordName = @sourceRecordName
    and
    tblrecordlink.sourceRecordId = @sourceRecordId
    and
    tblrecordlink.linkRecordName = 'keyword'
    and
    tblkeyword.keywordId = tblrecordlink.linkRecordId
    ;
    end

    : cfm:

    "< cfstoredproc procedure ="keyword_getBySource"datasource =" "username =" "password =" ">
    < cfprocparam type = 'in' cfsqltype = "CF_SQL_VARCHAR" dbvarname = "sourceRecordName" value = "Log" / >
    < cfprocparam type = 'in' cfsqltype = "CF_SQL_VARCHAR" dbvarname = "sourceRecordId" value = "0d8a6d3e-cf1e - 19(d) 5-2b9fc8ee1de01ad0" / >
    < name cfprocresult = resultset "getBySource" = "1" / >
    < / cfstoredproc >

    @... seems mysql does not use these to designate the params in a stored procedure

    Take them out - it works.

  • Pass an array of bytes to the oracle stored procedure

    I have a problem with moving from byte array in Oracle stored procedure as an input parameter by using odp.net.

    Here is the signature of the stored procedure:

    SOMEPROCEDURE(session IN NUMBER, data IN RAW)

    Here is c# code, which calls the procedure:

    var cmd = new OracleCommand("SOME_PROCEDURE", _connection);

    cmd.CommandType = CommandType.StoredProcedure;

    var bt = new byte[]{1,68,0,83,128,1};

    OracleParameter sessionId = new OracleParameter("dbSessionId", OracleDbType.Decimal, new OracleDecimal(_dbSessionId), ParameterDirection.Input);

    OracleParameter data = new OracleParameter("statusData", OracleDbType.Raw, new OracleBinary(bt), ParameterDirection.Input);

    cmd.Parameters.Add(sessionId);

    cmd.Parameters.Add(data);

    cmd.ExecuteNonQuery();

    This code does not (stored procedure throws exception, which cannot receive), because in byte array hadou number 128!, if I display 128 on another number, minus 128, it works great!

    What should I do?

    After some tests I found the solution. Initially, you cannot switch to the array of bytes via the odp.net stored procedure, if the table contains 127 large values.

    Yes, solution: 1. create the wrapper procedure

    procedure SOME_PROCEDURE_WRAPPER (p_session_id in number, p_data  in varchar2)
     is v_data raw(1024);
     rawdata raw(1024); 
     rawlen number;
     hex varchar2(32760);
     i number;
     begin
      rawlen := length(p_data);
      i := 1;
      while i <= rawlen-1
      loop 
     hex := substrb(p_data,i,2); 
         rawdata := rawdata || HEXTORAW(hex); 
         i := i + 2; end loop; 
         SOME_PROCEDURE(p_session_id , rawdata); 
     end;
    

    2 then need to modify the code c# in this way:

     var cmd = new OracleCommand("SOME_PROCEDURE_WRAPPER", _connection);
     cmd.CommandType = CommandType.StoredProcedure;
     string @string = statusData.ToHexString();
     OracleParameter sessionId = new OracleParameter("dbSessionId", OracleDbType.Decimal, new OracleDecimal(_dbSessionId), ParameterDirection.Input);
     OracleParameter data = new OracleParameter("statusData", OracleDbType.Varchar2,@string.Length, new OracleString(@string), ParameterDirection.Input);
     cmd.Parameters.Add(sessionId);
     cmd.Parameters.Add(data);
     cmd.ExecuteNonQuery();
    

    where

    public static string ToHexString(this byte[] bytes)
     { 
         if(bytes == null || bytes.Length == null)
               return string.Empty;
          StringBuilder hexStringBuilder = new StringBuilder();
          foreach (byte @byte in bytes)
          { 
              hexStringBuilder.Append(@byte.ToString("X2")); 
          } 
          return hexStringBuilder.ToString();
     }
    
  • Tables created in a stored procedure cannot be used with dynamic SQL? The impact?

    There is a thread on the forum which explains how to create tables within a stored procedure (How to create a table in a stored procedure , however, it does create a table as such, but not how to use it (insert, select, update, etc.) the table in the stored procedure.) Looking around and in the light of the tests, it seems that you need to use dynamic SQL statements to execute ddl in a stored procedure in Oracle DB. In addition, it also seems that you cannot use dynamic SQL statements for reuse (insert, select, update, etc.) the table that was created in the stored procedure? Is this really the case?

    If this is the case, I am afraid that if tables cannot be 'created and used"in a stored procedure using the dynamic SQL, as is the case with most of the servers of DB dynamic SQL is not a part of the implementation plan and, therefore, is quite expensive (slow). This is the case with Oracle, and if yes what is the performance impact? (Apparently, with Informix, yield loss is about 3 - 4 times, MS SQL - 4 - 5 times and so on).

    In summary, tables created within a stored procedure cannot be 'used' with dynamic SQL, and if so, what is the impact of performance as such?

    Thank you and best regards,
    Amedeo.

    Published by: AGF on March 17, 2009 10:51

    AGF says:
    Hi, Frank.

    Thank you for your response. I understand that the dynamic SQL is required in this context.

    Unfortunately, I am yet to discover "that seeks to" using temporary tables inside stored procedures. I'm helping a migration from MySQL to Oracle DB, and this was one of the dilemmas encountered. I'll post what is the attempt, when more.

    In Oracle, we use [global temporary Tables | http://www.psoug.org/reference/OLD/gtt.html?PHPSESSID=67b3adaeaf970906c5e037b23ed380c2] aka TWG these tables need only be created once everything like a normal table, but they act differently when they are used. The data inserted in TWG will be visible at the session that inserted data, allowing you to use the table for their own temporary needs while not collide with them of all sessions. The data of the TWG will be automatically deleted (if not deleted programmatically) when a) a commit is issued or b) the session ends according to the parameter that is used during the creation of the TWG. There is no real need in Oracle to create tables dynamically in code.

    I noticed that many people say that the "Creation of the tables within a stored procedure" is not a good idea, but nobody seems necessarily explain why? Think you could elaborate a little bit? Would be appreciated.

    The main reason is that when you come to compile PL/SQL code on the database, all explicit references to tables in the code must correspond to an existing table, otherwise a djab error will occur. This is necessary so that Oracle can validate the columns that are referenced, the data types of those columns etc.. These compilation controls are an important element to ensure that the compiled code is as error free as possible (there is no accounting for the logic of programmers though ;)).

    If you start to create tables dynamically in your PL/SQL code, so any time you want to reference this table you must ensure that you write your SQL queries dynamically too. Once you start doing this, then Oracle will not be able to validate your SQL syntax, check the types of data or SQL logic. This makes your code more difficult to write and harder to debug, because inevitably it contains errors. It also means that for example if you want to write a simple query to get that one out in a variable value (which would take a single line of SQL with static tables), you end up writing a dynamic slider all for her. Very heavy and very messy. You also get the situation in which, if you create tables dynamically in the code, you are also likely to drop tables dynamically in code. If it is a fixed table name, then in an environment multi-user, you get in a mess well when different user sessions are trying to determine if the table exists already or is the last one to use so they can drop etc. What headache! If you create tables with table names, then variable Dynamics not only make you a lot end up creating (and falling) of objects on the database, which can cause an overload on the update of the data dictionary, but how can ensure you that you clean the tables, if your code has an exception any. Indeed, you'll find yourself with redundant tables lying around on your database, may contain sensitive data that should be removed.

    With the TWG, you have none of these issues.

    Also, what is the impact on the performance of the dynamic SQL statements in Oracle? I read some contrasting opinions, some indicating that it is not a lot of difference between static SQL and SQL dynamic in more recent versions of Oracle DB (Re: why dynamic sql is slower than static sql is this true?)

    When the query runs on the database, there will be no difference in performance because it is just a request for enforcement in the SQL engine. Performance problems may occur if your dynamic query is not binding variable in the query correctly (because this would cause difficult analysis of the query rather than sweet), and also the extra time, to dynamically write the query running.

    Another risk of dynamic query is SQL injection which may result in a security risk on the database.

    Good programming will have little need for the tables of dynamically created dynamically or SQL.

  • [BC] Call a stored procedure taking parameters of table

    Hello!

    I currently have a request of the OIC that makes thousands of calls per second stored procedure. The stored procedure runs a business logic that I want my client application to stay informed.  I want to reduce the cat of the database and instead to call the stored procedure from thousands of times per second, call the procedure (for example) once per second, but with values of one mile.

    I used OCIBindArrayOfStruct successfully to perform inserts bulk, where my OCI application executes a () INSERT INTO using the function "iters" and it might be possible to do something similar with the stored procedure, but I want to do something slightly different, because the procedure stored something like this:

    * If a specific condition is set, call a secondary stored procedure

    * If another special condition is set, insert a row into a table of some

    I so wanted to do was to pass a table (or a series of tables) in the stored procedure, then the stored procedure to use optimal methods that are available, such as FORALL, to perform each of the tasks, the more effectively.

    So I thought to create a type, such as a TABLE OF VARCHAR2, or a VARRAY and possessing of the parameters for the stored procedure based on this type, something like:

    create or replace TYPE 'NTT_VARCHAR2' AS TABLE OF VARCHAR2 (32700);

    create or replace FUNCTION bulk_process_values)

    p_error_message OUT NOCOPY VARCHAR2,

    p_module_context_name OUT NOCOPY VARCHAR2,

    p_sql_error OUT NOCOPY VARCHAR2,

    p_count in NUMBERS

    p_non_array_var_1 IN VARCHAR2,

    p_non_array_var_2 IN VARCHAR2,

    p_array_var_1 IN NTT_VARCHAR2,

    p_array_var_2 IN NTT_VARCHAR2,

    p_array_var_3 IN NTT_VARCHAR2

    < etc. for all the variables in table >)

    RETURN NUMBER

    .. .but I am struggling to find an example of how call the procedure "bulk_process_values" stored, and even if I use a TABLE OF VARCHAR2 or a VARRAY as a parameter type.

    I searched the Internet and found this: OIC - how to bind an array to a stored procedure? - and binding table of the structs (OCIBindArrayOfStruct) sample code

    - but they take different approaches and a bit confused (the second example spoke of OTT).

    I think that the first approach is more likely to be the solution I need - but I can't help thinking - it is a bunch of stuff to move if it does not end up significantly improve performance!

    My questions are:

    * Moves to a call-SP-thousands-of-times-per-second to call-SP-fewer-times-but-with-array-parameters sensitive?

    * Should the table or VARRAY, TABLE OF VARCHAR2 parameters or something else?

    * Should I use for my case OTT?

    Samples I found are both very old - and the second example indicators that the optimal approach evolves with the OCI versions - I'm on 11.2, what is the optimal approach these days?

    * < added later > why is there no official useful example?

    Thank you very much

    Much appreciated. https://community.oracle.com/message/4528528#4528528 has actually worked, with VARRAY, with a proof of concept. Now I just need to shake a little and then get my PL/SQL for optimal PC experts. I think I was really discouraged by the lack of official documents, with the Community (Paradise) is the only way to get real results.

    Thank you JJ.

    I intend me to use the binding enforcement of the table and the table and avoid N back and forth, but I do not then get the opportunity to do something clever in the PL/SQL.

    In the PL/SQL, there is no logic occurring - I don't call the same SP tons of times, but then I want to be able to use PL/SQL optimizations such as FORALL, BULK COLLECT, reduce the number of validations and others.  There is a commit after each SP run, because otherwise the nature of demand means that the application hangs occur; However, there is a way (I think) be smart on the part that is likely to deadlock (making a shape on the Bay First, then applying the updates in the order sorted and then failed to get a blocking theoretically), and then FORALL insert for the second part of the stored procedure.

    I guess I may apply the single return, passing a table (to a commit in the SP)-which will reduce back and forth, so gain in performance, but it will not reduce the number of validations that I do - and Oracle said that commits too frequent is not good for performance. I already have code in my framework that does - by making a simple INSERT INTO.

    Good to hear that OTT is not explicitly required - and VARRAY resembles the approach to try first.

  • The call PLSQL stored procedure from the HTML form Submit button

    Hello

    I'm having a little difficulty with the appellant a stored procedure using a html form button. Here is the code I have right now...
    HTP.PRINT('<form action=ZWGKERCF.P_confdelete>');
    HTP.PRINT('<input type=''submit'' value='' Yes '' onClick=''document.getElementById("mypopup").style.display="none"''>');
    HTP.PRINT('</form></div>');
    Here's the question - I need to find a way to pass variables to this stored procedure, so he knows what data to operate on. This stored procedure removes the data in a specific database record and I have to pass three variables to this procedure to run.

    Allows to call class_number, term, conf will impact these three variables and the data will be deleted and the person will see a confirmation screen once the deletion request completed.

    So ideally I would want: ZWGKERCF. P_confdelete (class_number, term, conf), then the stored procedure would deal with the rest!

    Seems simple enough, but I don't know how to make this happen... My thoughts were:

    Transmit data to this (the three areas that I need) html form in hidden variables. Then somehow pass them using the POST method to the procedure and read using GET?

    Can someone clarify what the best way to do it? I feel that its little something miss me you - but I would really like an idea expertise :-)

    Thank you very much in advance!

    -Jeff

    >
    ...

    I would like to assign a variable, the duration, the conf crn all variables in this procedure and then act on them accordingly.

    But you already have it in a variable. If you want you can assign the value again to another variable.

    example of

    PROCEDURE P_confdelete(CRN NUMBER,TERM NUMBER, CONF VARCHAR2)
       IS
          v_crn number(38);
          v_term number(38);
          v_conf varchar2(1000);
    
      BEGIN
           HTP.PRINT('test1 '||crn||'/'||term||'/'||conf); 
    
          v_crn := crn;
          v_term := term;
          v_conf := conf;
    
          HTP.PRINT('test2 '||v_crn||'/'||v_term||'/'||v_conf); 
    
    END P_confdelete;
    
  • stored - procedure parameter problem table

    Hello

    I have the Oracle database version: 11.1.0.7
    I downloaded ojdbc5.jar for this version.
    and...

    I have stored procedure:
    PROCEDURE procedure_name (
     
         param1         IN       table1.objectid%TYPE,
         param2         IN       table1.objecttype%TYPE,
         param3         IN       table2.tariffid%TYPE,
         param4         IN       DATE,
         param5         IN       DATE,
         param6         IN       table3.saleschannelid%TYPE,
         param7         IN       rulemasteridtable,           
         param8         OUT      ruleid_table,
         param9         OUT      INT
        ); 
     
     
    type     SCHEMA.RULEMASTERIDTABLE as table of number(15 ,5)
     
    TYPE ruleid_table IS TABLE OF table4.rulemasterid%TYPE
    INDEX BY BINARY_INTEGER;
    As you can see the most interesting parameters are param7 and param8.

    I want to call this procedure using JDBC. I tried this way:
    OracleCallableStatement stmt = (OracleCallableStatement)connection.prepareCall(
     
                            "CALL SCHEMA.PKG.procedure_name(?, ?, ?, ?, ?, ?, ?, ?, ?)"); 
     
     
                stmt.setLong("param1", new Long(27167));
                stmt.setString("param2", new String("SOME_STRING")); 
                stmt.setLong("param3", new Long(27167)); 
     
                java.util.Date date = new java.util.Date();
                stmt.setDate("param4", new Date(date.getTime())); 
     
                java.util.Date date2 = new java.util.Date();
                stmt.setDate("param5", new Date(date2.getTime()));
     
                stmt.setLong("param6", new Long(1)); 
     
                ArrayDescriptor descriptor = ArrayDescriptor.createDescriptor("SCHEMA.RULEMASTERIDTABLE", connection);
                stmt.setArray("param7", new ARRAY(descriptor, connection, new Long[]{})); 
     
                stmt.registerOutParameter("param8",OracleTypes.PLSQL_INDEX_TABLE); 
     
                stmt.registerOutParameter("param9", Types.INTEGER); 
     
                stmt.executeUpdate();
    When I run this code I get an exception:
    Exception in thread "main" java.sql.SQLException: Missing IN or OUT parameter at index:: 8
          at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:70)
           ....
    I don't know why I get this exception. Could you explain to me what's wrong with my code?
    I think OracleTypes.PLSQL_INDEX_TABLE for my param8 is ok. If I use different type I get Exception: number or types of evil...

    Please help me and thank you in advance.
    Hubert

    I've never seen an OracleTypes.PLSQL_INDEX_TABLE in action before. Documentation:

    http://download.Oracle.com/docs/CD/E11882_01/Java.112/e10590/typesupp.htm

    "Note: there is a PLSQL_INDEX_TABLE type, but it does not appear to be used outdoors."

    You could look at using a registerIndexTableOutParameter.

    For an example, see:

    http://www.Oracle.com/technology/sample_code/tech/Java/sqlj_jdbc/files/Oracle10g/plsqltables/Readme.html

  • Error on the definition of the stored procedure in the simultaneous program

    Hello

    I created a stored procedure and wanted it attached to the concurrent program. The purpose of this stored procedure when you run it in simultaneous program, the system retrieves the data from the csv file downloaded from the server, then it will insert in the tables of SO / the Interface API. Below, the error occurred.


    * Starts * 18 April 2012 18:18:42
    Error ORACLE 6550 in FDPSTP

    Cause: FDPSTP failed due to the ORA-06550: line 1, column 7:
    PLS-00306: wrong number or types of arguments in the call to 'SPKO1 '.
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored

    Steps I did to set the stored proc
    < < simultaneous executable program > >

    Executable: RDRAGON_SO_IMPORT
    Short name: RDRAGON_SO_IMPORT
    Application: Order management
    Method of execution: PL/SQL, stored procedure
    Run file name: SPKO1

    < < concurrent program - set > >

    Program: RDRAGON SO IMPORT
    Short name: RDRAGON_SO_IMPORT
    Application: Order management
    Name of executable: RDRAGON_SO_IMPORT
    Method: PL/SQL, stored procedure

    Format: text
    No set

    -Here are my stored procedure-


    CREATE OR REPLACE PROCEDURE APPS. SPKO1 IS
    FH UTL_FILE. TYPE_DE_FICHIER;
    v_line VARCHAR2 (32767).
    v_source_id NUMBER (10);
    v_created_by NUMBER (10);
    v_creation_date DATE;

    v_org_id NUMBER (10);
    v_orig_sys_docref VARCHAR2 (50);
    V_Customer VARCHAR2 (360);
    v_customer_prev VARCHAR2 (360);
    v_sold_to_org NUMBER (10);

    v_orig_line_ref NUMBER (10);
    v_item_code VARCHAR2 (2000);
    v_ordered_qty NUMBER (10);
    v_selling_price NUMBER (10);
    v_count NUMBER (10);
    v_stat NUMBER;


    /******************************************************************************
    NAME: SPKO
    PURPOSE:

    REVISIONS:
    Worm Date Description of the author
    --------- ---------- --------------- ------------------------------------
    1.0 16/04/2012 administrator 1. Created this procedure.

    NOTES:

    Keywords to replace automatically available Auto:
    Object name: SPKO
    SYSDATE: 16/04/2012
    Date and time: 16/04/2012, 17:55:42 and 16/04/2012 17:55:42
    Username: admin (set in Options of TOAD, editor of the procedure)
    Name of the table: (defined in the dialog box "New PL/SQL object")

    ******************************************************************************/
    BEGIN
    v_source_id: = 6;
    v_created_by: = - 1;
    v_org_id: = 204;
    v_customer_prev: = null;
    v_orig_line_ref: = 0;
    v_stat: = 0;

    SELECT header_id in (DE) v_orig_sys_docref
    Select header_id
    of OE_ORDER_HEADERS_ALL
    creation_date desc order
    ) WHERE ROWNUM = 1;


    FH: = UTL_FILE. FOPEN ('XXANDDIR2', 'myfile1.csv', 'R', 32767);
    < < file_read_lines > >
    LOOP
    BEGIN
    UTL_FILE. GET_LINE (fh, v_line);

    V_Customer: = LTRIM (RTRIM (REGEXP_SUBSTR (v_line, "[^,] +' 1, 1") ',' "') ','" ');
    v_creation_date: = LTRIM (RTRIM (REGEXP_SUBSTR (v_line, "[^,] +' 1, 2") ',' "') ','" ');
    v_item_code: = LTRIM (RTRIM (REGEXP_SUBSTR (v_line, "[^,] +' 1, 3") ',' "') ','" ');
    v_ordered_qty: = LTRIM (RTRIM (REGEXP_SUBSTR (v_line, "[^,] +' 1, 4") ',' "') ','" ');
    v_selling_price: = LTRIM (RTRIM (REGEXP_SUBSTR (v_line, "[^,] +' 1, 5") ',' "') ','" ');
    v_orig_line_ref: = (v_orig_line_ref + 1);

    If v_stat = 0 then
    v_orig_sys_docref: = (v_orig_sys_docref + 1);
    end if;

    SELECT hca.cust_account_id from v_sold_to_org
    OF hz_cust_accounts AOB.
    HP hz_parties
    WHERE hca.party_id = hp.party_id
    AND hca.request_id is null
    AND hp.party_name = v_customer;

    If v_stat = 0 then
    INSERT INTO OE_HEADERS_IFACE_ALL)
    order_source_id,
    orig_sys_document_ref,
    org_id,
    CREATION_DATE,
    created_by,
    last_update_date,
    last_updated_by,
    operation_code,
    sold_to_org_id,
    booked_flag)
    VALUES)
    v_source_id,
    ('TEST' | v_orig_sys_docref).
    v_org_id,
    v_creation_date,
    v_created_by,
    v_creation_date,
    v_created_by,
    "INSERT."
    v_sold_to_org,
    'Y') ;
    commit;
    end if;

    INSERT INTO OE_LINES_IFACE_ALL)
    order_source_id,
    orig_sys_document_ref,
    orig_sys_line_ref,
    inventory_item,
    org_id,
    ordered_quantity,
    unit_selling_price,
    unit_list_price,
    CREATION_DATE,
    created_by,
    last_update_date,
    last_updated_by,
    operation_code)
    VALUES)
    v_source_id,
    ('TEST' | v_orig_sys_docref).
    v_orig_line_ref,
    v_item_code,
    v_org_id,
    v_ordered_qty,
    v_selling_price,
    v_selling_price,
    v_creation_date,
    v_created_by,
    v_creation_date,
    v_created_by,
    "INSERT");
    commit;

    v_customer_prev: = v_customer;
    If v_customer_prev = v_customer then
    v_stat: = 1;
    on the other
    v_stat: = 0;
    end if;
    -DBMS_OUTPUT. Put_line ('Col1: ' | v_source_id |', Col2: ' | v_creation_date |', Col3: ' | v_created_by |', Col4: ' | v_updated_date |', Col5: ' | v_updated_by);
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    OUTPUT file_read_lines;
    END;
    END LOOP;
    SELECT count (*) in the OE_HEADERS_IFACE_ALL v_count;
    DBMS_OUTPUT. Put_line (' record Total inserted successfully: ' | v_count);
    UTL_FILE. FCLOSE (FH);

    END SPKO1;
    /


    But when I run the stored procedure using TOAD his work.

    Help, please. This is my first time to attach the stored procedure in the concurrent program.

    Thank you very much.

    Kind regards
    Diane

    Published by: peopsquik08 on April 18, 2012 03:58

    as clive_t solier
    >
    You must explicitly reference the settings out
    >

    Try

    DECLARE
    VFILE VARCHAR2(32767);
    V_SOURCE_ID NUMBER;
    --
    ERRBUF VARCHAR2(200);
    RETCODE NUMBER;
    
    BEGIN
    VFILE := 'myfile1.csv';
    V_SOURCE_ID := 6;
    
    --APPS.OMORDERLOADER.SPKO1 ( VFILE, V_SOURCE_ID );
    --COMMIT;
    
    APPS.OMORDERLOADER.SPKO1(
        ERRBUF => ERRBUF,
        RETCODE => RETCODE,
        VFILE => VFILE,
        V_SOURCE_ID => V_SOURCE_ID
      );
    END;
    

    but the code above to test your proc

    to run concurrent SQL, you can use fnd_submit.submit_program

  • call a stored procedure with OUT VARCHAR2 parameter fails

    Hi all

    I use the Oracle 11.2.0.1 version OLE DB provider. I have a simple stored procedure that contains a VARCHAR2 OUT parameter:

    create or replace procedure TestOut (RESULT_CODE OUT VARCHAR2) is
    Start
    RESULT_CODE: = 'X '.
    TestOut end;

    The following c# code piece fails:

    String ConnStr = "Provider = OraOLEDB.Oracle; User ID = test; Password = test; Data Source = sandbox; « ;
    OleDbConnection Conn = new OleDbConnection (ConnStr);
    Conn.Open ();
    OleDbCommand Cmd new OleDbCommand();
    Cmd.Connection = Conn;
    OleDbParameter Param = Cmd.CreateParameter ();
    Param.ParameterName = "RESULT_CODE ';
    Param.Direction = System.Data.ParameterDirection.Output;
    Param.OleDbType = OleDbType.BSTR;
    Param.Size = 1;
    Cmd.Parameters.Add (Param);

    Cmd.CommandType = System.Data.CommandType.Text.
    Cmd.CommandText = "{TESTOUT (?). CALL} ";
    Cmd.ExecuteNonQuery ();

    If the stored procedure is modified to contain an OUT parameter, the same code works, after you change the type of parameter to appropriate OleDBType (OleDbType.SmallInt).

    What am I doing wrong when handling OUTPUT VARCHAR parameters? Y at - there any limitation on the types of parameters stored procedure using the Oracle OleDB provider?

    Published by: user957565 on 1/Ago/2011 06:31

    I get an access violation, using 11202. What do you get?

    In any case, it works fine for me using OleDbType.VarChar instead of OleDbType.BSTR.

    Hope this helps, comments welcome.

    Greg

  • How to show the stored procedure code

    Hello
    How can I get the code for creating a stored procedure using sqlplus instead of sql-developer? I want to get all of the code of the stored procedure. I saw it in writing

    SQL > desc proced_1

    I get the Argument Name, Type and input/output by default of the stored procedure, but if I want to get the code 'create procedure', how can I do?
    Thank you!

    Hai

    Try this

    Select * from user_source where name = 'Procedure_name '.
    online ordering;

    Concerning

    Srikkanth.M

Maybe you are looking for

  • I can not connect to my myspace account since I started using Firefox.

    MySpace says "address invalid eail or PW" I followed the instructions in the link 'forgot PW' and changed but new PW Gets the same result. So it does not recognize my email address because it sends the link but reacts similarly again PW. BTW, I switc

  • Office jet 8500 a after a paper jam, the message of the said printer ink cartridge is missing or damaged

    I had a paper jam, after I got the book out by opening the gate to the front, he said the black ink cartridge is missing or damaged.  I shook my head to feel a little and the message went away.  But now he says that the yellow ink cartridge is missin

  • Get the number of users connected to an access database

    Hello I want to develop a function that returns the number of users connected to an access database. I have CVI 2013 and the SQL Toolbox. Thanks in advance! ------------------------------------------------ Hello I have a base on the network, and I wa

  • Test product with USB Port

    Hello world I'm working on a project that requires testing in the production environment. These products have USB Port, and the only way that we can talk to the product is via the USB Port. The USB port inside the unit under test uses a USB to Serial

  • Vista Start Menu problems

    This is similar to the problems of others on the Vista Start Menu and the taskbar. I looked at the answer, tried to do, but it is already on the "'Start Menu" look, with the "Classic Start Menu" unchecked. " He remains in the classic style. Even the