Solved

adding value to IN variable

Posted on 2013-12-29
2
191 Views
Last Modified: 2013-12-29
I need to assign 21600000 to fromDate IF the value originally sent in is zero

Code that I have now is


CREATE PROCEDURE reportFreeCooling(
  IN fromDate VARCHAR (50),
  IN toDate   VARCHAR (50),
  IN timeZone VARCHAR (50)
)
BEGIN
  DECLARE startDate VARCHAR (50);
  DECLARE endDate   VARCHAR (50);
  DECLARE startDateOriginal VARCHAR (50);
  DECLARE mylogID   INT;
  DECLARE myItemId varchar (50);
  DECLARE myItemId2 varchar (50);
  DECLARE xHours varchar (50);
  DECLARE endHoursNull varchar(50);
  DECLARE endHoursNotNull varchar (50);

 

Open in new window


and of course the rest of the stored procedure. The rest is correct I just need to know how to change the fromDate if zero is what is sent in.
0
Comment
Question by:portlight
2 Comments
 

Author Comment

by:portlight
ID: 39745336
I have tried this but it is also not working
basically this is what i need to code to do.....

 IF fromDate = 0 THEN 
  SET @fromDate = '21600000';
  IF fromDate > 0 THEN SET @romDate = fromDate;
  SET startDate = FROM_UNIXTIME(@fromDate/1000); 

Open in new window

0
 
LVL 24

Accepted Solution

by:
mankowitz earned 500 total points
ID: 39745440
This works for me:

CREATE DEFINER=`root`@`localhost` PROCEDURE `reportFreeCooling`(
  IN fromDate VARCHAR (50),
  IN toDate   VARCHAR (50),
  IN timeZone VARCHAR (50)
)
BEGIN
	IF fromDate = 0 THEN SET fromDate = '23423'; END IF;
	SELECT fromDate;
END

Open in new window

0

Featured Post

Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have been using r1soft Continuous Data Protection (http://www.r1soft.com/linux-cdp/) for many years now with the mySQL Addon and wanted to share a trick I have used several times. For those of us that don't have the luxury of using all transact…
Both Easy and Powerful How easy is PHP? http://lmgtfy.com?q=how+easy+is+php (http://lmgtfy.com?q=how+easy+is+php)  Very easy.  It has been described as "a programming language even my grandmother can use." How powerful is PHP?  http://en.wikiped…
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now