NHibernate Forge
The official new home for the NHibernate for .NET community

Calling Oracle Procedure inside package

Wiki Page Hierarchy

Pages

Page Details

First published by:
suresh.rajamani
on 06-09-2010
Last revision by:
Paul V.
on 06-09-2010
0 people found this article useful.
Article
Comments (6)
History (2)
0% of people found this useful

Calling Oracle Procedure inside package

Filed under: [Edit Tags]

Hi,

I want to call oracle stored procedure in package.I used like this returns error.

Call PKG.GET_EMPLOYEES()

Then i remove the procedure from package and defined outside the package as global procedure .Then it works

Call GET_EMPLOYEES()

So how to call procedure with package name. Please help.

 

 

 

Recent Comments

By: puerta_abierta Posted on 04-11-2011 8:32

I tried to find it in  <a href=http://www.youtube.com> youtube </a>  www.youtube.com/watch  but had no luck.

By: DIDNU Posted on 01-28-2011 11:20

I think you could make or replace the package body Scalar test so as to get the result. Anyway, the method by which one has to create the Custom Oracle data client driver is really tasking and one has to go a long way before getting it done. So, I would not suggest anyone to go forward with that technique. If you are looking to call procedure with the package name, the best bet for you would be to move on with the first method!

http://raidious.com

By: Paul V. Posted on 06-11-2010 4:33
100% of people found this useful

Well i made some syntax error sorry for that(I was in a hurry)

The correction(better later than never:))

1.

create or replace package body ScalarTest as

function GetNumberOfRows return integer is

numberOfRows int;

begin

select count(*) into numberOfRows from publication;

return numberOfRows;

end;

2. A function should be call as {? = call mypackage.functionName}

All the best!

By: Paul V. Posted on 06-10-2010 13:44

Glad that you could find it usefull.

Here is another way that i discover to call a function that return a scalar value.

Supposing that we have:

create or replace package body ScalarTest as

function GetNumberOfRows return int is

numberOfRows int;

begin

--Publication is a table

select count(*) as TotalRows from Publication;

end;

end;

<sql-query name="ScalarTest" callable="true">

<return-scalar column="TotalRows" type="System.Int32"/>

 select scalartest.getnumberofrows as TotalRows from dual

</sql-query>

When you call session.GetNamedQuery("ScalarTest").UniqueResult<int>() it will return the number of rows.

Hope you find this usefull too.

By: suresh.rajamani Posted on 06-10-2010 9:13

Hi Paul,

Thanks for the reply.Your solution works gr8.

View All
Powered by Community Server (Commercial Edition), by Telligent Systems