Parameter in SELECT statement's fields list - error: Data type unknown

纵饮孤独 提交于 2019-12-02 02:57:23

The problem is that Firebird needs to know the datatype of the parameter. IIRC in SQLite, everything is a string, but that is not the case in Firebird.

You will need to explicitly cast the parameter to inform Firebird about the expected type, for example:

SELECT name, surname, cast(? as varchar(100)) AS myText
FROM myTable

Where the ? is a positional parameter. Firebird doesn't have named parameters (except in procedures), but if your access library simulates named parameters, then probably the following will work as well:

SELECT name, surname, cast(:string as varchar(100)) AS myText
FROM myTable

The ability to cast parameters in the select-clause does not work in older Firebird version (I believe it was introduced in Firebird 2.5, but I'm not 100% sure).

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!