Error executing Stored Procedure that returns a recordset in Visual Basic 6

Hello, i tried to use the example in the link posted as a response to my question in a previous thread, and in Visual Basic 6, when i execute the Stored procedure it gives me the following error:
This is the package created as indicated in the example FAQ you posted.
package types
as
type cursorType is ref cursor;
end;
This is the procedure created as indicated in the example FAQ you posted.
PROCEDURE SP_TITUVALO(T_BR IN VARCHAR2,
P_Cursor OUT TYPES.cursorType )
AS
BEGIN
OPEN P_Cursor FOR
SELECT * FROM TASAS WHERE BR=T_BR AND TASA > 0;
END;
This is the code used to execute the Stored Procedure in VB6:
Dim objConn As New ADODB.Connection
Dim connString
Dim cmdStoredProc As New ADODB.Command
Dim param1 As New ADODB.Parameter
Dim RS As ADODB.Recordset
Set param1 = cmdStoredProc.CreateParameter("T_BR", adVarChar, adParamInput, 255, "97")
cmdStoredProc.Parameters.Append param1
objConn.Open strconex
Set cmdStoredProc.ActiveConnection = objConn
cmdStoredProc.CommandText = "SP_TITUVALO"
cmdStoredProc.CommandType = adCmdStoredProc
Set RS = cmdStoredProc.Execute
This is the error returned:
ORA-06550: line 1, column 7:
PLS-00306: wrong number or types of arguments in call to 'SP_TITUVALO'
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored
****************************************************************

Juan,
Not sure about FAQ you are referring to, but it seems that you need to set PLSQLRSet property of ADODB.Command to TRUE. Because if you fail to do so - errors with refcursors are likely to happen.
Consider:
Set objConn = CreateObject("ADODB.Connection")
objConn.ConnectionString = "Provider=OraOLEDB.Oracle;Persist Security Info=False;Data Source=test9ora;User ID=max;Password=blabla"
objConn.Open
'Dim cmdStoredProc
Set cmdStoredProc = CreateObject("ADODB.Command")
Dim param1
Set param1 = cmdStoredProc.CreateParameter("T_BR", adVarChar, adParamInput, 255, "97")
param1.Value = "X"
cmdStoredProc.Parameters.Append param1
'Dim RS
Set cmdStoredProc.ActiveConnection = objConn
'The following line was missed out
cmdStoredProc.Properties("PLSQLRSet") = True
cmdStoredProc.CommandText = "SP_TITUVALO"
cmdStoredProc.CommandType = adCmdStoredProc
Set RS = cmdStoredProc.ExecuteThis works fine, at least for me.
Cheers.

Similar Messages

  • How to execute stored procedure that returns a cursor?

    How to execute a stored procedure that returns a cursor?
    Follow the code:
    CREATE OR REPLACE PROCEDURE stp_cashin_grupo
    (p_func IN VARCHAR
    ,p_cod_grup IN Integer
    ,p_des_grup IN VARCHAR
    ,p_logi IN VARCHAR
    ,p_curs_rset OUT infoc.pck_cashin_grupo.curs_rset
    IS
    BEGIN
    if p_func = '1' then
    OPEN p_curs_rset FOR
    select
    cod_grup
    ,des_grup
    ,dat_manu_grup
    ,des_logi_manu
    from infoc.tbl_cashin_grupo
    order by des_grup;
    end if;
    END stp_cashin_grupo;
    and the package:
    CREATE OR REPLACE PACKAGE pck_cashin_grupo
    AS
    TYPE curs_rset IS REF CURSOR;
    END pck_cashin_grupo;
    My question is how to execute in sql plus?
    EXEC stp_cashin_grupo('1',0,'','465990', my doubt is how to pass the cursor as return
    Thanks

    my doubt is how to pass the cursor as returnExample :
    TEST@db102 > var c1 refcursor;
    TEST@db102 > create or replace procedure ref1 (
      2     v1 in varchar2,
      3     cur1 out sys_refcursor)
      4  is
      5  begin
      6     open cur1 for 'select * from '||v1;
      7  end;
      8  /
    Procedure created.
    TEST@db102 > exec ref1('dept',:c1);
    PL/SQL procedure successfully completed.
    TEST@db102 > print c1
        DEPTNO DNAME          LOC
            10 ACCOUNTING     NEW YORK
            20 RESEARCH       DALLAS
            30 SALES          CHICAGO
            40 OPERATIONS     BOSTON
    TEST@db102 >

  • Call a Stored Procedure that returns a REFCURSOR using ODI Procedure

    Hi,
    I have a scenario wherein the stored procedure (TEST_PROC1) that returns a REFCURSOR. The second procedure(TEST_PROC2) will use the REFCURSOR as inpuut and insert it to a table.
    Now, I need to execute the test procedures (TEST_PROC1 and TEST_PROC2) using the ODI Procedure but I always get error. However, I was able to execute the test procedures using sqlplus. Here is the command I used for sqlplus:
                   var rc refcursor
                   exec TEST_PROC1(:rc);
                   exec TEST_PROC2(:rc);
    PL/SQL Stored Procedure:
    -- TEST_PROC1 --
    create or replace
    PROCEDURE TEST_PROC1 (p_cursor IN OUT SYS_REFCURSOR)
    AS
    BEGIN
    OPEN p_cursor FOR
    SELECT *
    FROM test_table1;
    END;
    -- TEST_PROC2 --
    create or replace
    procedure TEST_PROC2( rc in out sys_refcursor ) is
    FETCH_LIMIT constant integer := 100;
    type TFetchBuffer is table of test_table2%RowType;
    buffer TFetchBuffer;
    begin
    loop
    fetch rc bulk collect into buffer limit FETCH_LIMIT;
    forall i in 1..buffer.Count
    insert into test_table2(
    c1, c2
    ) values(
    buffer(i).c1, buffer(i).c2
    exit when rc%NotFound;
    end loop;
    end;
    Is there a way to call a PL/SQL Stored Procedure that returns a REFCURSOR using ODI Procedure?
    Thanks,
    Cathy

    Thanks for the reply actdi.
    The procedure TEST_PROC1 is just a sample procedure. The requirement is that I need to call a stored procedure that returns a cursor using ODI and fetch the data and insert into a table, which in this case is test_table2.
    I was able to execute a simple SQL procedure (without cursor) using ODI procedure. But when i try to execute the SQL procedure with cursor in ODI, I encountered error.
    Do you have any idea how to do this?

  • How Do I Call PL/SQL Stored Procedure That Returns String Array??

    I Have Problem Calling An Oracle(8i) Stored Procedure That Returns Array Type (Multi Rows)
    (As Good As String Array Type..)
    In This Fourm, I Can't Find Out Example Source.
    (Question is Exist.. But No Answer..)
    I Want An Example,, Because I'm A Beginner...
    (I Wonder...)
    If It Is Impossible, Please Told Me.. "Impossible"
    Then, I'll Give Up to Resolve This Way.....
    Please Help Me !!!
    Thanks in advance,

    // Try the following, I appologize that I have not compiled and run this ... but it is headed in the right direction
    import java.sql.*;
    class RunStoredProc
    public static void main(String args[])
    throws SQLException
    try
    Class.forName("oracle.jdbc.driver.OracleDriver");
    catch(Exception ex)
    ex.printStackTrace();
    java.util.Properties props = new java.util.Properties();
    props.put("user", "********"); // you need to replace stars with db userid
    props.put("password", "********"); // you need to replace stars with userid db password
              // below replace machine.domain.com and DBNAME, and port address if different than 1521
    Connection conn =
    DriverManager.getConnection("jdbc:oracle:thin:@machine.domain.com:1521:DBNAME", props);
    // replace "Your Stored Procedure" with your stored procedure
    CallableStatement stmt = conn.prepareCall("Your Stored Procedure");
    ResultSet rset = stmt.execute();
    while(rset.next())
    System.out.println(rset.getString(1));

  • Stored procedure that returns a cursor (result set)

    Hi,
    We have a stored procedure that returns a cursor (result set) but when I compliled it and catalouged (introspected) it in the OBPM I got all the primitive type parameters (either IN or OUT) in the proc call except the cursor type (the result set) which is the out param of the stored proc.
    Any pointers please?
    Thanks

    Result set is of RowType and is not supported as a Stored Procedure as far as I know.
    HTH
    Sharma

  • Stored procedure that returns multiple tables

    Hello everyone,
    I was wondering if there's a way to write a stored procedure that returns multiple result set as in sql server. for example, in sql server, you can write 2 select statements and when loading them in c#, u can get two data tables.
    I am not sure having a single ref cursor for each select is the only solution. I might need to return a variable number of tables per procedure call (based on a certain criteria).
    Any ideas?
    thanks for your time

    Sure. Ref cursor is the only easier answer for your problem.
    satyaki>
    satyaki>select * from v$version;
    BANNER
    Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Prod
    PL/SQL Release 10.2.0.3.0 - Production
    CORE    10.2.0.3.0      Production
    TNS for 32-bit Windows: Version 10.2.0.3.0 - Production
    NLSRTL Version 10.2.0.3.0 - Production
    Elapsed: 00:00:01.43
    satyaki>
    satyaki>create or replace procedure ref_gen_arg(choice in int,b in out sys_refcursor)
      2  is  
      3    str   varchar2(500);
      4  begin   
      5    if choice = 1 then      
      6      str := 'select * from emp';   
      7    elsif choice = 2 then      
      8      str := 'select * from dept';   
      9    end if;       
    10   
    11    open b for str;
    12  exception  
    13    when others then     
    14      dbms_output.put_line(sqlerrm);
    15  end;
    16  /
    Procedure created.
    Elapsed: 00:00:04.38
    satyaki>
    satyaki>
    satyaki>declare   
      2    rec_x emp%rowtype;   
      3    rec_y dept%rowtype;       
      4    w sys_refcursor;
      5  begin  
      6    dbms_output.enable(1000000);  
      7    ref_gen_arg(1,w);  
      8    loop    
      9      fetch w into rec_x;     
    10      exit when w%notfound;             
    11        dbms_output.put_line('Employee No: '||rec_x.empno||' - '||                          
    12                             'Name: '||rec_x.ename||' - '||                          
    13                             'Job: '||rec_x.job||' - '||                          
    14                             'Manager: '||rec_x.mgr||' - '||                          
    15                             'Joining Date: '||rec_x.hiredate||' - '||                          
    16                             'Salary: '||rec_x.sal||' - '||                          
    17                             'Commission: '||rec_x.comm||' - '||                          
    18                             'Department No: '||rec_x.deptno);  
    19    end loop;  
    20    close w;    
    21   
    22    ref_gen_arg(2,w);  
    23    loop    
    24      fetch w into rec_y;
    25      exit when w%notfound;            
    26         dbms_output.put_line('Department No: '||rec_y.deptno||' - '||                           
    27                              'Name: '||rec_y.dname||' - '||                           
    28                              'Location: '||rec_y.loc);  
    29    end loop;  
    30    close w;
    31  exception  
    32    when others then    
    33      dbms_output.put_line(sqlerrm);
    34  end;
    35  /
    Employee No: 9999 - Name: SATYAKI - Job: SLS - Manager: 7698 - Joining Date: 02-NOV-08 - Salary: 55000 - Commission: 3455 - Department No: 10
    Employee No: 7777 - Name: SOURAV - Job: SLS - Manager:  - Joining Date: 14-SEP-08 - Salary: 45000 - Commission: 3400 - Department No: 10
    Employee No: 7521 - Name: WARD - Job: SALESMAN - Manager: 7698 - Joining Date: 22-FEB-81 - Salary: 1250 - Commission: 500 - Department No: 30
    Employee No: 7566 - Name: JONES - Job: MANAGER - Manager: 7839 - Joining Date: 02-APR-81 - Salary: 2975 - Commission:  - Department No: 20
    Employee No: 7654 - Name: MARTIN - Job: SALESMAN - Manager: 7698 - Joining Date: 28-SEP-81 - Salary: 1250 - Commission: 1400 - Department No: 30
    Employee No: 7698 - Name: BLAKE - Job: MANAGER - Manager: 7839 - Joining Date: 01-MAY-81 - Salary: 2850 - Commission:  - Department No: 30
    Employee No: 7782 - Name: CLARK - Job: MANAGER - Manager: 7839 - Joining Date: 09-JUN-81 - Salary: 4450 - Commission:  - Department No: 10
    Employee No: 7788 - Name: SCOTT - Job: ANALYST - Manager: 7566 - Joining Date: 19-APR-87 - Salary: 3000 - Commission:  - Department No: 20
    Employee No: 7839 - Name: KING - Job: PRESIDENT - Manager:  - Joining Date: 17-NOV-81 - Salary: 7000 - Commission:  - Department No: 10
    Employee No: 7844 - Name: TURNER - Job: SALESMAN - Manager: 7698 - Joining Date: 08-SEP-81 - Salary: 1500 - Commission: 0 - Department No: 30
    Employee No: 7876 - Name: ADAMS - Job: CLERK - Manager: 7788 - Joining Date: 23-MAY-87 - Salary: 1100 - Commission:  - Department No: 20
    Employee No: 7900 - Name: JAMES - Job: CLERK - Manager: 7698 - Joining Date: 03-DEC-81 - Salary: 950 - Commission:  - Department No: 30
    Employee No: 7902 - Name: FORD - Job: ANALYST - Manager: 7566 - Joining Date: 03-DEC-81 - Salary: 3000 - Commission:  - Department No: 20
    Department No: 10 - Name: ACCOUNTING - Location: NEW YORK
    Department No: 20 - Name: RESEARCH - Location: DALLAS
    Department No: 30 - Name: SALES - Location: CHICAGO
    Department No: 40 - Name: LOGISTICS - Location: CHICAGO
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:00.73
    satyaki>Regards.
    Satyaki De.

  • Function calling stored procedure that returns a cursor into a LOV

    Hello,
    Is it possible in HTML DB to implement a process that has a function that calls a stored procedure that returns a cursor, used to then populate a select list?
    Or can I do a function call to a stored procedure in the 'List of values definition' box for the item itself that returns a cursor to populate the item's select list?

    Hi Vikas,
    Actually, I just found another posting that shows how to do what I'm looking for:
    Re: Filling a LOV with a cursor
    Check it out. I posted another question in response to that discussion...maybe you could answer that? Thanks!
    Laura

  • Using XI - RFC table and an Oracle stored procedure that returns a cursor.

    I need to create an interface using XI between an RFC table and an Oracle stored procedure that returns a cursor.  We are on oarcle 9.2 and  SP12.
    My stored procedure looks something like this:
    CREATE OR REPLACE
    PROCEDURE testproc_xi2 (p_recordset1 OUT SYS_REFCURSOR,
                                             in_quoteid IN varchar2 )
    AS
    BEGIN
      OPEN p_recordset1 FOR
       SELECT  q.quote_id,
                     q.modified_by,
                     q.quote_status,
                     q.total_cost
                FROM quote q
               WHERE q.quote_id = in_quoteid
                 AND q.total_cost > 0 ; 
    END testproc_xi2 ;
    My RFC has table and  one import parameter .
    I wanted to know how to create the data type for the ref cursor? and also for the table type in the RFC?
    CAN XI handle multi rows coming from a Stored procedure? Are there any other alternative methods if this is not supported?Any pointers to this would be helpful.
    I have called a Oracle SP from an RFC before, but that interface had one input parameter going to the stored procedure from the RFC and about 6 o/p parameters coming from the Stored procedure. This works fine.
    Thanks for the help.
    Mala

    Mala,
    i dont think there is anything called an rfc table...RFC stands for remote function call. That in essence would imply you need a rfc to jdbc connection.
    yes XI can handle multiple rows cooming from the the stored procedure if you have them mapped appropriately.
    Now as to how to create the data type within xi , you need to know what fields are going to be returned and whether they are nested and then just create them as you would for an xml
    for ex
    <Details>
      <FirstName>
    <LastName>
    </Details>
    that in xi would be smthing like
    Details  type of data occurence
    FirstName type of data occurence
    LastName type of data occurence.
    Hope that helps.
    If it does dont forget the points..:-)

  • Help! Need oracle help with constructing stored procedure that return resultsets

    Suns tutorial path for returning resultsets from stored procedures indicates that the following should work...
    CallableStatement cs = con.prepareCall("{call SHOW_SUPPLIERS}");
    ResultSet rs = cs.executeQuery();
    Thats if you build your stored procedure something like this ...
    String createProcedure = "create procedure SHOW_SUPPLIERS " + "as " + "select SUPPLIERS.SUP_NAME, COFFEES.COF_NAME " + "from SUPPLIERS, COFFEES " + "where SUPPLIERS.SUP_ID = COFFEES.SUP_ID " + "order by SUP_NAME";
    We are using oracle 8.1.6. However I've been told that with oracle procedures when you return a result set from a called procedure you return a p_cursor variable. Somthing like this
    (p_cursor in out SHOW_SUPPLIERS.SHOCurTyp)
    is
    begin
    open p_cursor for
    select * from suppliers
    In which case the above mentioned sun code doesn't work.
    We want to use jdbc to call a stored procedure that returns a resultset that does not require us to import any proprietary oracle objects...
    Is there another way to write these stored procedures, rather than using this cursor construct? Are we missing something in the way we invoke them?

    Suns tutorial path for returning resultsets from stored procedures indicates that the following should work...
    CallableStatement cs = con.prepareCall("{call SHOW_SUPPLIERS}");
    ResultSet rs = cs.executeQuery();
    Thats if you build your stored procedure something like this ...
    String createProcedure = "create procedure SHOW_SUPPLIERS " + "as " + "select SUPPLIERS.SUP_NAME, COFFEES.COF_NAME " + "from SUPPLIERS, COFFEES " + "where SUPPLIERS.SUP_ID = COFFEES.SUP_ID " + "order by SUP_NAME";
    We are using oracle 8.1.6. However I've been told that with oracle procedures when you return a result set from a called procedure you return a p_cursor variable. Somthing like this
    (p_cursor in out SHOW_SUPPLIERS.SHOCurTyp)
    is
    begin
    open p_cursor for
    select * from suppliers
    In which case the above mentioned sun code doesn't work.
    We want to use jdbc to call a stored procedure that returns a resultset that does not require us to import any proprietary oracle objects...
    Is there another way to write these stored procedures, rather than using this cursor construct? Are we missing something in the way we invoke them?

  • Call to Oracle stored procedure that returns ref cursor doesn't work

    I'm trying to use an OData service operation with Entity Framework to call an Oracle stored procedure that takes an number as an input parameter and returns a ref cursor. The client is javascript so I'm using the rest console to test my endpoints. I have been able to successful call a regular Oracle stored procedure that takes a number parameter but doesn't return anything so I think I have the different component interactions correct. When I try calling the proc that has an ref cursor for the output I get the following an error "Invalid number or type of parameters". Here are my specifics:
    App.config
    <oracle.dataaccess.client>
    <settings>
    <add name="PGDATA_WC.ODATAPOC.GETWORKORDERSBYWINDFARMID.RefCursor.P_RESULTS" value="implicitRefCursor bindinfo='mode=Output'" />
    <add name="PGDATA_WC.ODATAPOC.GETWORKORDERSBYWINDFARMID.RefCursorMetaData.P_RESULTS.Column.0" value="implicitRefCursor metadata='ColumnName=WINDFARM_ID;BaseColumnName=WINDFARM_ID;BaseSchemaName=PGDATA_WC;BaseTableName=WORKORDERS;NATIVEDATATYPE=Number;ProviderType=Int32'" />
    <add name="PGDATA_WC.ODATAPOC.GETWORKORDERSBYWINDFARMID.RefCursorMetaData.P_RESULTS.Column.1" value="implicitRefCursor metadata='ColumnName=STARTTIME;BaseColumnName=STARTTIME;BaseSchemaName=PGDATA_WC;BaseTableName=WORKORDERS;NATIVEDATATYPE=Varchar2;ProviderType=Varchar2'" />
    <add name="PGDATA_WC.ODATAPOC.GETWORKORDERSBYWINDFARMID.RefCursorMetaData.P_RESULTS.Column.2" value="implicitRefCursor metadata='ColumnName=ENDTIME;BaseColumnName=ENDTIME;BaseSchemaName=PGDATA_WC;BaseTableName=WORKORDERS;NATIVEDATATYPE=Varchar2;ProviderType=Varchar2'" />
    <add name="PGDATA_WC.ODATAPOC.GETWORKORDERSBYWINDFARMID.RefCursorMetaData.P_RESULTS.Column.3" value="implicitRefCursor metadata='ColumnName=TURBINE_NUMBER;BaseColumnName=TURBINE_NUMBER;BaseSchemaName=PGDATA_WC;BaseTableName=WORKORDERS;NATIVEDATATYPE=Varchar2;ProviderType=Varchar2'" />
    <add name="PGDATA_WC.ODATAPOC.GETWORKORDERSBYWINDFARMID.RefCursorMetaData.P_RESULTS.Column.4" value="implicitRefCursor metadata='ColumnName=NOTES;BaseColumnName=NOTES;BaseSchemaName=PGDATA_WC;BaseTableName=WORKORDERS;NATIVEDATATYPE=Varchar2;ProviderType=Varchar2'" />
    <add name="PGDATA_WC.ODATAPOC.GETWORKORDERSBYWINDFARMID.RefCursorMetaData.P_RESULTS.Column.5" value="implicitRefCursor metadata='ColumnName=TECHNICIAN_NAME;BaseColumnName=TECHNICIAN_NAME;BaseSchemaName=PGDATA_WC;BaseTableName=WORKORDERS;NATIVEDATATYPE=Varchar2;ProviderType=Varchar2'" />
    <add name="PGDATA_WC.ODATAPOC.GETWORKORDERSBYID.RefCursor.P_RESULTS" value="implicitRefCursor bindinfo='mode=Output'" />
    </settings>
    OData Service Operation:
    public class OracleODataService : DataService<OracleEntities>
    // This method is called only once to initialize service-wide policies.
    public static void InitializeService(DataServiceConfiguration config)
    // TODO: set rules to indicate which entity sets and service operations are visible, updatable, etc.
    // Examples:
    config.SetEntitySetAccessRule("*", EntitySetRights.All);
    config.SetServiceOperationAccessRule("GetWorkOrdersByWindfarmId", ServiceOperationRights.All);
    config.SetServiceOperationAccessRule("CreateWorkOrder", ServiceOperationRights.All);
    config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V2;
    [WebGet]
    public IQueryable<GetWorkOrdersByWindfarmId_Result> GetWorkOrdersByWindfarmId(int WindfarmId)
    return this.CurrentDataSource.GetWorkOrdersByWindfarmId(WindfarmId).AsQueryable();
    [WebGet]
    public void CreateWorkOrder(int WindfarmId)
    this.CurrentDataSource.CreateWorkOrder(WindfarmId);
    Here is the stored procedure:
    procedure GetWorkOrdersByWindFarmId(WINDFARMID IN NUMBER,
    P_RESULTS OUT REF_CUR) is
    begin
    OPEN P_RESULTS FOR
    select WINDFARM_ID,
    STARTTIME,
    ENDTIME,
    TURBINE_NUMBER,
    NOTES,
    TECHNICIAN_NAME
    from WORKORDERS
    where WINDFARM_ID = WINDFARMID;
    end GetWorkOrdersByWindFarmId;
    I defined a function import for the stored procedure using the directions I found online by creating a new complex type. I don't know if I should be defining the input parameter, WindfarmId, in my app.config? If I should what would that format look like? I also don't know if I'm invoking the stored procedure correctly in my service operation? I'm testing everything through the rest console because the client consuming this information is written in javascript and expecting a json format. Any help is appreciated!
    Edited by: 1001323 on Apr 20, 2013 8:04 AM
    Edited by: jennyh on Apr 22, 2013 9:00 AM

    Making the change you suggested still resulted in the same Oracle.DataAccess.Client.OracleException {"ORA-06550: line 1, column 8:\nPLS-00306: wrong number or types of arguments in call to 'GETWORKORDERSBYWINDFARMID'\nORA-06550: line 1, column 8:\nPL/SQL: Statement ignored"}     System.Exception {Oracle.DataAccess.Client.OracleException}
    I keep thinking it has to do with my oracle.dataaccess.client settings in App.Config because I don't actually put the WindfarmId and an input parameter. I tried a few different ways to do this but can't find the correct format.

  • Invoking stored procedure that returns array(oracle object type) as output

    Hi,
    We have stored procedures which returns arrays(oracle type) as an output, can anyone shed some light on how to map those arrays using JPA annotations? I tried using jdbcTypeName but i was getting wrong type or argument error, your help is very much appreciated. Below is the code snippet.
    JPA Class:
    import java.io.Serializable;
    import java.sql.Array;
    import java.util.List;
    import javax.persistence.Entity;
    import javax.persistence.Id;
    import org.eclipse.persistence.annotations.Direction;
    import org.eclipse.persistence.annotations.NamedStoredProcedureQuery;
    import org.eclipse.persistence.annotations.StoredProcedureParameter;
    * The persistent class for the MessagePublish database table.
    @Entity
    @NamedStoredProcedureQuery(name="GetTeamMembersDetails",
         procedureName="team_emp_maintenance_pkg.get_user_team_roles",
         resultClass=TeamMembersDetails.class,
         returnsResultSet=true,
         parameters={  
         @StoredProcedureParameter(queryParameter="userId",name="I_USER_ID",direction=Direction.IN,type=Long.class),
         @StoredProcedureParameter(queryParameter="employeeId",name="I_EMPLOYEEID",direction=Direction.IN,type=Long.class),
         @StoredProcedureParameter(queryParameter="TEAMMEMBERSDETAILSOT",name="O_TEAM_ROLES",direction=Direction.OUT,jdbcTypeName="OBJ_TEAM_ROLES"),
         @StoredProcedureParameter(queryParameter="debugMode",name="I_DEBUGMODE",direction=Direction.IN,type=Long.class)
    public class TeamMembersDetails implements Serializable {
         private static final long serialVersionUID = 1L;
    @Id
         private long userId;
         private List<TeamMembersDetailsOT> teamMembersDetailsOT;
         public void setTeamMembersDetailsOT(List<TeamMembersDetailsOT> teamMembersDetailsOT) {
              this.teamMembersDetailsOT = teamMembersDetailsOT;
         public List<TeamMembersDetailsOT> getTeamMembersDetailsOT() {
              return teamMembersDetailsOT;
    Procedure
    PROCEDURE get_user_team_roles (
    i_user_id IN ue_user.user_id%TYPE
    , o_team_roles OUT OBJ_TEAM_ROLES_ARRAY
    , i_debugmode IN NUMBER :=0)
    AS
    OBJ_TEAM_ROLES_ARRAY contains create or replace TYPE OBJ_TEAM_ROLES_ARRAY AS TABLE OF OBJ_TEAM_ROLES;
    TeamMembersDetailsOT contains the same attributes defined in the OBJ_TEAM_ROLES.

    A few things.
    You are not using a JDBC Array type in your procedure, you are using a PLSQL TABLE type. An Array type would be a VARRAY in Oracle. EclipseLink supports both VARRAY and TABLE types, but TABLE types are more complex as Oracle JDBC does not support them, they must be wrapped in a corresponding VARRAY type. I assume your OBJ_TEAM_ROLES is also not an OBJECT TYPE but a PLSQL RECORD type, this has the same issue.
    Your procedure does not return a result set, so "returnsResultSet=true" should be "returnsResultSet=false".
    In general I would recommend you change your stored procedure to just return a select from a table using an OUT CURSOR, that is the easiest way to return data from an Oracle stored procedure.
    If you must use the PLSQL types, then you will need to create wrapper VARRAY and OBJECT TYPEs. In EclipseLink you must use a PLSQLStoredProcedureCall to access these using the code API, there is not annotation support. Or you could create your own wrapper stored procedure that converts the PLSQL types to OBJECT TYPEs, and call the wrapper stored procedure.
    To map to Oracle VARRAY and OBJECT TYPEs the JDBC Array and Struct types are used, these are supported using EclipseLink ObjectRelationalDataTypeDescriptor and mappings. These must be defined through the code API, as there is currently no annotation support.
    I could not find any good examples or doc on this, your best source of example is the EclipseLink test cases in SVN,
    http://dev.eclipse.org/svnroot/rt/org.eclipse.persistence/trunk/foundation/eclipselink.core.test/src/org/eclipse/persistence/testing/tests/plsql/
    http://dev.eclipse.org/svnroot/rt/org.eclipse.persistence/trunk/foundation/eclipselink.core.test/src/org/eclipse/persistence/testing/tests/customsqlstoredprocedures/
    James : http://www.eclipselink.org

  • User Executes Stored Procedure That Executes sp_send_dbmail; receives email but also gets error Cannot alter the queue 'ExternalMailQueue', because it does not exist or you do not have permission.

    Using SQL Server 2012 SP1
    I have a user that is submitting a procedure that uses sp_send_dbmail.  I have also noticed that they have the following code in their procedure
    DECLARE @rc INT
    IF NOT EXISTS (SELECT * FROM msdb.sys.service_queues
    WHERE name = N'ExternalMailQueue' AND is_receive_enabled = 1)
    EXEC @rc = msdb.dbo.sysmail_start_sp
    The user submits the procedure and she gets the email but she also gets the following error message:
    Msg 15151, Level 16, State 1, Procedure sysmail_start_sp, Line 8
    Cannot alter the queue 'ExternalMailQueue', because it does not exist or you do not have permission.
    Mail (Id: 2402) queued.
    (1 row(s) affected)
    I have granted execute to sp_send_dbmail and sysmail_start_sp.  I have also granted select to service_queues.
    Does anyone have any solutions for the above error message?
    lcerni

    The contents of sysmail_start_sp is this:
    CREATE PROCEDURE sysmail_start_sp
    AS
        SET NOCOUNT ON
        DECLARE @rc INT
       DECLARE @localmessage nvarchar(255)
        ALTER QUEUE ExternalMailQueue WITH STATUS = ON
        SELECT @rc = @@ERROR
        IF(@rc = 0)
        BEGIN
          ALTER QUEUE ExternalMailQueue WITH ACTIVATION (STATUS = ON);
           SET @localmessage = FORMATMESSAGE(14639, SUSER_SNAME())
           exec msdb.dbo.sysmail_logmailevent_sp @event_type=1, @description=@localmessage
        END
    RETURN @rc
    The user get the error, because she does not have any permission on the queue in question. To be able to alter the queue, the following applies according to Books Online:
    Permission for altering a queue defaults to the owner of the queue, members of the db_ddladmin or db_owner fixed database roles, and members of the sysadmin fixed server role.
    Note that is would be db_ddladmin or db_owner in msdb. Now, supposedly the queue is already active, and in that case I think that it is sufficient that the user has VIEW DEFINITION on the view. This would permit her to see the row in sys.service_queues,
    why there would be no need to call sysmail_start_sp.
    Altertanively, change the check to:
    DECLARE @isenabled bit
    SELECT @isenabled = (SELECT is_receive_enabled FROM msdb.sys.service_queues
                   WHERE name = N'ExternalMailQueue')
    IF @isenabled = 0
       EXEC @rc = msdb.dbo.sysmail_start_sp
    The idea here is that, if the user has no permission to read the information in the DMV, @isenabled will be NULL, and you just pray and hope that the queue is up and running.
    I suspect that the reason this worked for you on SQL 2005 is that on that instance someone at some point in made all the required configurations for it to work, but all that is forgotten now. That happens to me too.
    If you really want the user to be able to start the queue, I have some better ideas than adding her to a role, but I skip the details for now.
    Erland Sommarskog, SQL Server MVP, [email protected]

  • Oracle Error Executing Stored Procedure

    Hi
    I'm invoking a stored procedure from Oracle Database. The procedure is running Ok in oracle, but when i run the procedure from .NET, failed. The code when stop is :
    Reader = cmdReader.ExecuteReader()
    The error is:
    A first chance exception of type 'System.Data.OracleClient.OracleException' occurred in System.Data.OracleClient.dll
    A first chance exception of type 'System.FormatException' occurred in mscorlib.dll
    In the Catch Exception:
    Catch ex As OracleException
    MsgBox(ex.Code.ToString)
    The result is: 6550
    Do you can help me?

    Since you are using Microsoft's ADO.NET Provider for Oracle, I suggest that you post your question with a short sample on "ADO.NET Data Providers" forum here - http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=45&SiteID=1

  • Error executing stored procedure

    I have the following store procedure
    trun_stg_acls
    this is created by user 'cat'. I created grant execute permission on 'catloader'.
    But when i try to execute the procedure it gives me the following error
    1 DECLARE
    2 BEGIN
    3 DBMS_OUTPUT.PUT_LINE('BEGIN TRUNCATE');
    4 TRUNC_STG_ACLS;
    5 COMMIT;
    6 DBMS_OUTPUT.PUT_LINE('END TRUNCATE');
    7* END ;
    8 /
    TRUNC_STG_ACLS;
    ERROR at line 4:
    ORA-06550: line 4, column 2:
    PLS-00201: identifier 'TRUNC_STG_ACLS' must be declared
    ORA-06550: line 4, column 2:
    PL/SQL: Statement ignored
    I have a similar procedure trunc_stg_tables which executes fine.
    Can any body please help me on this?

    Or you could just do:
    DECLARE
    BEGIN
    DBMS_OUTPUT.PUT_LINE('BEGIN TRUNCATE');
    CAT.TRUNC_STG_ACLS;
    COMMIT;
    DBMS_OUTPUT.PUT_LINE('END TRUNCATE');
    END ;
    /

  • Avoid JDBC sender error: Execute statement did not return a result set

    Hi!
    My JDBC sender adapter towards MS SQL server works fine, with an Execute statement calling a stored procedure that returns the source data needed. The stored procedure itself updates the status of database table records, so that only the unread records are returned each time the stored procedure is called.
    However, the communication channel monitoring sets a red flag for the JDBC sender adapter, when there are no values to fetch from the database table (using the stored procedure). Message says: "Database-level error reported by JDBC driver while executing statement 'EXECUTE FetchMessage 1, 9000'. The JDBC driver returned the following error message: 'com.microsoft.sqlserver.jdbc.SQLServerException: The statement did not return a result set.'. For details, contact your database server vendor."
    This is not an error situation, as I do not expect there to be any values to fetch from the database at all times.
    I do not see how to change the stored procedure to avoid this error.
    Is there a parameter to be set on the JDBC adapter that I can use, so the red flag is avoided?
    Thanks for any input!
    Regards,
    Oeystein Emhjellen

    Hi Oeystein Emhjellen.
    The problem is Store Procedure that has to generate always a ResultSet (or cursor). If it doesn't have a output, you have to generate an Empty ResultSet.
    Like a SELECT Statement:
    If there are data, SELECT get an output result but if it get nothing the SELECT Statement get a empty ResultSet.
    Ask to your database team.
    I hope it helps you.
    Bruno.

Maybe you are looking for

  • No ringtone

    i can't get the ringtones to work eventhough I had selected in the settings to have both the vibrations and ringtone selected. any suggestions . I have already tried to repristinare the iphone but to no avail

  • "Responsible Purchase Organization and Purchase Group" not appearing in Bid

    Hi, We are implementing SRM 5.0.--> Bidding Process. Steps. 1) Creating PR in R/3 and transfered to SRM 2) Carry out sourcing and select one PR with line items and --> Add to Work Area --> Create Bid Invitation --> Process Bid Invitation --> Change a

  • SMC 2.0 port problem

    I've installed Solaris Management Console 2.0 on Solaris 8 x86, MU 5 (07/01). Removed first all old SMC 1.02 packages (from Admin Pack), installed all SMC 2.0 packages (from Solaris 8 x86 10/01 CDs). SMC doesn't start. Did $ truss smc -> some strange

  • ASE 15.7 how to find data entry using table page nr

    Hi, I am looking for a dbcc () to get data when I know page number from a table Thank you

  • Installation des Adobe Flash Players unmöglich

    Hallo liebe Adobe-Nutzer, vor kurzer Zeit hatte ich einen Virus, woraufhin ich eine Systemwiederherstellung mit meinem Laptop durchgeführt habe. Nach dieser kam z.B. auf YouTube ständig die Aufforderung, Adobe Flash Player zu aktivieren. Außerdem sag