|
My stored procedure was checked without any syntax errors, but when I called DELPHI, I was prompted that the optional features were not implemented! What happened?
The stored procedure code is as follows:
CREATE PROCEDURE hyz_tj
@sta_date datetime,
@end_date datetime,
@result int output
AS
select k.phid, k.sqz, k.sjdf, k.zfss, k.jlss into #lsb from ysjlrb as k where k.bb = '甲班' and k.rj between @sta_date and @end_date order by k. phid
select # lsb.phid, avg (# lsb.sqz) as lssq, avg (# lsb.df) as lsdf, sum (# lsb.zfss) as lstp, sum (# lsb.jlss) as lsce into #lsbfcb from # lsb group by phid
update bfcb set bfcb.jbsj = # lsbfcb.lssq, bfcb.jbdf = # lsbfcb.lsdf, bfcb.jbtpss = # lsbfcb.lstp, bfcb.jbcess = # lsbfcb.lsce from bfcb, where # bffbbc # .phid
select k.phid, k.sqz, k.sjdf, k.zfss, k.jlss into #lsba from ysjlrb as k where k.bb = '乙班' and k.rj between @sta_date and @end_date order by k. phid
select # lsba.phid, avg (# lsba.sqz) as lssq, avg (# lsba.df) as lsdf, sum (# lsba.zfss) as lstp, sum (# lsba.jlss) as lsce into #lsbfcba from # lsba group by phid
update bfcb set bfcb.jbsj = # lsbfcba.lssq, bfcb.jbdf = # lsbfcba.lsdf, bfcb.jbtpss = # lsbfcba.lstp, bfcb.jbcess = # lsbfcba.lsce from bfcb, # bffbbbc # .phid
select k.phid, k.sqz, k.sjdf, k.zfss, k.jlss into #lsbb from ysjlrb as k where k.bb = '丙班' and k.rj between @sta_date and @end_date order by k. phid
select # lsbb.phid, avg (# lsbb.sqz) as lssq, avg (# lsbb.df) as lsdf, sum (# lsbb.zfss) as lstp, sum (# lsbb.jlss) as lsce into #lsbfcbb from # lsbb group by phid
update bfcb set bfcb.jbsj = # lsbfcbb.lssq, bfcb.jbdf = # lsbfcbb.lsdf, bfcb.jbtpss = # lsbfcbb.lstp, bfcb.jbcess = # lsbfcbb.lsce from bfcb, where # lsffbbc .phid
select @ result = 0
return
GO
The DELPHI call is as follows:
procedure Thyz_bfc.BT_tjClick (Sender: TObject);
var
result: integer;
sta_date, end_date: Tdatetime;
begin
sta_date: = DTP_sta.DateTime;
end_date: = DTP_end.DateTime;
ADOSP_bfc.Close;
ADOSP_bfc.ProcedureName: = 'hyz_tj';
ADOSP_bfc.Parameters.Clear;
ADOSP_bfc.Parameters.Refresh;
ADOSP_bfc.Parameters.CreateParameter ('@ result', ftinteger, pdoutput, 4,0);
ADOSP_bfc.Parameters.CreateParameter ('@ sta_date', ftdatetime, pdinput, 8, sta_date);
ADOSP_bfc.Parameters.CreateParameter ('@ end_date', ftdatetime, pdinput, 8, end_date);
ADOSP_bfc.Prepared: = True;
ADOSP_bfc.ExecProc;
result: = ADOSP_bfc.Parameters.ParamByName ('@ result'). Value;
end; |
|