英文:
Filtering in table from last query ID in Snowflake
问题
以下代码正常工作:
CREATE USER test PASSWORD='test';
DESC USER test;
SELECT * from TABLE(RESULT_SCAN(LAST_QUERY_ID()));
但是当我尝试只返回一个列时:
CREATE USER test PASSWORD='test';
DESC USER test;
SELECT value from TABLE(RESULT_SCAN(LAST_QUERY_ID()));
我收到了一个错误:
错误:无效的标识符 'VALUE'。
为什么会返回这个错误,因为'value'是结果扫描中的一个现有列?
英文:
The following code works fine:
CREATE USER test PASSWORD='test';
DESC USER test;
SELECT * from TABLE(RESULT_SCAN(LAST_QUERY_ID()));
However when I try to only return one column:
CREATE USER test PASSWORD='test';
DESC USER test;
SELECT value from TABLE(RESULT_SCAN(LAST_QUERY_ID()));
I get an error:
Error: invalid identifier 'VALUE'.
Why does it return this error, as value is an existing column on the result scan?
答案1
得分: 1
你需要使用引号标识符 "col name"
来访问它:
SELECT value from TABLE(RESULT_SCAN(LAST_QUERY_ID()));
=>
SELECT "value" from TABLE(RESULT_SCAN(LAST_QUERY_ID()));
相关链接: 标识符要求
英文:
You need to use quoted identifier "col name"
to access it:
SELECT value from TABLE(RESULT_SCAN(LAST_QUERY_ID()));
=>
SELECT "value" from TABLE(RESULT_SCAN(LAST_QUERY_ID()));
Related: Identifier Requirements
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论