I'v trouble in TOracleDataSet!

Nizvoo

Member
I uses TOracleDataSet,but I wanna to execute multi SQL statements,but error in "Ora-009111"
, I know the TOracleScript can execute it, but I wanna uese TOracelDataSet do it.

Win2k Pro + Delphi5 + DOA 3.4.6.1

/*
TOracleDataSet.ExecSQL
Declaration
procedure ExecSQL;
Description
You can use the ExecSQL procedure to execute other statements than the select statement, for example insert, update, or delete statements, Data Definition Language statements (create table, create procedure, grant role, etc.), Session Control statements (alter session, set role), System Control statements (alter system) and PL/SQL Blocks.
For select statements you should use the Open procedure (or set the Active property to True), so that the result set will be retrieved.

*/

Thanx

[This message has been edited by Nizvoo (edited 03 June 2002).]
 
If all of these SQL statements can be used in a PL/SQL Block, you can execute that PL/SQL Block in a TOracleDataSet. For DDL statements (which cannot directly be run in PL/SQL) you can use dynamic SQL, either through the dbms_sql package or through the execute immediate PL/SQL command.

Otherwise you have to execute each separate SQL statement through the TOracleDataSet.

------------------
Marco Kalter
Allround Automations
 
uses TOracleDataSet,the sql :

for I := iMax + 1 to iMax + 10 do
SQLText := SQLText + 'insert into pactitem (no, title, id, pid) values ('
+ IntToStr(I) + ', ' + #39 + 'For a test' + #39 + ', '
+ IntToStr(I) + ', ' + '-1' + ');' + #13;
with LoginInf.MySQLPlus do
begin
Close;
SQL.Clear;
SQL.Add(SQLText);
try
ExecSQL;
LoginInf.CommitData;
except
LoginInf.CommitData;
end;
Close;
end;

but I can't success

if uses TOracleScript, can run it.
why???????

thx

------------------

Nizvoo Kensen.
Every day every thing is new.

[This message has been edited by Nizvoo (edited 04 June 2002).]
 
All you have to do is omit the trailing semi-colon. Only use semi-colons in PL/SQL or SQL*Plus scripts. In a PL/SQL Block you could do something like this:
Code:
begin
  insert into dept (deptno, dname, loc)
    values (10, 'Accounting', 'New York');
  insert into dept (deptno, dname, loc)
    values (20, 'Research', 'Dallas');
end;
This PL/SQL Block can be executed through a TOracleDataSet.

------------------
Marco Kalter
Allround Automations
 
Back
Top