Reference Guide > TDV SQL Script > SQL Script Examples > Example 2 (Fetch All Categories)
 
Example 2 (Fetch All Categories)
This example is similar to Example 1 (Fetch All Rows), but it fetches all the categories.
PROCEDURE fetchExample2 (OUT category CHAR)
BEGIN
  DECLARE temp CHAR DEFAULT '';
 
  SET category = '';
  FOR x AS SELECT Categories.CategoryName
           FROM /shared/access/Categories Categories
  DO
    SET temp = x.categoryName;
    SET category = CAST(CONCAT(CONCAT(category, ' '), temp) AS CHAR);
  END FOR;
END