@sqlrooms/duckdb / separateLastStatement
Function: separateLastStatement()
separateLastStatement(
query):SeparatedStatements
Separates a SQL query into preceding statements and the last statement. Useful when you need to execute multiple statements but handle the last one differently (e.g., wrap it in CREATE TABLE, add LIMIT, etc.).
Parameters
| Parameter | Type | Description |
|---|---|---|
query | string | The SQL query string containing one or more statements |
Returns
Object containing preceding statements and the last statement
Throws
Error if the query contains no statements
