Page 1 of 1

error plsql

Posted: Mon 03 Dec 2007 22:00
by ameur78
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.

Posted: Tue 04 Dec 2007 08:59
by Plash
Deptno is primary key in Dept table. So that you cannot insert 10 records with the same primary key value.

Posted: Tue 04 Dec 2007 22:34
by ameur78
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

Posted: Tue 04 Dec 2007 23:01
by jfudickar
I think it would be realy helpfull, if you would name the error :)

Posted: Wed 05 Dec 2007 08:48
by Plash
Please specify the error message that you have received.