Home » Developer & Programmer » JDeveloper, Java & XML » PLS-00306: wrong number or types of arguments in call to 'p_proc'
PLS-00306: wrong number or types of arguments in call to 'p_proc' [message #92594] Sun, 03 October 2004 12:28 Go to next message
Peter
Messages: 62
Registered: August 2000
Member
Hi,

This code call a procedure which takes a VARRAY type as parameter. I face this error
when i compile the code.

java.sql.SQLException: ORA-06550: Line 1, column 7 :
PLS-00306: wrong number or types of arguments in call to 'p_proc'
ORA-06550: Line 1, column 7 :
PL/SQL: Statement ignored

someone can tell what's wrong. Below, you have the source code used in this test case
a sample code is welcome.

import java.sql.*;
import oracle.sql.*;
import oracle.jdbc.oracore.Util;
import oracle.jdbc.*;
import java.math.BigDecimal;

public class ArrayExample3 {

  public static void main(String args[[]]) throws Exception {
    // Register the Oracle JDBC driver
    DriverManager.registerDriver(new oracle.jdbc.OracleDriver());
    // Connect to the database
    Connection conn =
        DriverManager.getConnection("jdbc:oracle:thin:@Anais:1521:BLB",
                                    "candide", "candide");
    // It's faster when auto commit is off
    conn.setAutoCommit(false);
    // create a new ARRAY object
    int elements[[]] = {
        300, 400, 500, 600};
    ArrayDescriptor desc = ArrayDescriptor.createDescriptor
        ("NUM_VARRAY", conn);
    ARRAY newArray = new ARRAY(desc, conn, elements);

    CallableStatement cs = conn.prepareCall("{call pe_cl2.p_proc(?)}");
    ( (OracleCallableStatement) cs).setArray(1, newArray);
    cs.executeUpdate();

    // Close all the resources
    cs.close();
    conn.close();

  }

}
--------------------------------------------
[[code]]
CREATE OR REPLACE TYPE num_varray_t AS VARRAY(10) OF NUMBER;
/
CREATE TABLE varray_table2 (col1 number);
/
create or replace package candide.PE_CL2 is
  PROCEDURE p_proc(Id_clt   IN num_varray);
end PE_CL2;
/
create or replace package body candide.PE_CL2 is
  PROCEDURE p_proc(Id_clt IN num_varray) IS 
  BEGIN
    FORALL i IN Id_clt.FIRST .. Id_clt.LAST
    INSERT INTO varray_table2 VALUES (Id_clt(i));
  COMMIT;
  END;
end PE_CL2;
/

i am using oracle 9i on win XP

thanks Peter
Re: PLS-00306: wrong number or types of arguments in call to 'p_proc' [message #92595 is a reply to message #92594] Sun, 03 October 2004 12:56 Go to previous message
Magnar Johannessen
Messages: 12
Registered: February 2004
Junior Member
The name (NUM_ARRAY) in:
ArrayDescriptor desc = ArrayDescriptor.createDescriptor
("NUM_VARRAY", conn);
have to match Your TYPE in the database, num_array_t:

Try to add the _T in:

ArrayDescriptor desc = ArrayDescriptor.createDescriptor
("NUM_VARRAY_T", conn);

Regards
mj
Previous Topic: business components data form wizard
Next Topic: Date Formats in Dbms_Xmlquery.getXML
Goto Forum:
  


Current Time: Mon Nov 25 20:27:37 CST 2024