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