Вот сама процедура "
СREATE OR ALTER PROCEDURE P_PRICE (
    pcur integer,
    fprn integer)
returns (
    sec varchar(255),
    prub float,
    qinp integer,
    unt varchar(255),
    nm varchar(255))
as
begin
    if (pcur = '0' and fprn = '0') then begin
        for select gd.nm, unt.nm as unt, gd.qinp, gd.prub as prub,
sec.nm as sec from gd
    inner join unt unt on (gd.id_unt = unt.id)
    inner join sec sec on (gd.id_sec = sec.id)
    Order By id_sec, gd.nm
    INTO :nm,:unt,:qinp,:prub,:sec

  do begin
  suspend;
  end end if (pcur = '1' and fprn = '0') then begin
                  for select gd.nm, unt.nm as unt, gd.qinp, gd.pcur as
prub, sec.nm as sec from gd
    inner join unt unt on (gd.id_unt = unt.id)
    inner join sec sec on (gd.id_sec = sec.id)

    Order By id_sec, gd.nm
    INTO :nm,:unt,:qinp,:prub,:sec

  do begin
  suspend;
  end end if (pcur = '0' and fprn = '1') then begin
                  for select gd.nm, unt.nm as unt, gd.qinp, gd.prub as
prub, sec.nm as sec from gd
    inner join unt unt on (gd.id_unt = unt.id)
    inner join sec sec on (gd.id_sec = sec.id)
    where gd.fprn = 1
    Order By id_sec, gd.nm
    INTO :nm,:unt,:qinp,:prub,:sec

  do begin
  suspend;
  end end
    if (pcur = '1' and fprn = '1') then begin
                  for select gd.nm, unt.nm as unt, gd.qinp, gd.pcur as
prub, sec.nm as sec from gd
    inner join unt unt on (gd.id_unt = unt.id)
    inner join sec sec on (gd.id_sec = sec.id)
    where gd.fprn = 1
    Order By id_sec, gd.nm
    INTO :nm,:unt,:qinp,:prub,:sec

  do begin
  suspend;
  end end if (pcur = '0' and fprn = '2') then begin
                  for select gd.nm, unt.nm as unt, gd.qinp, gd.prub as
prub, sec.nm as sec from gd
    inner join unt unt on (gd.id_unt = unt.id)
    inner join sec sec on (gd.id_sec = sec.id)
    where sec.fprn = 1
    Order By id_sec, gd.nm
    INTO :nm,:unt,:qinp,:prub,:sec

  do begin
  suspend;
  end end
    if (pcur = '1' and fprn = '2') then begin
                  for select gd.nm, unt.nm as unt, gd.qinp, gd.pcur as
prub, sec.nm as sec from gd
    inner join unt unt on (gd.id_unt = unt.id)
    inner join sec sec on (gd.id_sec = sec.id)
    where sec.fprn = 1
    Order By id_sec, gd.nm
    INTO :nm,:unt,:qinp,:prub,:sec

  do begin
  suspend;
  end end
end"

не подскажите как сделать процедуру вида "СREATE OR ALTER PROCEDURE
P_PRICE (
    pcur integer,
    fprn integer)
returns (
    sec varchar(255),
    prub float,
    qinp integer,
    unt varchar(255),
    nm varchar(255))
as
begin
    if (pcur = '0') then begin
        for select gd.nm, unt.nm as unt, gd.qinp, gd.prub as prub,
sec.nm as sec from gd
    end
    if (pcur = '1') then begin
        for select gd.nm, unt.nm as unt, gd.qinp, gd.prub as pcur,
sec.nm as sec from gd
    end
    inner join unt unt on (gd.id_unt = unt.id)
    inner join sec sec on (gd.id_sec = sec.id)
    if (pcur = '1') then begin
        where gd.fprn = 1
   end;
   if (pcur = '1') then begin
        where sec.fprn = 1
    end;
Order By id_sec, gd.nm
    INTO :nm,:unt,:qinp,:prub,:sec

  do begin
  suspend;
"

Спасибо

Ответить