sqlitesqlitemanager

Syntax Error in Sqlite manager


hi I m using the following code to generate a table on sqlite manager.

CREATE TABLE Transaction (ID PRIMARY KEY , amount REAL , currencyCode CHAR(3) , comments VARCHAR , debitAccount INTEGER , creditAccount INTEGER , debitAccountExchangeRate REAL , creditAccountExchangeRate REAL , FOREIGN KEY (currencyCode)REFERENCES Currency (code) , FOREIGN KEY (debitAccount) REFERENCES Account  (ID) , FOREIGN KEY (parentAccount) REFERENCES Account (ID ));

but I am getting the syntax error. Can any one please specify what am i doing wrong here.

    [ near "Transaction": syntax error ]
    Exception Name: NS_ERROR_FAILURE
      Exception Message: Component returned failure code: 0x80004005 (NS_ERROR_FAILURE)      [mozIStorageConnection.createStatement]

Solution

  • Try this..

    CREATE TABLE "Transaction" (ID PRIMARY KEY , amount REAL , currencyCode CHAR(3) , comments VARCHAR , debitAccount INTEGER , creditAccount INTEGER , debitAccountExchangeRate REAL , creditAccountExchangeRate REAL , FOREIGN KEY (currencyCode)REFERENCES Currency (code) , FOREIGN KEY (debitAccount) REFERENCES Account  (ID) , FOREIGN KEY (creditAccount) REFERENCES Account (ID ));