GET is not a stand-alone executable command. Instead, it prefixes compound statements defined in the SQL standard and several vendor dialects. The two most common standard forms are:1. GET DIAGNOSTICS – retrieves the number of rows affected, SQLSTATE, and other condition information after a preceding SQL statement, typically inside stored procedures or functions.2. GET DESCRIPTOR – copies data from an SQL descriptor area (SQLDA) into host variables in embedded SQL applications.Vendors also introduce proprietary GET statements and functions, for example:- SQL Server: GETDATE(), GETUTCDATE() scalar functions.- PostgreSQL: GET DIAGNOSTICS (fully supported in PL/pgSQL).- IBM Db2: GET DIAGNOSTICS, GET DIAGNOSTICS EXCEPTION.Because GET is reserved, it cannot be used as an identifier unless quoted. The keyword is available only inside procedural or embedded SQL contexts, not in ad-hoc queries run directly against a database.
variable = item_name
- local variable receiving the requested diagnostic itemsqlda
- descriptor name or host variable referencing an SQLDAVALUE
(index) - 1-based column index in the descriptorhost_variable
- program variable to receive the valueGET DIAGNOSTICS, GET DESCRIPTOR, SQLSTATE, ROW_COUNT, DIAGNOSTIC STACK, ERROR HANDLING, SQLCA, SQL%ROWCOUNT
ISO/IEC SQL/1999 (Persistent Stored Modules)
No. GET only appears as part of compound statements like GET DIAGNOSTICS or GET DESCRIPTOR.
It fetches diagnostic information such as ROW_COUNT, SQLSTATE, or MESSAGE_TEXT after a preceding SQL operation inside stored programs.
PostgreSQL (PL/pgSQL), IBM Db2, and the SQL standard. SQL Server and MySQL do not offer it, though SQL Server provides GETDATE().
In many dialects you can use dialect-specific constructs: SQL%ROWCOUNT in Oracle PL/SQL, @@ROWCOUNT in SQL Server, or FOUND in PostgreSQL.