Launch postgres stored procedure

Hi,

I'm trying to run from a script task a postgres stored procedure, but the postgres database return an error "call" is missing,

What Am I doing wrong ?

bool retCode = false;
var userId = Get<Guid>("UtenteId");
var year = Get<int>("Anno");
 
var userConnection = Get<UserConnection>("UserConnection");
StoredProcedure storedProcedure = new StoredProcedure(userConnection, "SifLoadSurvey");
storedProcedure.WithParameter("Year", year);
storedProcedure.WithParameter("UserId", userId);
storedProcedure.InitializeParameters();
storedProcedure.PackageName = userConnection.DBEngine.SystemPackageName;
 
using (var dbExecutor = userConnection.EnsureDBConnection()) {
	try {
        dbExecutor.CommandTimeout = 0;
        dbExecutor.StartTransaction();
        storedProcedure.Execute(dbExecutor);
        dbExecutor.CommitTransaction();
        retCode = true;
    } catch(Exception ex) {
        dbExecutor.RollbackTransaction();
        retCode =  false;
    }
}
return retCode;

 

Like 0

Like

5 comments

Hi, 

I solved it by converting the postgres procedure in a function

Hi, Stefano!

Did you call postgres function in C# code as StoredProcedure?

Stefano Bassoli, did you call your postgres function as a StoredProcedure ?

Stefano Bassoli, 

did you call the postgres function as StoredProcedure ?

Hi sorry for my late answer,

I call the postgres function as a StoredProcedure

Show all comments