Stored procedure and ref cursor problem

I am trying to create a stored procedure that can be used in Crystal Reports. To do this I have to create a package and a ref cursor. My SQL is below:
--Package
Create or Replace Package Test_Package
as type test_type is ref cursor;
end;
--Procedure
Create or Replace Procedure Test_Proc
(test_cursor in out test_package.test_type,
parameter in string
as
begin
open test_cursor for
select ClientName from apbpman.cv_client where clientref = parameter;
end;
--When trying to execute the SP in Oracle I use:-
set serveroutput on
declare
test_cursor apbpman.test_package.test_type;
resultset test_cursor%rowtype;
begin
apbpman.test_proc(test_cursor,'0096');
if not test_cursor%isopen then
dbms_output.put_line ('OK');
else
dbms_output.put_line ('Not OK');
end if;
fetch test_cursor into resultset;
while test_cursor%found loop
dbms_output.put_line(resultset.ClientName);
fetch test_cursor into resultset;
end loop;
end;
Whenever this runs I receive the following error reports:
resultset test_cursor%rowtype;
ERROR at line 3:
ORA-06550: line 3, column 13:
PLS-00320: the declaration of the type of this expression is incomplete or malformed
ORA-06550: line 3, column 13:
PL/SQL: Item ignored
ORA-06550: line 11, column 25:
PLS-00320: the declaration of the type of this expression is incomplete or malformed
ORA-06550: line 11, column 2:
PL/SQL: SQL Statement ignored
ORA-06550: line 13, column 24:
PLS-00320: the declaration of the type of this expression is incomplete or malformed
ORA-06550: line 13, column 3:
PL/SQL: Statement ignored
ORA-06550: line 14, column 26:
PLS-00320: the declaration of the type of this expression is incomplete or malformed
ORA-06550: line 14, column 3:
PL/SQL: SQL Statement ignored
I have tried in vain to find a resolution to this but have failed. Please help.
Thanks,
Paul

Unless you are running a really old version of Oracle, any weak ref cursor can just be declared SYS_REFCURSOR. Also, you can't use a weak ref cursor for %ROWTYPE. You can test the procedure in SQL*Plus by using it to populate a refcursor variable.

Similar Messages

  • 64bit OraOLEDB failed when calling stored procedure with Ref Cursor

    Hi everyone,
    I used the ADO VB sample provided with the Oracle 10g provider installation.
    But I compiled it in 64bit Visual Studio 2005 and ran on Windows 2003 x64 server.
    The function call "cmd.Execute" when it is trying to call a stored procedure which has an Out Ref Cursor parameter. The exception is
    "PLS-00306: wrong number or types arguments in call"
    I already set the property "PLSQLRSet" to true. But it doesn't help.
    The same code works if I compiled in 32 bit.
    It also works if the stored procedure does not have Ref Cursor parameter.
    I am guessing this is a bug in the 64bit Oracle provider. Anyone can confirm this please? or am I missing anything?
    Wilson

    It appears to work with 11.1.0.6.20 OLEDB provider but only for ExecuteNonQuery, I'm not able to work with Fill, and yes... in x86 works perfectly, but in x64 we are still having the ORA-06550 and PLS-00306 error.
    Our Connection string is as follows:
    "Provider=OraOLEDB.Oracle.1;OLEDB.NET=true;Password=xxxxx;Persist Security Info=True;User ID=exxxxx;Data Source=ECOR; PLSQLRSet=True"
    We are not using ODP.NET.
    Can you confirm that Fill method works with such update?

  • Dynamically calling stored procedure and getting result set c++

    Hello,
    I am trying to write some c++ code that will dynamically bind values to a stored procedure and excute the procedure and get back a resultset. The problem I am running into is how to get back the resultset. Any help or example would be highly appreciated.

    int main(int argc, char* argv[])
    OCIError* pOciError;
    char* pConnectChar = "dbname";
    char* pUsernameChar = "scott";
    char* pPasswordChar = "tiger";
    int answer;
    OCIStmt* pOciStatement;
    char* sqlCharArray = "BEGIN :success := sp_ListEmp; END;";
    int id;
    char ename[40];
    OCIEnv* g_pOciEnvironment = NULL;
    OCIServer* g_pOciServer = NULL;
    OCISession* g_pOciSession = NULL;
    OCISvcCtx* g_pOciServiceContext = NULL;
    sb2* pIndicator=0;
    sb2* pIndicator2=0;
    sb2* pIndicator3=0;
    OCIDefine* pOciDefine;
    OCIDefine* pOciDefine2;
    OCIBind* pBind;
    OCIStmt* cursor;
    answer = OCIInitialize(OCI_THREADED, NULL, NULL, NULL, NULL);
    answer = OCIEnvInit(&g_pOciEnvironment, OCI_DEFAULT, 0, NULL);
    answer = OCIHandleAlloc(g_pOciEnvironment, (void **)&pOciError, OCI_HTYPE_ERROR, 0, NULL);
    answer = OCIHandleAlloc(g_pOciEnvironment, (void **)&g_pOciSession, OCI_HTYPE_SESSION, 0, NULL);
    answer = OCIHandleAlloc(g_pOciEnvironment, (void **)&g_pOciServer, OCI_HTYPE_SERVER, 0, NULL);
    answer = OCIHandleAlloc(g_pOciEnvironment, (void **)&g_pOciServiceContext, OCI_HTYPE_SVCCTX, 0, NULL);
    answer = OCIServerAttach(g_pOciServer, pOciError, (unsigned char *)pConnectChar, strlen(pConnectChar),
    OCI_DEFAULT);
    answer = OCIAttrSet(g_pOciSession, OCI_HTYPE_SESSION, (unsigned char *)pUsernameChar, strlen(pUsernameChar),
    OCI_ATTR_USERNAME, pOciError);
    answer = OCIAttrSet(g_pOciSession, OCI_HTYPE_SESSION, (unsigned char *)pPasswordChar, strlen(pPasswordChar),
    OCI_ATTR_PASSWORD, pOciError);
    answer = OCIAttrSet(g_pOciServiceContext, OCI_HTYPE_SVCCTX, g_pOciServer, 0, OCI_ATTR_SERVER, pOciError);
    answer = OCIAttrSet(g_pOciServiceContext, OCI_HTYPE_SVCCTX, g_pOciSession, 0, OCI_ATTR_SESSION, pOciError);
    answer = OCISessionBegin(g_pOciServiceContext, pOciError, g_pOciSession, OCI_CRED_RDBMS, OCI_DEFAULT);
    answer = OCIHandleAlloc(g_pOciEnvironment, (void **)(&pOciStatement), OCI_HTYPE_STMT, 0, NULL);
    answer = OCIStmtPrepare(pOciStatement, pOciError, (unsigned char *)sqlCharArray, strlen(sqlCharArray),
    OCI_NTV_SYNTAX, OCI_DEFAULT);
    answer = OCIHandleAlloc(g_pOciEnvironment, (void **)(&cursor), OCI_HTYPE_STMT, 0, NULL);
    answer = OCIBindByPos(pOciStatement,&pBind, pOciError, 1, &cursor, 0,SQLT_RSET,
    pIndicator2, 0,NULL, 0,0,OCI_DEFAULT);
    answer = OCIStmtExecute(g_pOciServiceContext, pOciStatement, pOciError, 1, 0, NULL, NULL,
    OCI_COMMIT_ON_SUCCESS);
    answer = OCIDefineByPos(cursor,&pOciDefine, pOciError,2,&id,sizeof(int),
    SQLT_INT,pIndicator, 0, 0,OCI_DEFAULT);
    answer = OCIDefineByPos(cursor,&pOciDefine2, pOciError,1,ename,40,
    SQLT_STR,pIndicator3, 0, 0,OCI_DEFAULT);
    if (answer == 0)
    while ((answer = OCIStmtFetch(cursor,pOciError, 1,OCI_FETCH_NEXT,OCI_DEFAULT)) == 0)
    printf("fetched id %d and name %s\n",id,ename);
    answer = OCIHandleFree(pOciError, OCI_HTYPE_ERROR);
    return 0;

  • SSRS 2008 Using Stored Procedure with SysRef Cursor Oracle

    Hi,
    I am new to SSRS.
    I have a ssrs procedure which runs to Return Result of Select Query. ( In form of SYS REF Cursor in Oracle ).
    When I am trying to see the Value in Test Window. It is showing Output. But when I m Running the Report in the environment it is giving me error.
    Please help me if there is a better way of handling it.
    As I read in some forum as SSRS has issue handling SYS Ref Cursor...
    Thanks
    Priyank
    Thanks Priyank Piyush

    Hi Priyank,
    According to your description, you are use a Stored Procedure from SysRef Cursor Oracle as the report dataset. The query works well in Dataset Query Designer, while an error occurs when you render the report.
    As per my understanding, the problem is that there are something wrong with the report design. Please double-check the design of the report. In order to trouble shoot the problem more efficiently, could you please post the detail error message? Then we can
    make further analysis.
    Thanks,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • Link Query and Ref Cursor Query

    Hi all!!
    How can I link Query and Ref Cursor Query??
    I mean, How can I pass input parameters to the PL/SQL procedure if they are not User parameters but they come from another table??
    Thanks a lot
    F.

    I have searched the forum and this is the closest to my problem.
    Just started using ref cursors in my reports.
    The problem I am running into is that I have two ref cursor queries in my report - they each contain a column named seq_no which forms a join (in the database) .
    My report returns the correct number of records in each query, but I can't find a way to enforce the join. I've tried all the methods I can think of including combining the results into one query.
    The IDE won't let me join on a column and when I join on the group (which I make only contain the seq_no fields) that join is ignored.
    Can anyone help me on this?

  • How to create stored procedures and use those in Crystal reports

    Hi All,
    Can anyone explain me how to create a stored procedure and use that stored procedure in Crystal reports. As I have few doubts in this process, It would be great if you can explain me with a small stored proc example.
    Thanks in advance.

    Hello,
    There is a document explainining how to use Oracle stored proc with Crystal reports.
    Check at:
    https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/1084c536-711e-2b10-e48a-924a60745253
    It is for older version but it should work and you can refer to it to get general idea how to start with it. It has a sample oracle stored proc and how to connect it from Crystal Reports.

  • How to handle Stored Procedure and Views

    Dear All
    While dealing with Oracle database related scenario. I came across Stored Procedures and Views. Which are complex in nature. Using SAP XI how we can handle them ?
    Is JDBC adaptor is capable of that.? Can you help me Data type structure for oracle.
    How max occur play important role in that. How to identify root and item level structure for oracle
    I am dealing with stored procedures while inserting data. and using views i need to get data from oracle database.
    What is the syntax of query we use to put while using JDBC adaptor?
    Please help and provide bit detail information over this so that i can execute scenario
    Thanks
    Gaurav

    1) jdbc:oracle:thin:@xxx.xxx.xxx.xxx:1521:sid
    2)Occurence==> o,1, >1 , Unbounded
    Occurrence=> ready to accept 0 / 1 / more than 1/ multiple record  (for source) and how it will be passed to target.
    http://help.sap.com/saphelp_erp2004/helpdata/en/b6/0b733cb7d61952e10000000a11405a/frameset.htm
    3)
    <StatementName5>
    <storedProcedureName action=” EXECUTE”>
        <table>realStoredProcedureeName</table>
    <param1 [isInput=”true”] [isOutput=true] type=SQLDatatype>val1</param1>
    </storedProcedureName >
      </StatementName5>
    refer
    http://help.sap.com/saphelp_nw04/helpdata/en/22/b4d13b633f7748b4d34f3191529946/frameset.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/2e/96fd3f2d14e869e10000000a155106/frameset.htm

  • Java stored procedures and referencing classes

    We are referencing to some classes/libraries which are not present in the database. In normal java world, you specify the libraries/classes needed to run your piece of code in the CLASSPATH and that forms part of your complete code.
    Can java stored procedures in the database refer to libraries or class files it requires on the file system rather than the database? Is it possible to make this happen?
    Thanks

    pshiva,
    Posting the same question to multiple forums usually doesn't increase your chances of getting an answer, and it just frustrates those wishing to answer you with the result being that any future questions you post may have less chance of being answered -- because of your uncourteous, initial behaviour.
    I have answered your other thread:
    java stored procedures and referencing classes
    In my opinion, that forum (the Database JVM forum) is the most appropriate for your question.
    Good Luck,
    Avi.

  • Java Stored Procedures and Triggers

    I want to to use Java stored procedures and triggers within the Oracle 11g XE
    So please , someone can help me because i tried but it didn't work
    I don't know where is the problem
    Thanks !!

    WRONG FORUM!
    Welcome to the forum but this forum is for Java JDBC questions and issues. Your question should be posted in the SQL and PL/SQL forum
    PL/SQL
    >
    I want to to use Java stored procedures and triggers within the Oracle 11g XE
    So please , someone can help me because i tried but it didn't work
    I don't know where is the problem
    >
    Mark this question ANSWERED and repost the question in the other forum
    Before you post review the Oracle Database Java Developer's Guide - it shows how to create Java stored procedures and has example code
    http://docs.oracle.com/cd/B28359_01/java.111/b31225/chfive.htm
    And in the new post don't just say "I tried but it didn't work". You need to post the code that you tried and what you mean by "didn't work".
    If you got any exceptions or errors you need to post a copy of the exact message or error that you are getting.

  • How to get a list of values used in the WHERE filter of stored procedures and functions in SQL Server

    How can I get a list of values (one or more) used in the WHERE filter of stored procedures and functions in SQL Server?
    How can get a list of values as shown (highlighted) in the sample stored procedure below?
    ALTER PROC [dbo].[sp_LoanInfo_Data_Extract] AS
    SELECT   [LOAN_ACCT].PROD_DT,
                  [LOAN_ACCT].ACCT_NBR, 
                  [LOAN_NOTE2].OFCR_CD, 
                  [LOAN_NOTE1].CURR_PRIN_BAL_AMT, 
                  [LOAN_NOTE2].BR_NBR,
    INTO #Table1
    FROM
                    dbo.[LOAN_NOTE1],
                    dbo.[LOAN_NOTE2],
                    dbo.[LOAN_ACCT]
    WHERE
                    [LOAN_ACCT].PROD_DT = [LOAN_NOTE1].PROD_DT
                    and
                    [LOAN_ACCT].ACCT_NBR = [LOAN_NOTE1].ACCT_NBR
                    and
                    [LOAN_NOTE1].PROD_DT = [LOAN_NOTE2].PROD_DT
                    and
                    [LOAN_NOTE1].MSTR_ACCT_NBR = [LOAN_NOTE2].MSTR_ACCT_NBR
                    and
                    [LOAN_ACCT].PROD_DT = '2015-03-10'
                    and
                    [LOAN_ACCT].ACCT_STAT_CD IN
    ('A','D')
                    and
                    [LOAN_NOTE2].LOAN_STAT_CD IN
    ('J','Z')
    Lenfinkel

    Hi LenFinkel,
    May I know what is purpose of this requirement, as olaf said,you may parse the T-SQL code (or the execution plan), which is not that easy.
    I have noticed that the condition values in your Stored Procedure(SP) are hard coded and among them there is a date values, I believe some day you may have to alter the SP when the date expires. So why not declare 3 parameters of the SP instead hard coding?
    For multiple values paramter you can use a
    table-valued parameter. Then there's no problem getting the values.
    If you could elaborate your purpose, we may help to find better workaround.
    Eric Zhang
    TechNet Community Support

  • How to create a stored procedure and use it in Crystal reports

    Hi All,
    Can anyone explain me how to create a stored procedure and use that stored procedure in Crystal reports. As I have few doubts in this process, It would be great if you can explain me with a small stored proc example.
    Thanks in advance.

    If you are using MSSQL SERVER then try creating a stored procedure like this
    create proc Name
    select * from Table
    by executing this in sql query analyzer will create a stored procedure that returns all the data from Table
    here is the syntax to create SP
    Syntax
    CREATE PROC [ EDURE ] procedure_name [ ; number ]
        [ { @parameter data_type }
            [ VARYING ] [ = default ] [ OUTPUT ]
        ] [ ,...n ]
    [ WITH
        { RECOMPILE | ENCRYPTION | RECOMPILE , ENCRYPTION } ]
    [ FOR REPLICATION ]
    AS sql_statement [ ...n ]
    Now Create new report and create new connection to your database and select stored procedure and add it to the report that shows all the columns and you can place the required fields in the report and refresh the report.
    Regards,
    Raghavendra
    Edited by: Raghavendra Gadhamsetty on Jun 11, 2009 1:45 AM

  • Stored procedure and peoplecode in app engine

    Hey all,
    i want to call a stored procedure in peoplecode using sqlexec. i guess the following syntax is correct.
    sqlexec("exec sp_name");
    my question is
    will the peoplecode wait until the stored procedure completes?
    or
    will it just send the command to database to execute the stored procedure and continue executing the next statements after the sql exec.
    Please let me know if i am not explain better and need to give an example.
    Please help me.
    thank you.

    "...will the peoplecode wait until the stored procedure completes"
    Yes.
    Nicolas.

  • Java stored procedures and triggers in lite

    Hi
    We are using java stored procedures and java triggers in our application for oracle lite database 5.1.
    We would like to know whether these procedures and triggers are uploaded or associated with tables or not because triggers are not being fired for the tables.
    The question is - how to find the uploaded procedures and triggers in system tables.
    We dont find any tables like (all_objects, user_objects) for this in oracle lite system catalogs given in the documentation.
    thanks in advance
    yugandhar

    I don't have much experience with Lite, but I'm running 9i Personal Edition. Any information about triggers can be found in the "ALL_TRIGGERS" view. You will want to filter out any rows where OWNER = 'SYS' unless you created your triggers as SYS. As for procedures and functions, you can see what you have created in the "ALL_OBJECTS" view where OBJECT_TYPE = 'PROCEDURE' or 'FUNCTION', once again filtering out rows where OWNER = 'SYS'. To see the code of any procedure or function, select substr(text,1,80) from ALL_SOURCE where NAME = 'function name' ORDER BY LINE.
    Hope this helps!

  • Oracle stored Procedure and Packages in CR4E

    Hi,
    I want to use Stored Procedure in CR4E. I don't know how to use Stored Procedures and packages in Crystal Reports for Eclipse. In the data source explorer I can only see the Tables, Views and Stored Procedures but not packages from my Schema and when I can only drag & drop the Tables and Views into the Field Explorer, I can't drag & Drop the Stored Procedures.
    I managed to attached the stored procedure from CR studio. I opened the report in CR4E and I can see the stored procedure and can preview the data. When I try to run the report and override the datasource, it throws oracle error saying "ORA-01008: Not all variables bound". When I tried to use the option
    DBOptions._doNotVerifyDB
    while replacing connection I get the this error
    java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Boolean
         at java.lang.Boolean.compareTo(Boolean.java:26)
         at com.crystaldecisions.sdk.occa.report.lib.ClonableMap.hasContent(ClonableMap.java:112)
         at com.crystaldecisions.client.helper.CloneUtil.hasContent(CloneUtil.java:135)
         at com.crystaldecisions.sdk.occa.report.data.ConnectionInfo.hasContent(SourceFile:151)
         at com.crystaldecisions.client.helper.CloneUtil.hasContent(CloneUtil.java:135)
         at com.crystaldecisions.sdk.occa.report.data.Table.hasContent(SourceFile:286)
         at com.crystaldecisions.sdk.occa.report.data.Procedure.hasContent(SourceFile:212)
         at com.crystaldecisions.sdk.occa.report.lib.ArrayListMerger.haveMatchingContent(ArrayListMerger.java:232)
         at com.crystaldecisions.sdk.occa.report.lib.ArrayListMerger.mergePass(ArrayListMerger.java:138)
         at com.crystaldecisions.sdk.occa.report.lib.ArrayListMerger.merge(ArrayListMerger.java:86)
         at com.crystaldecisions.sdk.occa.report.lib.ControllableList.copyTo(ControllableList.java:68)
         at com.crystaldecisions.sdk.occa.report.data.Database.copyTo(SourceFile:105)
         at com.crystaldecisions.sdk.occa.report.lib.ControllableHelper.copyToPreservingReferences(ControllableHelper.java:153)
         at com.crystaldecisions.sdk.occa.report.application.ReportClientDocument.a(SourceFile:2556)
         at com.crystaldecisions.sdk.occa.report.application.b9.onDataSourceChanging(SourceFile:315)
         at com.crystaldecisions.sdk.occa.report.application.DatabaseController.a(SourceFile:971)
         at com.crystaldecisions.sdk.occa.report.application.DatabaseController.a(SourceFile:4078)
         at com.crystaldecisions.sdk.occa.report.application.bv.new(SourceFile:121)
         at com.crystaldecisions.sdk.occa.report.application.bv.int(SourceFile:91)
         at com.crystaldecisions.proxy.remoteagent.UndoUnitBase.performDo(SourceFile:151)
         at com.crystaldecisions.proxy.remoteagent.UndoUnitBase.a(SourceFile:106)
         at com.crystaldecisions.sdk.occa.report.application.DatabaseController.a(SourceFile:2159)
         at com.crystaldecisions.sdk.occa.report.application.DatabaseController.mapFields(SourceFile:4061)
         at com.crystaldecisions.sdk.occa.report.application.DatabaseController.a(SourceFile:3914)
         at com.crystaldecisions.sdk.occa.report.application.DatabaseController.replaceConnection(SourceFile:3880)
         at
    Please advice if Stored procedures and packages are supported in CR4E ?

    Hi, Jack76,
    According to the [CR4E Release Notes|http://help.sap.com/businessobject/product_guides/cr4E/en/cr4e_relnotes_en.pdf] (available from the [CR4E Download page|http://www.businessobjects.com/campaigns/forms/downloads/crystal/eclipse/datasave.asp]), stored procedures are supported, as long as they don't use parameters that need null values.
    I don't see any references to packages.
    Bryan

  • Can i use Stored procedures and triggers with SDK

    hi all
    How to use the stored procedure and Triggers with SDK, can i get a sample code
    Regards
    Salah

    Hi, Salah.
    Use "Exec" in your query to run procedures.
    SAPbobsCOM.Recordset     oRS;
    oRS = (SAPbobsCOM.Recordset)pCmp.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);
    oRS.DoQuery ("EXEC YourStoredProcName");
    Triggers are not supported in SDK.
    Regards,
    Aleksey

Maybe you are looking for

  • Issue opening Web Analysis report

    I create, with buttons, links between reports in web analysis. Sometimes when I click on one of them in workspace, it doesn't open linked report, but another one. Furthermore this last one is automatically saved as the previous report, and I can't op

  • My itunes wont open at all, it starts to load then just goes back to as if i didnt try to open it. it wont even open when i connect my ipod

    I am unsure what happened to it, it started doing this yesterday but worked the day before. i tried to reinstall itunes and it didnt work doing it that way either. any help would be extremely helpful, i would like to add new music to my ipod.

  • Attachments missing in emails

    Since updating to Mavericks, all attachments in existing emails are missing - there's a box with a question mark where they were. Any suggestions, please? Phil

  • Won't boot up at all

    My Blackberry PlayBook (2 month old) turned off due to low battery, I tryed to recharge it 3 days later, the only thing it did was the red dot flashing for about 10 sec. and afterwards nothing. So I tryed to charge it over USB, first the Blackberry d

  • Help needed with bit & unicode

    Hi, I have an issue with the following code when setting the unicode flag for a Z program. check usr02-uflag o lock. check usr02-uflag z lock. The field usr02-uflag has a data type of INT1and an output length of 3. The field lock is defined as "lock(