duckdb-web icon indicating copy to clipboard operation
duckdb-web copied to clipboard

SET VARIABLE should show more advanced usecases

Open Tishj opened this issue 1 year ago • 0 comments

https://duckdb.org/docs/sql/statements/set_variable.html only shows examples where the variable is set to a constant integer or a constant string.

From the PR, a scalar subquery can be used to provide the variable:

-- initialize a variable with the list of csv files
SET VARIABLE list_of_files = (SELECT LIST(file) FROM csv_files);

I think the docs should include an example of this to make it clear that this is possible. I would have assumed it wasn't possible when I read the current doc page

Tishj avatar Sep 13 '24 08:09 Tishj