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;
                update detail set detail_id=:m_dId                where 
master_id=:m_dId;            end
end#set term ;#
 

    On Saturday, January 23, 2016 1:37 AM, "[email protected] 
[firebird-support]" <[email protected]> wrote:
 

 <!--#yiv9988219056 #yiv9988219056 
.yiv9988219056ygrp-photo-title{clear:both;font-size:smaller;height:15px;overflow:hidden;text-align:center;width:75px;}#yiv9988219056
 
div.yiv9988219056ygrp-photo{background-position:center;background-repeat:no-repeat;background-color:white;border:1px
 solid black;height:62px;width:62px;}#yiv9988219056 
div.yiv9988219056photo-title a, #yiv9988219056 div.yiv9988219056photo-title 
a:active, #yiv9988219056 div.yiv9988219056photo-title a:hover, #yiv9988219056 
div.yiv9988219056photo-title a:visited {text-decoration:none;}#yiv9988219056 
div.yiv9988219056attach-table div.yiv9988219056attach-row 
{clear:both;}#yiv9988219056 div.yiv9988219056attach-table 
div.yiv9988219056attach-row div {float:left;}#yiv9988219056 p 
{clear:both;padding:15px 0 3px 0;overflow:hidden;}#yiv9988219056 
div.yiv9988219056ygrp-file {width:30px;}#yiv9988219056 
div.yiv9988219056attach-table div.yiv9988219056attach-row div div a 
{text-decoration:none;}#yiv9988219056 div.yiv9988219056attach-table 
div.yiv9988219056attach-row div div span {font-weight:normal;}#yiv9988219056 
div.yiv9988219056ygrp-file-title {font-weight:bold;}#yiv9988219056 --> 
<!--#yiv9988219056 #yiv9988219056ygrp-mkp {border:1px solid 
#d8d8d8;font-family:Arial;margin:10px 0;padding:0 10px;}#yiv9988219056 
#yiv9988219056ygrp-mkp hr {border:1px solid #d8d8d8;}#yiv9988219056 
#yiv9988219056ygrp-mkp #yiv9988219056hd 
{color:#628c2a;font-size:85%;font-weight:700;line-height:122%;margin:10px 
0;}#yiv9988219056 #yiv9988219056ygrp-mkp #yiv9988219056ads 
{margin-bottom:10px;}#yiv9988219056 #yiv9988219056ygrp-mkp .yiv9988219056ad 
{padding:0 0;}#yiv9988219056 #yiv9988219056ygrp-mkp .yiv9988219056ad p 
{margin:0;}#yiv9988219056 #yiv9988219056ygrp-mkp .yiv9988219056ad a 
{color:#0000ff;text-decoration:none;}-->

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 be appreciated.
Regards.
Hernando.



__._,_  

Reply via email to