Quantcast
Channel: SQL.ru: Firebird, InterBase
Viewing all articles
Browse latest Browse all 1677

Счетчик

$
0
0
Подскажите пожалуйста. Есть ХП:
create or alter procedure CIT_TABLE
(
  DIRID type of column TREATPLACE.DIRID,
  DCODE type of column CLREFERRALS.DCODE,
  TREATCODE type of column CLREFERRALS.TREATCODE
)
returns
(
  SCHID type of column CLREFDET.SCHID,
  SCHEMANAME blob sub_type text,
  SPOSOB type of column TOOTHNAM.TOOTHNAME,
  NOMBERSTEKLO type of column DICINFO.REKVINT3
)
as
begin
if (coalesce(DIRID,0)=0) then
begin
for
select crd.schid schid, w.kodoper||' '||w.schname schemaname, tn.toothname sposob , di.rekvint3 nombersteklo
									from clreferrals cr
									left join clrefdet crd on cr.refid=crd.refid
									join dicinfo di on crd.schid=di.rekvint1 and di.refid=-700 and di.rekvint3<=crd.scount and di.rekvint2=crd.organid
									left join toothnam tn on crd.organid=tn.toothcod
									left join wschema w on w.schid=crd.schid
									where cr.treatcode=:treatcode
						      order by schemaname, sposob, nombersteklo
                  into :SCHID, :SCHEMANAME, :SPOSOB, :NOMBERSTEKLO
do
suspend;
end
end

Возвращает: см.скрин.
Последний столбец - это порядковый номер. Сделано сейчас таблицей отдельной. Как можно реализовать в ХП, на подобии счетчика или еще как?

Viewing all articles
Browse latest Browse all 1677

Trending Articles