Postgres Stored Procedure Declare Variable Bash Script For Loop