Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8394481
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T20:04:27+00:00 2026-06-09T20:04:27+00:00

I have created stored procedure in MySQL in Window-7. it run successfully on windows.

  • 0

I have created stored procedure in MySQL in Window-7. it run successfully on windows. But when I switch to Ubuntu it gives error in the stored procedure. On windows I am using SQLyog for creating stored procedure. On Ubuntu, I run the SQL script and call that stored procedure but it gives error. Below is my stored procedure.

DELIMITER $$

USE `adserver`$$

DROP PROCEDURE IF EXISTS `getDaypartTimeDetail`$$

CREATE DEFINER=`root`@`localhost` PROCEDURE `getDaypartTimeDetail`
(currentDate DATE,noOfdays INT,cityId BIGINT)
BEGIN

DECLARE i INT;
DECLARE dateCnt INT;
SET dateCnt = 0;

DROP TEMPORARY TABLE IF EXISTS OnlyDate;
DROP TEMPORARY TABLE IF EXISTS AdvScheduleData;
CREATE TEMPORARY TABLE OnlyDate(dday DATE); 
CREATE TEMPORARY TABLE AdvScheduleData(dday BIGINT,daypartId INT,totalFile BIGINT,totalDur BIGINT); 

/* Generate Dates */
WHILE(dateCnt < noOfdays) DO
    SET i = 1;
    INSERT INTO OnlyDate(dday) VALUES (DATE_ADD(currentDate, INTERVAL dateCnt DAY));
SET dateCnt = dateCnt + 1;
END WHILE;

/* Insert all dayparts for all dates */ 
INSERT INTO AdvScheduleData (dday, daypartID) SELECT (UNIX_TIMESTAMP(dday)*1000), id FROM OnlyDate, daypart;
/* Update total files and duration */       
UPDATE AdvScheduleData SET 
    TotalFile =    (SELECT COUNT(advt_id) 
            FROM adv_schedule AdvSch
            INNER JOIN advertisement Adv ON Adv.id = AdvSch.advt_id
              WHERE AdvScheduleData.dday BETWEEN AdvSch.start_date AND AdvSch.end_date
              AND AdvSch.status = 2
              AND AdvSch.active = 1
              AND AdvSch.id IN (SELECT schedule_id FROM schedule_daypart 
               WHERE daypart_id = AdvScheduleData.daypartId )
              AND AdvSch.id IN (SELECT schedule_id FROM schedule_cities WHERE city_id = cityId)
              AND Adv.is_active = 1 
              AND Adv.is_deleted = 0
              AND Adv.status = 2 
              AND Adv.expiry_date >= AdvScheduleData.dday),
    totalDur =    (SELECT SUM(Adv.duration)
            FROM adv_schedule AdvSch
            INNER JOIN advertisement Adv ON Adv.id = ADVSCH.advt_id
              WHERE AdvScheduleData.dday BETWEEN AdvSch.start_date AND AdvSch.end_date
              AND AdvSch.status = 2
              AND AdvSch.active = 1
              AND AdvSch.id IN (SELECT schedule_id FROM schedule_daypart 
               WHERE daypart_id = AdvScheduleData.daypartId )
              AND AdvSch.id IN (SELECT schedule_id FROM schedule_cities WHERE city_id = cityId)
              AND Adv.is_active = 1 
              AND Adv.is_deleted = 0
              AND Adv.status = 2 
              AND Adv.expiry_date >= AdvScheduleData.dday);
SELECT * FROM AdvScheduleData;
END$$

DELIMITER ;

The output I get in Ubuntu is

mysql> call getDaypartTimeDetail(‘2012-08-13’,5,30534); ERROR 1054
(42S22): Unknown column ‘ADVSCH.advt_id’ in ‘on clause’

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T20:04:28+00:00Added an answer on June 9, 2026 at 8:04 pm

    Table name and aliases are case sensitive in Ubuntu.

    Hence, this reference is giving an error:

    totalDur =    (SELECT SUM(Adv.duration)
            FROM adv_schedule AdvSch
            INNER JOIN advertisement Adv ON Adv.id = ADVSCH.advt_id
    

    Change it to AdvSch.advt_id

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have just created a report in Report Manager using a Stored Procedure which
I have created a stored procedure in mysql DELIMITER // CREATE PROCEDURE simpleproc ()
Well I have this MySQL stored procedure that I wrote and if I run
I have stored procedure that I created in MySQL and want PHP to call
I have a dynamic SQL statement I've created in a stored procedure. I need
I am using Oracle 10g and I have the following stored procedure: CREATE OR
(Using MVC4 VB EF4 MSSQL Razor) I created a Stored Procedure in the MS
I have created numbers of stored procedures in MySQL through remote access. And those
I have created a project that uses mysql stored procedures and views. I have
So I have this stored proc that will not get created when I run

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.