Quantcast
Channel: Getting returned value from a stored procedure in PostgreSQL - Stack Overflow
Viewing all articles
Browse latest Browse all 2

Getting returned value from a stored procedure in PostgreSQL

$
0
0

I have a stored procedure in PostgreSQL:

CREATE OR REPLACE FUNCTION dosmth()RETURNS boolean AS$BODY$BEGINRETURN FALSE; END; $BODY$ LANGUAGE 'plpgsql' VOLATILE

From ado.net I need to retrieve the return value. I try to do the following:

   DbCommand cmd = DBTemplate.CreateStoredProcedureCommand(dbConnection, "dosmth");   cmd.Parameters.Add(DBTemplate.CreateParameter(System.Data.DbType.Boolean,"@RETURN_VALUE", System.Data.ParameterDirection.ReturnValue));   DBTemplate.ExecuteNonQuery(cmd);   Boolean bl = Convert.ToBoolean(cmd.Parameters["@RETURN_VALUE"].Value);

Unfortunately this does not work telling me that the type DBNull cannot be converted to Boolean.
Any ideas?


Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles



Latest Images