HI all.
I seem to have a problem where I cant create a Stored proc in Firebird.
I have looked at examples but still I cant see the error  here it is. Can 
anyone see the error?
If I try to put :-

suspend;
end

and the end, suspend is an unknown token, and then if i take it out, END 
is an unknown token !

Thanks, Jeremy

CREATE PROCEDURE ExtensionSummary_ssp
(
 iExtensionFrom integer,
 iExtensionTo   integer,
 dDateFrom      date,
 dDateTo        date,
 tTimeFrom      time,
 tTimeTo        time
)
RETURNS
(
 total_calls integer, call_date date , call_time time,
 call_duration time, call_extension integer, call_trunk integer,
 call_type char(1), call_dialed_number Char(50), call_destination char
(50),
 total_cost decimal(12,2),  cost decimal(12,2),  Account char(50),
 CallerID char(50), extension_name char(5)
)
AS

Begin

select count(*) as total_calls,ch.call_date,ch.call_time, 
ch.call_duration,ch.call_extension,ch.call_trunk,call_type,ch.call_dialed_
number, ch.map_desc as call_destination, SUM(Cost) as total_cost, 
ch.cost , ch.acc_desc as Account,ch.CallerID, ch.call_extension as 
extension_name, 'Date From 01/01/2004 to 20/02/2004 and Time From 
00:00:00 to 23:59:59' as date_from, 'Extension From 200 to 211' as 
extn_from, 'Extension Report' as Report_title, 'Brophy Knight and 
Partners'as companyname
from callhistory ch left join extension ex on ex.number = 
ch.call_extension
WHERE ch.call_extension >= 210 and ch.call_extension <=299 AND 
ch.call_date between '01 December 2003' and '20 December 2003' AND cast
(ch.call_time as time) between cast('12:00:00' as time) and cast
('23:00:00' as time)  AND (call_type_id in (1,2,3,4,5,7,8,6,9,0))
group by 
ch.call_extension,ch.call_date,ch.call_time,ch.call_duration,ch.call_trunk
,ch.call_type,ch.call_dialed_number,Call_destination,Account,ch.CallerID,c
h.map_desc,ch.call_destination, ch.acc_desc, ch.Account, ch.cost, 
ch.call_extension,ex.owner

end

_______________________________________________
Delphi mailing list
[EMAIL PROTECTED]
http://ns3.123.co.nz/mailman/listinfo/delphi

Reply via email to