Hay un error: ERROR: column "un" does not exist LINE 25: WHERE n.idnota =un ^