0

I am a beginner with Interbase (always used Advantage and SQL Server) and I am now running into a problem that is probably very easy to fix, but I'm just not seeing it (nor can I find a usable hint in the documentation). Please consider the following (condensed script):

CREATE DOMAIN DOM_ID AS INTEGER;
CREATE TABLE Relatie (
  ID DOM_ID NOT NULL,
  RelatieNaam VARCHAR(100),
  Bedrijf VARCHAR(40),
  CONSTRAINT PK_RELATIE PRIMARY KEY (ID)
);

This script fails (using 'Prepare') with error message 'Dynamic SQL error. SQL Error code = -104. Token unknown - line 2, char 1 CREATE'.

I first thought creating the domain requires a Commit but as per documentation that's not required here since it's a DDL statement.

What am I doing wrong / am I overlooking?

0

1 Answer 1

0

I have no experience with this but looks like you are having problem with first CREATE.

And when I search found this link. https://docwiki.embarcadero.com/InterBase/2020/en/Creating_a_Domain

As I see there are additional lines with "EXEC SQL" before and "COMMIT;" after CREATE DOMAIN.

Also, it is written: "Once a domain is defined and committed, it can be used in CREATE TABLE statements to define columns."

Hope this helps.

6
  • For some reason, it can't be done in a single script (??). Creating the domain first and then creating the table (i.e. running two interactive SQL's) works. Placing EXEC SQL before the CREATE DOMAIN or COMMIT thereafter, results in the same error message ('Token unknown'). Moreover, ANYTHING after the CREATE DOMAIN statement (CREATE, COMMIT, etc.) results in this error. Very strange. I would think it's possible to build a single SQL script to generate all database objects in one pass....
    – Mark
    Oct 31 at 10:41
  • Did you tried with "EXEC SQL" statments? Oct 31 at 12:15
  • Yes, same error... The Interactive SQL window (IB Console) does not recognize it, before or after the CREATE DOMAIN statement.
    – Mark
    Oct 31 at 12:44
  • What about this line "ID DOM_ID NOT NULL,"? Are you sure usage of ID, I could not find that. docwiki.embarcadero.com/InterBase/2020/en/CREATE_TABLE Oct 31 at 13:50
  • ID would be the fieldname. Not sure what you're asking here...
    – Mark
    Nov 2 at 6:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.