Postgresql Cursor Fetch Loop Example In Javascript