New Posts New Posts RSS Feed: Using Oracle Store Procedure In Silverlight
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Using Oracle Store Procedure In Silverlight

 Post Reply Post Reply
Author
EH View Drop Down
Newbie
Newbie


Joined: 28-Jan-2013
Location: Male
Posts: 1
Post Options Post Options   Quote EH Quote  Post ReplyReply Direct Link To This Post Topic: Using Oracle Store Procedure In Silverlight
    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");
            });
Back to Top
sbelini View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 13-Aug-2010
Location: Oakland
Posts: 786
Post Options Post Options   Quote sbelini Quote  Post ReplyReply Direct Link To This Post 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 and 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
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down