简体   繁体   English

Firebird SQL:在查询文本中传递多行数据

[英]Firebird SQL: pass multi-row data in the query text

is it possible to use an array of elements as a select statement? 是否可以使用元素数组作为select语句? I know it is possiible to get rows based on static elements like this: 我知道有可能基于这样的静态元素来获取行:

SELECT 405, CAST('4D6178' AS VARCHAR(32)), CAST('2017-01-01 00:00:00' AS TIMESTAMP) FROM rdb$databas

That will give you a table select with one row. 这将为您提供带一行的表选择。 Now I would like to get this as table with n rows, but I don't know how to achieve this. 现在,我想将其作为具有n行的表来获取,但是我不知道如何实现。 Due to the fact that firebird doesn't allow multiple select statements I cannot only append n times a selec. 由于firebird不允许使用多个select语句,因此我不能仅将n次附加selec。

Info : Firebird 2.1 信息:火鸟2.1

Use UNION ALL clause. 使用UNION ALL子句。

https://en.wikipedia.org/wiki/Set_operations_(SQL)#UNION_operator https://zh.wikipedia.org/wiki/Set_operations_(SQL)#UNION_operator

Select x,y,z From RDB$DATABASE
    UNION ALL
Select a,b,c From RDB$DATABASE
    UNION ALL
Select k,l,m From RDB$DATABASE

Notice however that this should only be used for small data. 但是请注意,这仅应用于小数据。 Firebird query length is limited to 64KB and even if that would not be so - abusing this method to inject lots of data would not be good. Firebird查询的长度限制为64KB,即使那样也不是-滥用此方法注入大量数据将不是很好。

If you really need to enter lot of similar (same structure) data rows - use Global Temporary Tables 如果您确实需要输入大量相似(结构相同)的数据行,请使用全局临时表

The following discussion hopefully would give you more insights: https://stackoverflow.com/a/43997801/976391 以下讨论有望给您更多的见解: https : //stackoverflow.com/a/43997801/976391

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM