Results 1 to 3 of 3

Thread: Functions

  1. #1
    Join Date
    Sep 2003
    Posts
    69

    Unanswered: Functions

    I have been fooling around with Functions and Stored Procedures trying to get a feel for them (PL/SQL was pretty easy, so I figured this couldn't be very hard). Any ideas on what's wrong with this (the documentation is slightly lacking):

    delimiter $
    CREATE FUCNTION isemployee(first VARCHAR(16), last VARCHAR(16)) RETURNS TINYINT
    DECLARE CT TINYINT;
    SELECT COUNT(EmployeeId)
    INTO CT
    FROM Employee WHERE
    FName = First AND LName = Last;
    RETURN CT;
    $

    ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FUCNTION isemployee(first VARCHAR(16), last VARCHAR(16)) RETURNS TINYINT
    DECLARE' at line 1

  2. #2
    Join Date
    Mar 2004
    Posts
    480
    If you've just cut and pasted to here then you have the word function typed incorrectly and that is probably messing you up. If it is something other than that sorry I can't help further.

  3. #3
    Join Date
    Sep 2003
    Posts
    69
    Hah, yes this was actually my problem. I ran into another problem, but it turns out that Functions do not support DML. Go figure. You can do it in Oracle :/

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •