|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Create function in firebird database
i 'm try to create function in firebird database.
but it not works. i don't understand in syntax. i use syntax about 'declare external function test' but not work. i have create function in Mssql in underline ;;;;; ALTER FUNCTION Myfunction() RETURNS TABLE AS RETURN ( SELECT cust_code,SUM(cust_buy) AS sumbuy FROM customer GROUP BY cust_code ) ;;;;;; how to create this syntax by firebird ? help me please... |
|
#2
|
||||
|
||||
|
please read about stored procedures in firebird
http://www.destructor.de/firebird/storedproc.htm also there is an answer in the forum http://forums.devshed.com/firebird-...ure-512072.html Last edited by mariuz : September 25th, 2009 at 10:15 AM. |
|
#3
|
|||
|
|||
|
Quote:
EXTERNAL FUNCTION statements are used for UDFs in Firebird. They are functions from external libraries : DLLs in Windows , SO files in Linux written on C,C++,Delphi etc. Maybe you need to create a selectable stored procedure. Little explanation In your case something like this: Code:
SET TERM ^;
CREATE OR ALTER PROCEDURE Myfunction
RETURNS(
CUST_CODE TYPE_OF_THE_FIELD,
SUMBUY DOUBLE PRECISION)
AS
BEGIN
FOR SELECT
cust_code,SUM(cust_buy)
FROM
customer
GROUP BY cust_code
INTO
:CUST_CODE,:SUMBUY
DO
SUSPEND;
END;
SET TERM ;^
Now you can use in with SELECT ... FROM MyFunction |
![]() |
| Viewing: Dev Shed Forums > Databases > Firebird SQL Development > Create function in firebird database |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|