Home > Archive > SQL Anywhere database > December 2005 > Creating functions in Sybase 7









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Creating functions in Sybase 7
Matt

2005-12-27, 7:23 am

I am trying to create functions in Sybase 7 and I am having no luck.
I have tried different versions of the code below and I get errors each
time I run the script.
The error I get for the one below occurs on line 27 column 4

ASA Error -131: Syntax error near ('end of line')

Here is the function that I am trying to create in Sybase 7.

CREATE FUNCTION fnJobCostProjection(
@Budgeted decimal(16,2),
@Expended decimal(16,2),
@Subcontracted decimal(16,2),
@ManualProjection decimal(16,2),
@ManualFlag char(1),
@SubVendor char(7),
@PctComplete decimal(7,4))
RETURNS decimal(16,2)
BEGIN
DECLARE @Amt decimal(16,2);

IF @ManualFlag = 'Y' THEN
SET @Amt = @ManualProjection
ELSE
IF @SubVendor <> '' THEN
SET @Amt = @Subcontracted
ELSE
IF @PctComplete > 0 THEN
SET @Amt =

@Expended / (@PctComplete / 100)
ELSE
IF @Budgeted > @Expended THEN
SET @Amt = @Budgeted
ELSE
SET @Amt = @Expended;

RETURN(@Amt);
GO;


Does anyone have any suggestions?

Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com