error plsql

Discussion of open issues, suggestions and bugs regarding ODAC (Oracle Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
ameur78
Posts: 2
Joined: Mon 03 Dec 2007 21:36

error plsql

Post by ameur78 » Mon 03 Dec 2007 22:00

Hello everyone, my congratulations to this forum, my problem is that the request insert into doesn in pl sql dynamic and here's the code:

----------------------------------------------------------
OraSQL.SQL.Add('DECLARE');
OraSQL.SQL.Add(' i INTEGER;');
OraSQL.SQL.Add('BEGIN');
OraSQL.SQL.Add(' FOR i IN 0..10');
OraSQL.SQL.Add(' LOOP');
OraSQL.SQL.Add(' insert into dept(deptno,dname,loc)');
OraSQL.SQL.Add(' values(:p1,:p2,:p3)');
OraSQL.SQL.Add(' END LOOP;');
OraSQL.SQL.Add('END;');


OraSQL.ParamByName('p1').DataType := ftinteger;
OraSQL.ParamByName('p2').DataType := ftString;
OraSQL.ParamByName('p3').DataType := ftString;

OraSQL.ParamByName('p1').AsInteger := 19;
OraSQL.ParamByName('p2').AsString := 'nana';
OraSQL.ParamByName('p3').AsString := 'caca';

OraSQL.Execute;
---------------------------------------------------------------------


And the error is displayed

If you are happy help me.
Greetings.

Plash
Devart Team
Posts: 2844
Joined: Wed 10 May 2006 07:09

Post by Plash » Tue 04 Dec 2007 08:59

Deptno is primary key in Dept table. So that you cannot insert 10 records with the same primary key value.

ameur78
Posts: 2
Joined: Mon 03 Dec 2007 21:36

Post by ameur78 » Tue 04 Dec 2007 22:34

Hello thank you for your participation
But I changed the structure of the table dept to be without key primary, the error can be in the code structure or parameters you can test the script, please

jfudickar
Posts: 202
Joined: Fri 10 Mar 2006 13:03
Location: Oberursel / Germany

Post by jfudickar » Tue 04 Dec 2007 23:01

I think it would be realy helpfull, if you would name the error :)

Plash
Devart Team
Posts: 2844
Joined: Wed 10 May 2006 07:09

Post by Plash » Wed 05 Dec 2007 08:48

Please specify the error message that you have received.

Post Reply