In this FREE six-day email course, you'll learn from Janis Griffin, Database Performance Evangelist. She'll teach 12 steps that you can use to optimize your queries as much as possible and see measurable results in your work. Get started today!
CREATE PROCEDURE informix.sales_distribution(iYear int, iMonth int, iWeekNumber int)
define dtStart DATETIME YEAR TO DAY;
define dtEnd DATETIME YEAR TO DAY;
if iWeekNumber = 1 then
let dtStart = to_date(to_char(iYear) || "-" || to_char(iMonth) + || "-01")
let dtEnd = to_date(to_char(iYear) || "-" || to_char(iMonth) + || "-07")
elseif iWeekNumber = 2 then
let dtStart = to_date(to_char(iYear) || "-" || to_char(iMonth) + || "-08")
let dtEnd = to_date(to_char(iYear) || "-" || to_char(iMonth) + || "-14")
elseif iWeekNumber = 3 then
let dtStart = to_date(to_char(iYear) || "-" || to_char(iMonth) + || "-15")
let dtEnd = to_date(to_char(iYear) || "-" || to_char(iMonth) + || "-21")
elseif iWeekNumber = 4 then
let dtStart = to_date(to_char(iYear) || "-" || to_char(iMonth) + || "-22")
let dtEnd = to_date(to_char(iYear) || "-" || to_char(iMonth) + || "-07") -- ????
end if;
Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.
Have a better answer? Share it in a comment.
Open in new window
http://pic.dhe.ibm.com/inf