hier ein beispiel auf Basis der IBExpert Demodb db1.fdb
Code:
execute block
returns
(customer varchar(80),
total numeric(18,2))
as
declare variable customer_id bigint;
begin
for
select customer.id, customer.firstname||' '||customer.lastname
from customer
into :customer_id,:customer
do
begin
execute statement ('select coalesce(sum(orders.netamount),0) from orders where orders.customer_id=:customer_id') (customer_id:=customer_id)
on external '
LOCALHOST/3050:C:\
db\DB1.FDB'
as user 'SYSDBA' password 'masterkey'
into :total;
suspend;
end
end