Kod: Tümünü seç
CREATE PROCEDURE SP_STOCKSTATE (
ICODE VARCHAR(20))
RETURNS (
VTAKETRANSPIECE Numeric(10, 6),
VTAKETRANSTOTAL Numeric(10, 6),
VSALETRANSTOTAL Numeric(10, 6),
VSALETRANSPIECE Numeric(10, 6),
REMAINDERPIECE Numeric(10, 6),
REMAINDERTOTAL Numeric(10, 6)
AS
begin
Select Coalesce(Sum(Piece), 0), Coalesce(Sum (Total),0)
from STOCKTRANS
where TransType = 0 and Code = :ICode
into :VTakeTransPiece, :VTakeTransTotal;
Select Coalesce(Sum(Piece), 0), Coalesce(Sum(Total), 0)
from STOCKTRANS
where TransType = 1 and Code = :ICode
into :VSaleTransPiece, :VSaleTransTotal;
RemainderPiece = VTakeTransPiece-VSaleTransPiece;
RemainderTotal = VTakeTransTotal-VSaleTransTotal;
suspend;
end

Not : FB 2 kullanmaktayız..
Teşekkürler...