csv - 在 Firebird 中使用触发器输出 CSV 文件

标签 csv firebird firebird2.5 ibexpert

是否可以创建一个触发器,在表 2 更新后立即输出选择表 1 中的字段 1 的 CSV 文件?

我尝试过使用

CREATE OR ALTER trigger test_a0 for Table 2
active after insert or update position 0
AS
begin

  if (updating and new.field1 is not null) then
  output ('C:\test\test.csv');
  select field1 from table1;
  output;
  commit;

end

最佳答案

不,Firebird 2.5 中的触发器无法输出到 CSV 文件。如果您想输出到文件,您要么需要在客户端应用程序中执行此操作,要么使用外部表(从技术上讲,它是二进制格式,而不是文本格式)。或许可以使用 UDF 创建复杂的解决方案。

在 Firebird 3 中,使用 UDR(用户定义例程)可能可以实现更简单的解决方案,但这在很大程度上是未知领域,因此我实际上不确定是否可以这样做。

关于csv - 在 Firebird 中使用触发器输出 CSV 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43399433/

相关文章:

java - 从 csv 文件读取数据 - 未找到有效源的文件异常

firebird - 如何在 Firebird DB 中将日期时间格式化/转换为 ISO8601?

sql - Firebird2.5错误: "duplicate value in unique index" without duplicate data

javascript - D3条形图不解析csv

sql-server - 使用 SQL Server Management Studio 2005 导出时使用 UTF-8 编码保存 CSV

entity-framework - View 和 Entity Framework

visual-studio-2013 - Visual Studio 2013 与 Firebird 的连接

firebird - 使用 c++builder 2010 为 firebird 2.5 创建用户定义函数

java - CSV 到 H2 - 字符编码不匹配

oracle - 使用 Delphi 数据感知组件 - 优点和缺点