
August 7th, 2006, 12:57 AM
|
|
Contributing User
|
|
Join Date: Jun 2003
Posts: 62
  
Time spent in forums: 13 h 3 m 18 sec
Reputation Power: 7
|
|
Quote: | Originally Posted by nagysz another newbie question:
how can i debug my procedures?
i have a simle procedure like
Code:
CREATE PROCEDURE GENFACT (
DB SMALLINT)
AS
DECLARE VARIABLE I SMALLINT;
begin
i=0;
while (i<db) do
begin
insert into van_facturi (nr, client)
values(random()*1000000,1);
i=i+1;
end
end
the client field is a foreign key to the Clients table and clients table contains:
Clientid, Name
1, AAA
2, BBB
3. CCC
the procedure above gives an error that foreign key constraint violation (in spite of i specified the client code (=1) and it exists in the client table)
and when i give a backup/restore to the database it works a couple times, and then it starts giving the same message.
how can i test what values will the procedure insert into my table? |
You can use IBExpertfull, Database Workbench or EMS SQL Manager for Firebird/Interbase. All have stored procedure debugger.
Or, for a quick and dirty solution, store values in variables, define an exception and then...
Code:
...
while (i<db) do
begin
variable1 = random()*1000000 ;
exception test 'Variable1:' || :variable1 ;
insert into van_facturi (nr, client)
values(:variable1,1);
i=i+1;
end
end
On the other side, why you do this?
|