SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    May 2012
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Passing Dates to my Mysql 5.0 Stored Procedure

    I'm having issues in Mysql 5.0 passing in a date parameter, I've noticed that in 5.0 that when I use IN before my parameter I get a syntax error, but here it goes:

    DROP PROCEDURE `ShowCallsForDay`//
    CREATE DEFINER=`root`@`localhost` PROCEDURE `ShowCallsForDay`(p_indate DATE)
    BEGIN
    select p_indate;
    select 'Internet Calls', count(*) from InternetCalls where date(calldate) = p_indate;
    select 'Dailys Calls', count(*) from DailysCalls where date(calldate) = p_indate;
    select 'ODEXBK Calls', count(*) from ODEXBK_Calls where date(calldate) = p_indate;
    select 'HOUSE Calls', count(*) from HOUSE_Calls where date(calldate) = p_indate;
    select 'ODEXGEN Calls', count(*) from ODEXGEN_Calls where date(calldate) = p_indate;
    select 'CBDEX Calls', count(*) from CBDEX_Calls where date(calldate) = p_indate;
    END


    Here is the output when I select p_indate inside the Stored Procedure:
    mysql> call ShowCallsForDay('05/14/2012');
    +------------+
    | p_indate |
    +------------+
    | 0000-00-00 |
    +------------+
    1 row in set (0.00 sec)

    Any help would be much appreciated. Thanks

  2. #2
    SitePoint Member
    Join Date
    May 2012
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    sorry realized my date input parameter must be in default format ie. YYYY-MM-DD my bad


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
  •