create and execute stored procedure in postgresql