Da ich selbst noch kein Firebird-Crack bin hab' ich's kurz getestet.
Die Domain/Variablen namen dürften selbsterklärend sein.
SQL-Code:
CREATE TABLE MASTER
(
ID PRIMKEY /* PRIMKEY = INTEGER NOT NULL */,
NAME SHORTSTRING /* SHORTSTRING = VARCHAR(255) NOT NULL */
);
SQL-Code:
CREATE TABLE DETAIL
(
ID PRIMKEY /* PRIMKEY = INTEGER NOT NULL */,
MASTER FOREIGNKEY /* FOREIGNKEY = INTEGER NOT NULL */,
SEQUENCE SEQUENCIAL /* SEQUENCIAL = INTEGER NOT NULL */,
TEXT SHORTSTRING /* SHORTSTRING = VARCHAR(255) NOT NULL */
);
SQL-Code:
create procedure ZusammenFriemelei
returns
(
ID integer
,MASTER varchar( 255)
,TEXT varchar(4000)
)
as
declare variable DetailText varchar(255);
begin
for SELECT Id
,Name
FROM Master m
ORDER BY m.Name
INTO :Id, :Master do
begin
Text = '';
for SELECT Text
FROM Detail d
where d.Master = :Id
ORDER BY d.Sequence
INTO :DetailText do
begin
if (DetailText is not null) then
Text = Text || DetailText;
end
suspend;
end
end