Or (if he wants a number starting from 1 for each master, as opposed to
a unique number for each master):
execute block
as
declare mId integer;
declare mOld integer;
declare dId integer;
declare dmId integer;
begin
m_Old = -1;
dmId = 1;
for select id, master_id
from
Hi to all,
I have two tables with a master detail relation.
The detail table has the fields "id", "master_id" and "detail_id".
I need to fill the "detail_id" field with a sequence from 1 to n for each
record in the master table.
I can't figure out how to do this.
Any help will
set term #;execute block as declare m_mId char(10); -- type of master_id
declare m_dId integer; -- type of detail_idbegin m_dId=0; for
select distinct master_id from detail into :m_mId
do begin m_dId=m_dId+1;