The table `Runs` holds one row per run of an Invantive Script performed in the current process. A run is the execution of one script file, of one interactive session or of one batch of statements handed over by a calling program. A script which starts another script yields a second run nested in the first.
The columns of the table `Runs` are:
- `ID` (`int64`): identifier of the run, unique within the process and ascending in order of starting.
- `PARENT_RUN_ID` (`int64`): identifier of the run which started this run. Empty for the outermost run.
- `PARENT_STATEMENT_ID` (`int64`): identifier of the statement which started this run, referring to `StatementExecutions`. Empty for the outermost run.
- `NESTING_LEVEL` (`int32`): depth of the run. Zero for the outermost run and one higher for each script started from another.
- `SOURCE_FILE_NAME` (`varchar2`): name and path of the script file. Empty when the statements did not come from a file.
- `SOURCE_KIND` (`varchar2`): where the statements came from. One of `FILE`, `STDIN`, `INTERACTIVE` and `API`.
- `STARTED_UTC` (`datetime`): moment at which the run started (UTC).
- `ENDED_UTC` (`datetime`): moment at which the run ended (UTC). Empty while the run is busy.
- `DURATION_MS` (`double`): duration of the run in milliseconds. Empty while the run is busy.
- `OUTCOME` (`varchar2`): how the run ended. One of `RUNNING`, `COMPLETED`, `FAILED` and `ABORTED`.
- `EXIT_CODE` (`int32`): exit code the run ended with. Empty for a run which reached its end without an exit statement and without an error.
A run queried from within itself always reads `RUNNING`, since a run is only closed off once its last statement has been executed. To see the outcome of a completed run, query a run which this run started, or query the profile from the run which started this one.
The table deliberately holds no totals over the statements of a run. Those follow from a query on `StatementExecutions` grouped by `RUN_ID`, and a second tally kept alongside would be free to drift from the first.
The following example lists the runs of the current process with their outcome:
```sql
select run.id
, run.nesting_level
, run.source_kind
, run.source_file_name
, run.outcome
, run.duration_ms
from Runs@script run
order
by run.id
```