Sql Server Function Declare Variable Postgresql Database Access