Search
 
SCRIPT & CODE EXAMPLE
 

SQL

mysql loop

mysql loop

CREATE PROCEDURE LoopDemo()
BEGIN
	DECLARE x  INT;
	DECLARE str  VARCHAR(255);
        
	SET x = 1;
	SET str =  '';
        
	loop_label:  LOOP
		IF  x > 10 THEN 
			LEAVE  loop_label;
		END  IF;
            
		SET  x = x + 1;
		IF  (x mod 2) THEN
			ITERATE  loop_label;
		ELSE
			SET  str = CONCAT(str,x,',');
		END  IF;
	END LOOP;
	SELECT str;
END$$
Comment

PREVIOUS NEXT
Code Example
Sql :: to_char sql 
Sql :: unable to convert mysql date/time value to system.datetime 
Sql :: nvl in oracle 
Sql :: sql get character at index 
Sql :: alter table query sql server change column 
Sql :: truncate oracle 
Sql :: show table mysql 
Sql :: get largest number in database sql 
Sql :: Cannot truncate a table referenced in a foreign key constraint (`video_clips`.`channel_clips`, CONSTRAINT `clips_fk` FOREIGN KEY (`clip_id`) REFERENCES `video_clips`.`clips` (`id`)) in sql] 
Sql :: sql Split string function 
Sql :: exec procedure oracle 
Sql :: sql string function update replace 
Sql :: postgres describe table 
Sql :: mongodb vs mysql 
Sql :: oracle sql generate list of days 
Sql :: table structure in sql 
Sql :: distinct in sql server 
Sql :: docker add mysql to image 
Sql :: postgres create multiple index 
Sql :: add column alter table default value 
Sql :: sqlite copy table to another table 
Sql :: mysql fetch all data 
Sql :: client does not support authentication protocol requested by server sqlyog 
Sql :: connect to mysql c# connection string C# 
Sql :: mysql into outfile with headers 
Sql :: how to get max from each department in sql 
Sql :: mariadb create view 
Sql :: to show sp in sql server 
Sql :: sql insert exemplo 
Sql :: python connect microsoft sql server 
ADD CONTENT
Topic
Content
Source link
Name
7+6 =