Pages

Monday, November 1, 2010

Procedure / plsql support in jasper report

I am not very sure from which version Jasper started supporting this feature, but recently when I was evaluating 3.7.5 version I suddenly explored this... and it is so easy...!

Well here it is how...  when you write a query in the querystring tag, Jasper has added a property called "language" and here it supports for different languages querystring. so for calling a procedure from jasper report you need to set this attribute value as "plsql", and done! just call your procedure from querystring.

<queryString language="plsql">
     <![CDATA[call myproc()]]>
</queryString>








just to make sure that your jasperreport version support this feature check your xml schema or jasper that it has this property, I am quite sure that when jasper was having DTD as validate jrxml, that time it was not supported.

4 comments:

  1. Hello!

    I wrote a function in Oracle pl/sql. This function returns sys_refcursor. Now, I want to use this function as data set in my IReport template(IReport version 4.1.2). I opened "Report query" window, chose "Report query" , "query language"="plsql" and wrote "call getEmpByDept(10)" (getEmpByDept - my function name). When I push button "Read fields" i get an error: "ora-06576 not a valid function or procedure name". What i did wrong? Function exists in Oracle database.

    Thank you for answer.

    Regards, Stanislav.

    ReplyDelete
  2. Hi, will you give me more information? specific about your function.
    if it is a function and not a procedure then the way you call is different else as shown above.
    for a function you can use select query to return values, but as you mentioned that it returns cursor I think you need to wrap it again in procedure if its a function. because function you can not call this way.

    ReplyDelete
  3. Hi!
    My goal is to call PL/SQL function(that returns ref cursor type) or procedure(with ref cursor as out parameter). The data obtained from function or procedure, I want to use like dataset in my template in IReport. If you have more detailed example, would be nice to share with us your experience because I didn't found something exact solution in the Internet.
    Have a nice day.
    Stanislav.

    ReplyDelete
  4. Hi, I have added more descriptive blog on this please visit hope it will help you.
    http://rajendratambat.blogspot.com/2011/10/calling-oracle-stored-procedure-in.html

    ReplyDelete