Professional Web Applications Themes

Error 1305 : function does not exist for starndard function. - MySQL

Hello all. I'm attempting to create a procedure that calls the function character_length(), to give me the length of a string of characters that is a variable of the function. However, while mysql allows the function to be created, when used it returns the error message 1305. I'm running SuSE Linux 10.2 with MySQL 5.0.26 Here's the code of the function : << drop function fct_CalculDureeRappel; DELIMITER $$ CREATE FUNCTION fct_CalculDureeRappel (f_time TIMESTAMP, f_room_id INT(11)) RETURNS TEXT BEGIN DECLARE my_appmod_time TIMESTAMP DEFAULT NULL; DECLARE check_roomcalled_time TIMESTAMP DEFAULT NULL; DECLARE str_rappel_time VARCHAR(20) DEFAULT '000000'; DECLARE delta_time_rappel TEXT DEFAULT NULL; DECLARE my_place_in_str ...

  1. #1

    Default Error 1305 : function does not exist for starndard function.

    Hello all.

    I'm attempting to create a procedure that calls the function
    character_length(), to give me the length of a string of characters
    that is a variable of the function.
    However, while mysql allows the function to be created, when used it
    returns the error message 1305.
    I'm running SuSE Linux 10.2 with MySQL 5.0.26

    Here's the code of the function :
    <<
    drop function fct_CalculDureeRappel;
    DELIMITER $$
    CREATE FUNCTION fct_CalculDureeRappel (f_time TIMESTAMP, f_room_id
    INT(11))
    RETURNS TEXT

    BEGIN
    DECLARE my_appmod_time TIMESTAMP DEFAULT NULL;
    DECLARE check_roomcalled_time TIMESTAMP DEFAULT NULL;
    DECLARE str_rappel_time VARCHAR(20) DEFAULT '000000';
    DECLARE delta_time_rappel TEXT DEFAULT NULL;
    DECLARE my_place_in_str INT(3) DEFAULT NULL;

    SELECT time INTO my_appmod_time FROM events_backups WHERE time <
    f_time AND room_id = f_room_id AND event LIKE 'APPEL-MODULE';
    SELECT time INTO check_roomcalled_time FROM events_backups where time 
    IF f_time = check_roomcalled_time THEN
    SET delta_time_rappel = f_time - my_appmod_time;
    SELECT char_length (delta_time_rappel) INTO my_place_in_str;
    SET my_place_in_str = 7 - my_place_in_str;
    SELECT INSERT ('000000', my_place_in_str, 6, delta_time_rappel) INTO
    str_rappel_time;
    return str_rappel_time;
    ELSE
    return NULL;
    END IF;
    END;
    $$
    DELIMITER ; [/ref]

    Here's the line used to test the function, along with the error
    message :
    <<
    mysql> select fct_CalculDureeRappel('2007-02-09 10:01:18', 314);
    ERROR 1305 (42000): FUNCTION systemplus.char_length does not exist [/ref]

    I don't understand why it gives me this error message, since using the
    function directly works fine :
    <<
    mysql> select character_length('ttt');
    +-------------------------+
    | character_length('ttt') |
    +-------------------------+
    | 3 |
    +-------------------------+
    1 row in set (0.00 sec) [/ref]

    If someone has an idea or a clue as to why it isn't working, the help
    would be much appreciated.
    If someone has a better idea for formatting a duration of time, it
    would also be welcome.

    Mad Guest

  2. #2

    Default Re: Error 1305 : function does not exist for starndard function.

    On 18 May, 11:59, Mad Ant <com> wrote: 

    One thing I notice is that you are calling char_length in one and
    character_length in another.
    However, that sholdn't make a difference. Try putting the function
    name in upper case.

    Captain Guest

  3. #3

    Default Re: Error 1305 : function does not exist for starndard function.

    I tried the following functions in upper and lower case : length,
    char_length and character_length, and each time it gives the same
    error message.
    I really don't understand why it looks in the current database, and
    not in the global functions. As far as I know, from looking at the
    MySQL doentation and examples, there doesn't seem to be a need to
    explicitly specify the global functions.

    Mad Guest

  4. #4

    Default Re: Error 1305 : function does not exist for starndard function.

    I found the problem.
    I had the line :
    SELECT char_length (delta_time_rappel) INTO my_place_in_str;
    I need to change it to :
    SELECT char_length(delta_time_rappel) INTO my_place_in_str;
    Basically, there shouldn't be a space between the name of the function
    and the opening parenthesis.

    Mad Guest

Similar Threads

  1. #39843 [NEW]: function array_fill_keys does not exist
    By fatum at list dot ru in forum PHP Bugs
    Replies: 1
    Last Post: December 15th, 04:52 PM
  2. Replies: 0
    Last Post: October 5th, 07:30 PM
  3. Replies: 5
    Last Post: June 27th, 02:12 AM
  4. ftp_connect function not exist?
    By Rob in forum PHP Development
    Replies: 2
    Last Post: March 5th, 12:05 PM
  5. Replies: 2
    Last Post: August 19th, 03:44 PM

Bookmarks

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139