-2

I'm trying to update a field in a table and am unsure if I'm just completely wrong or if it's a possible limitation of using Advantage Database.

My Script:

UPDATE myTable SET myField = REPLACE(myField,substring(myField,myNumber,mynumber),'<>') Where myField = '<>';

The error I receive is "Expected lexical element not found: -- Missing table name. You are missing the table name after the keyword UPDATE. -- Location of error in the SQL statement is: 8"

Cody G.
  • 53
  • 3
  • 2
    Very likely to be an error on your part. Try writing a simple script to illustrate the problem. See https://stackoverflow.com/questions/53224106/adding-value-plus-1-each-time-as-an-update for an example script that creates a temporary table and updates it. – dougwoodrow May 26 '22 at 11:10

1 Answers1

1

Please show the actual statement that produced the "missing table name" error. The statement you gave is syntactically correct.

DECLARE myNumber INTEGER;
myNumber = 1;

//TRY DROP TABLE myTable; CATCH ALL END TRY;

CREATE TABLE myTable
(
  id AUTOINC,
  myField VARCHAR(20)
);

INSERT INTO myTable (myField) VALUES ('<>');

UPDATE myTable
  SET myField = REPLACE(myField, SUBSTRING(myField, myNumber, myNumber), '<>')
  WHERE myField = '<>';

Result:

SUCCESS: 2 Rows Affected

dougwoodrow
  • 1,111
  • 12
  • 22