Firebird 2.1 - Simple SELECT

2019-02-27 08:24发布

问题:

I would like to union some data, but a simple select example not working. Selecting existing tables work fine...

SELECT 1 as foo

Message:

can't format message 13:896 -- message file C:\xxxx\firebird.msg not found.
Dynamic SQL Error.
SQL error code = -104.
corrupt pool.

In MySQL and Postgres is no problem with these simple select..

Thanks for help!

回答1:

Firebird (like many other DBMS) requires a FROM clause. In Oracle you'd use the DUAL table, in Firebird you can use RDB$DATABASE

SELECT 1 as foo
FROM RDB$DATABASE;

As RDB$DATABASE always contains exactly one row, this works the same way as Oracle's DUAL table (or IBM's SYSDUMMY)



回答2:

It incorrect syntax for firebird. Right SELECT 1 as foo from RDB$DATABASE. RDB$DATABASE it system table for it RDBMS. You can read about FIREBIRD system tables here.