Recent Posts
C | 3 sec ago
C# | 35 sec ago
C# | 50 sec ago
None | 1 min ago
None | 3 min ago
C | 4 min ago
None | 4 min ago
Bash | 5 min ago
C++ | 6 min ago
Java | 6 min ago
Sitereport
Find cool info about any domain on the internet?
visit sitereport
Free Subdomains
Want a pastebin.com sub-domain for your community?
learn more...
What is pastebin?
Pastebin is a website that hosts all your text & code on dedicated servers for easy sharing.
learn more...
Learn a little bit about the new Pastebin.com on our help page. hide message
By Anonymous on the 9th of Feb 2010 11:11:21 PM Download | Raw | Embed | Report
  1. CREATE PROCEDURE pegarTudoEmUmaLinha()
  2. BEGIN
  3.   DECLARE done INT DEFAULT 0;
  4.   DECLARE linha, idCampo VARCHAR(255);
  5.   DECLARE queryDesejada CURSOR FOR SELECT id FROM tabela1;
  6.   DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1;
  7.  
  8.  OPEN queryDesejada;
  9.  
  10.  REPEAT
  11.         FETCH queryDesejada INTO idCampo;
  12.         SET linha = CONCAT(linha," ",idCampo);
  13.         UNTIL done
  14.  END REPEAT;
  15.  
  16.  SELECT linha;
  17.  
  18.  CLOSE queryDesejada;
  19. END
Submit a correction or amendment below. [ previous version ] | [ difference ] | Make A New Post
To highlight particular lines, prefix each line with @h@
Syntax highlighting:
Post expiration:
Post exposure:
Name / Title:
Email: