Subject SV: [IBO] Insert query is getting an error
Author Svein Erling Tysvær
>Hi All,
>
>I am quite new to Firebird, so I may be doing some simple thing wrong. I am using Delphi 2009 on
>Windows 7 64 bit. I installed the 64bit version of Firebird.
>
>Here is the DDL of my table :

>CREATE TABLE tbl_Products (
> MFK$RICHFORMAT BLOB SUB_TYPE TEXT CHARACTER SET UNICODE_FSS,
> MFK$GUID CHAR(108) CHARACTER SET UNICODE_FSS NOT NULL,
> MFK$CTS TIMESTAMP,
> MFK$LMTS TIMESTAMP,
> ProductName VARCHAR(384) CHARACTER SET UNICODE_FSS NOT NULL,
> Description VARCHAR(768) CHARACTER SET UNICODE_FSS,
> Cost NUMERIC(10,2) DEFAULT 0 NOT NULL,
> Retail NUMERIC(10,2) DEFAULT 0 NOT NULL,
> SalePrice NUMERIC(10,2) DEFAULT 0,
> ManProdId VARCHAR(96) CHARACTER SET UNICODE_FSS,
> CategoryId INTEGER DEFAULT 0,
> TaxId CHAR(3) CHARACTER SET UNICODE_FSS,
> Markup FLOAT DEFAULT 0,
> FreightMode CHAR(24) CHARACTER SET UNICODE_FSS,
> FreightCharge NUMERIC(10,2) DEFAULT 0,
> Enabled SMALLINT DEFAULT '1',
> ThumbImage BLOB SUB_TYPE -3,
> ProductImage BLOB SUB_TYPE -3,
> ProductId VARCHAR(60) CHARACTER SET UNICODE_FSS NOT NULL,
> ManufacturerId INTEGER DEFAULT 0);
>
>/* Primary key */
>
>ALTER TABLE tbl_Products ADD CONSTRAINT INTEG_70 PRIMARY KEY (ProductId);
>
>/* Indices */
>
>CREATE UNIQUE INDEX tbl_Products_X1
> ON tbl_Products(MFK$GUID);
>CREATE INDEX tbl_Products_X2
> ON tbl_Products(MFK$CTS);
>CREATE INDEX tbl_Products_X6
> ON tbl_Products(ManProdId);
>
>-----------------------------------------------------------------
>
>Here is the insert statement in a TIBOQuery component :
>
>Insert Into "tbl_Products"
>("ProductId","ManProdId","ManufacturerId","ProductName",
>"CategoryId","Description","Cost","Retail","SalePrice",
>"TaxId","Markup","FreightMode","FreightCharge","Enabled")
>Values
>(:ProdId,:ManPId,:ManId,:ProdName,:CatId,:Desc,
> :CostP,:RetailP,:SaleP,:Tax,:PMarkup,:FreightM,:FreightC,:PEnabled)
>
>-----------------------------------------------------------------
>
>The param value types I have set are as follows :
>
>ProdId string
>ManPId string
>ManId integer
>ProdName string
>CatId integer
>Desc string
>CostP currency
>RetailP currency
>SaleP currency
>Tax string
>PMarkup currency
>FreightM string
>FreightC currency
>PEnabled shortint
>
>do these look right ?
>
>-----------------------------------------------------------
>
>And the code I have to run the insert query is :
>
>with qProductInsert2 do begin
> Close;
> ParamByName('ProdId').AsString := sProd;
> ParamByName('ManPId').AsString := sManProd;
> ParamByName('ManId').AsInteger := 1;
> ParamByName('ProdName').AsString := sProdName;
> ParamByName('CatId').AsInteger := 1;
> ParamByName('Desc').AsString := sDesc;
> ParamByName('CostP').AsFloat := cCost;
> ParamByName('RetailP').AsFloat := 0;
> ParamByName('SaleP').AsFloat := 0;
> ParamByName('Tax').AsString := 'A';
> ParamByName('PMarkup').AsFloat := 0;
> ParamByName('FreightM').AsString := '';
> ParamByName('FreightC').AsFloat := 0;
> ParamByName('PEnabled').AsInteger := 1;
> ExecSQL;
>end;
>
>------------------------------------------------------------
>
>The error I am getting is :
>
>ISC ERROR CODE:335544343
>
>ISC ERROR MESSAGE:
>invalid request BLR at offset 8
>function GETTIME is not defined
>module name or entrypoint could not be found
>
>STATEMENT:
>TIBOInternalDataset:
>"<TApplication>.afMain.fImportProducts.qProductInsert.IBOqrq.
>
>------------------------------------------------------------
>
>1. Can anyone tell me what the problem is and how to fix it?
>
>2. And do my value types for the params look correct for their respective fields?
>
>3. Does anything else look wrong?
>
>Sorry for such a long post, but i thought it would be better to post everything.
>
>Thanks for any help,
>
>Cheers,
>Paul

Hi Paul! To me, it looks wrong to use double quotes in your insert statement. Double quotes makes table and fields names case sensitive and should only be used if you used them in your CREATE TABLE statement. Just remove them, I don't think you need any kind of quotes.

Still, this doesn't fit your error message. If you've tried different versions of Firebird, it might be that you've gotten a wrong file for the messages so that the error message is incorrect, if not - well, then there's something you've forgotten to tell us. At least, I cannot see any reference to GETTIME anywhere.

HTH,
Set