开发者

BLToolkit Oracle SP support

开发者 https://www.devze.com 2023-03-22 04:57 出处:网络
Does BLT support Oracle stored procedures? I\'ve tried numerous methods, described below to get it to work but no luck. The stored procedure updates a table with several values. This is the stored pro

Does BLT support Oracle stored procedures? I've tried numerous methods, described below to get it to work but no luck. The stored procedure updates a table with several values. This is the stored procedure, a small test procedure.

DROP PROCEDURE BETA_AUTO_UPDATE;
/

 CREATE OR REPLACE PR开发者_如何学编程OCEDURE BETA_AUTO_UPDATE
   (
      AutoId IN NUMBER,
      Rule  IN NVARCHAR2,  
      Nam  IN NVARCHAR2,
      Loc IN NVARCHAR2
   )
  IS
  BEGIN 

UPDATE Beta_Auto
SET RuleGuid = Rule,        
    Name = Nam,
    Location = Loc
WHERE Id=AutoId;

  EXCEPTION 
     WHEN OTHERS THEN 
         RAISE_APPLICATION_ERROR(-20001, 'ERROR OCCURED DURING UPDATE');


   END BETA_AUTO_UPDATE;
   /

Tried the following

        DbManager.AddDataProvider(new OdpDataProvider());
        DbManager OracleDb = new DbManager("BetaOracleDBConn");

        Beta_Auto Betar = new Beta_Auto();
        Betar.ID = 1;
        Betar.Name = "Jim";
        Betar.RuleGuid = "jlDKDKDKDKDKDKp";
        Betar.Location = "LocDLDLDLDLDtor";

        OracleDb.SetSpCommand("Beta_Auto_UPDATE",       
        OracleDb.CreateParameters(Betar)).ExecuteNonQuery();

That didn't work.

Tried this

        [ActionName("UPDATE")]
        public abstract void Update(Beta_Auto Auto);

That didn't work.

Tried this:

        [SprocName("Beta_Auto_Update")]
        public abstract void UpdateByParam(
        [Direction.InputOutput("ID", "RuleGuid", "Name", "Location")] Beta_Auto Auto);

That didn't work.

          [SprocName("Beta_Auto_Update")]
          public abstract void UpdateByParam(int Id, string RuleGuid, string Name,  string Location);

Also tried this:

[ActionName("Update")]
public abstract void UpdateByParam(int Id, string RuleGuid, string Name, string Location);

That didn't work.

Set the trace level on odp.net to 7. Saw that the call was being made, but couldn't see any parameters. Swapped out XE (thought it might have been a licensing problem as db was bigger that 5GB) for enterprise Oracle. Didn't work.

Create a new user, datafile, tablespace, and assigned all roles and privs, including Execute Any Procedure to the user. Didn't work.

I ran a standard ado.net (very long winded) to call the stored procedure via OracleCommand and it called perfectly and did the update.

I am stumped. All of the above work for SQL Server.

Thanks. scope_creep


I'm doing it like

        var parameters = OracleDb.GetSpParameters("BETA_AUTO_UPDATE", true, true);

        parameters.SetParamValue("pParam1", param1);
        parameters.SetParamValue("pParam2", param2);
        ...

        OracleDb.SetSpCommand("BETA_AUTO_UPDATE", parameters).ExecuteNonQuery();

It's an extra round-trip, but since I'm only using stored procedures for a couple of big batch updates it doesn't really matter, (normal/simple updates are done with Linq DML operations)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号