Using Oracle Store Procedure In Silverlight
Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce 2010
Forum Discription: For .NET 4.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=3958
Printed Date: 06-Sep-2025 at 6:49am
Topic: Using Oracle Store Procedure In Silverlight
Posted By: EH
Subject: Using Oracle Store Procedure In Silverlight
Date Posted: 28-Jan-2013 at 1:23am
I Search Forum and did not find any sample to use oracle SP
for example i have SP Like.
PROCEDURE Get_CLSU_CANPENKA ( v_SQL IN varchar2 , cv_1 IN OUT SYS_REFCURSOR ) AS v_SQLTEMP VARCHAR2(2000) := v_SQL;
BEGIN
OPEN cv_1 FOR SELECT * FROM CLSU_CANPENKA where rownum <3; -- v_SQLTEMP;
EXCEPTION WHEN NO_DATA_FOUND THEN NULL;
END Get_CLSU_CANPENKA;
code is like ...
x.ExecuteQueryAsync(query, op => { op.Results.ForEach(VWCLSU_CANPENKAs.Add); CurrentVWCLSU_CANPENKA = VWCLSU_CANPENKAs.FirstOrDefault(); RaisePropertyChanged("CurrentVWCLSU_CANPENKA"); });
|
Replies:
Posted By: sbelini
Date Posted: 08-Feb-2013 at 1:34am
Hi EH,
StoredProcs in Oracle work similar as in SQL Server. You'll find information at http://drc.ideablade.com/devforce-2012/bin/view/Documentation/stored-procedure-queries - http://drc.ideablade.com/devforce-2012/bin/view/Documentation/stored-procedure-queries and http://drc.ideablade.com/devforce-2012/bin/view/Documentation/code-sample-stored-procedure-queries-silverlight - http://drc.ideablade.com/devforce-2012/bin/view/Documentation/code-sample-stored-procedure-queries-silverlight .
In your stored proc sample I noticed that you are using an OUT parameter. You'd be able to retrieve it as follows:
x.ExecuteQueryAsync(query, op =>
{
var myOutputParam = op.Parameters[1].Value;
...
|
or
query.Execute();
var myOutputParam = query.Parameters[1].Value;
|
Note that you will need to cast op.Parameters[1].Value to the appropriate type, as op.Parameters[1].Value alone is of type object.
It's worth mentioning that, if working with SQL Server, the first OUT parameter would be retrieved at .Parameters[0]. (as opposed to index = 1)
sbelini
|
|