I'd like to know whether there is some way to know the undo_retention needed for a specified query with long duration that need keep the consistence.
In other words, I'd like to know how long my query will be running.
The undo_retention needed is going to depend on how long the query runs for, how much undo space it will need, how much undo space is being used by the database among other things. Also depending on how the undo space is setup it may be set automaticly. Because of all of this there is no simple answer that you will need an undo_retention of X for a given query.
The undo retention period is the minimum amount of time that Oracle Database attempts to retain old undo information before overwriting it.
The UNDO_RETENTION parameter is ignored for a fixed size undo tablespace. The database always tunes the undo retention period for the best possible retention, based on system activity and undo tablespace size. See "Automatic Tuning of Undo Retention" for more information.