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