MySQL Forums
Forum List  »  Stored Procedures

Re: ISNULL function
Posted by: William Chiquito
Date: March 24, 2008 06:05PM

Hi Joe,

Depending on the programming language you are using you can do something like:
   if valor = 0 OR IsNULL(valor)
Also from your stored procedure can do something like:
DELIMITER $$

DROP PROCEDURE IF EXISTS `sptest`$$

CREATE PROCEDURE `sptest`()
BEGIN
	DECLARE presult DECIMAL(10, 3) DEFAULT NULL;
	SELECT densidad_r50 INTO presult FROM roos_chamber WHERE depth_cm = 2.1;
	SELECT IFNULL(presult, 0) AS valor;
END$$

DELIMITER ;



Edited 2 time(s). Last edit at 03/24/2008 06:41PM by William Chiquito.

Options: ReplyQuote


Subject
Views
Written By
Posted
319671
February 28, 2008 10:38PM
87790
February 29, 2008 10:15AM
32611
March 23, 2008 12:22PM
18022
March 23, 2008 01:02PM
12874
March 24, 2008 08:10AM
Re: ISNULL function
17547
March 24, 2008 06:05PM
13449
March 25, 2008 12:29PM
16618
March 30, 2009 06:05AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.