Bug #14660 CREATE FUNCTION seems not allow VARCHAR parameters
Submitted: 4 Nov 2005 21:29 Modified: 11 Nov 2005 12:47
Reporter: Paulino Martinez Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MaxDB Severity:S3 (Non-critical)
Version:7.6.00.12 OS:Windows (Windows XP)
Assigned to: Ulf Wendel CPU Architecture:Any

[4 Nov 2005 21:29] Paulino Martinez
Description:
When you try to process this in SQL Studio:

create function Balance(cAccnt varchar(6), dDate date) returns fixed(10, 2) as
    var nBalance fixed(10, 2);
    select sum(amount)
    from dba.journal
    where account = :cAccnt and date <= :dDate;
    fetch into :nBalance;
    return nBalance;

you get this error:

---- Error -------------------------------
Auto Commit: On, SQL Mode: Internal, Isolation Level: Committed
 General error;-5016 POS(39) Missing delimiter: )

TIP: Of course, you can use type CHAR instead and the function will be created without any further problem (except you are dealing with a CHAR instead a VARCHAR).

How to repeat:
Follow the instructions above in the Description Section.  Copy the statement and execute it in SQL Studio 7.6.00.12.

Suggested fix:
I don't know...  I suposse the problem can be fixed in the parser/compiler but I'm not a developer (I'm only an advanced user) and don't know how to access those modules.
[11 Nov 2005 12:47] Ulf Wendel
Hi,

this is a problem with the documentation. You must not specify datatype details for VARCHAR and NUMBER paramters. We won't change this in the near future.

Use CHAR if you want to specify a length.

However, we'll update the documentation. Thanks for pointing out.

Ulf