SQLUpdate with OraQuery

Discussion of open issues, suggestions and bugs regarding ODAC (Oracle Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Jorge Gallas

SQLUpdate with OraQuery

Post by Jorge Gallas » Fri 11 Feb 2005 18:30

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?

Alex
Posts: 655
Joined: Mon 08 Nov 2004 08:39

Post by Alex » Mon 14 Feb 2005 12:17

Please remove ';' symbol from update query, and also if not to use cached
updates you mustn't use OraQuery.CommitUpdates.

jorgus
Posts: 3
Joined: Mon 14 Feb 2005 11:04

Post by jorgus » Mon 14 Feb 2005 15:10

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

Post Reply