Page 1 of 1

SQLUpdate with OraQuery

Posted: Fri 11 Feb 2005 18:30
by Jorge Gallas
Hola
First,please forgive me with my poor english,because english is not my native language.

MY TABLE IS THIS

Code: Select all

TABLE1
   ID number(10)
   NAME varchar2(25)
in the UpdateSQLs of the OraQuery inside the Update

Code: Select all

UPDATE adrh.TABLE1
  SET
    NAME = :NAME
  WHERE
    ID = :Old_ID;

Code: Select all

procedure TCargo.Button1Click(Sender: TObject);
begin
Oraquery.SQL.Text:='select * from ADRH.TABLE1 where ID=' + edit1.Text;
Oraquery.Open;
Oraquery.Edit;
Oraquery.FieldByName('NAME').AsString:= edit2.Text;
Oraquery.Post;
Oraquery.Session.StartTransaction;
Oraquery.Session.Commit;
Oraquery.CommitUpdates;
end;
This errors appears: ORA-00911 invalid character

can help me correcting the incorrect code?

Posted: Mon 14 Feb 2005 12:17
by Alex
Please remove ';' symbol from update query, and also if not to use cached
updates you mustn't use OraQuery.CommitUpdates.

Posted: Mon 14 Feb 2005 15:10
by jorgus
I remove ";" symbol from update query and it works perfectly..!!! :D :D
Thank

Arranged the code:

in the UpdateSQLs of the OraQuery inside the Update

Code: Select all

UPDATE adrh.TABLE1
  SET
    NAME = :NAME
  WHERE
    ID = :Old_ID

Code: Select all

procedure TCargo.Button1Click(Sender: TObject);
begin
Oraquery.CachedUpdates:= true;
Oraquery.SQL.Text:='select * from ADRH.TABLE1 where ID=' + edit1.Text;
Oraquery.Open;
Oraquery.Edit;
Oraquery.FieldByName('NAME').AsString:= edit2.Text;
Oraquery.Post;
Oraquery.Session.StartTransaction;
Oraquery.Session.Commit;
Oraquery.CommitUpdates;
end;
jorge gallas