Running queries¶
- Use
:[N]TDOto execute the current statement plus the nextN-1statements (split based on Tree-sitter nodes) and render table-formatted results in a split buffer. - Use
:[range]TDVto execute statements from the visual selection (split on;) and render table-formatted results in a split buffer. - Use
:[N]TDMor:[range]TDMVfor multistatement execution: submits statements as a single BTEQ job (ideal for transactions likeBEGIN TRANSACTION ... COMMIT;). - Use
:TDRerunto re-run the most recent query exactly as it was sent (bound tog.in SQL buffers and.in result buffers). - Errors are displayed with the Teradata error code and description as returned by BTEQ.
- Set
retlimit(default100) to control the maximum number of rows returned per query.
:[N]TDO " run current + next N-1 statements
:[range]TDV " run visual selection
:[N]TDM " multistatement run (single BTEQ session)
:[range]TDMV " multistatement visual selection
:TDRerun " re-run latest query
Multistatement queries (:TDM / :TDMV)¶
When executing dependent statements that must share a transaction or session state (such as temporary tables or explicit transaction blocks):
- Use
:TDM(normal mode with optional count[N]) or:TDMV(visual selection). - Statements are batched and executed sequentially in a single BTEQ session.
- If an error occurs, execution stops and reports the failure.
Re-running queries¶
Use :TDRerun to re-run the most recent query exactly as it was sent. The re-run is a new BTEQ job: it gets its own history ID and its own line in :TDJ.
Keymaps¶
g.in Teradata SQL buffers..in result buffers.
(Both keymaps are configurable via rerun_keymaps.)
The two default keymaps differ intentionally: in Teradata SQL buffers, . keeps its standard Vim behavior (repeat the last change), so g. is used. In result buffers (which are nofile and read-only), plain . is free and used directly.
Window reuse¶
The refreshed grid replaces the result of the latest query wherever that result is on screen: press the key inside that result buffer, or from the Teradata buffer you ran it from, and the same window is reused.
If the result window has been closed, or you are looking at an older result, the new grid opens in its own split so nothing you are still reading is discarded.
Edit mode protection
While a result buffer is in edit mode, the re-run mapping refuses to run and asks you to save or cancel your edits first.
Output & limits¶
- Results are displayed in a table layout in a split.
retlimitlets you cap rows to control memory/latency.- Very large results (> ~10k lines) are possible but not the main target; consider TPT for heavy exports.