Mysql
 sql >> Database >  >> RDS >> Mysql

Alternativa alle viste dinamiche in MySQL

Prova a utilizzare dichiarazioni preparate -

CREATE PROCEDURE sp_getChildren(IN woeid INTEGER(15))
BEGIN
  SET @sql = CONCAT('CREATE  OR REPLACE VIEW `test`.`children` AS SELECT * FROM geoplanet_places gp WHERE gp.parent_id = ', woeid);
  PREPARE stmt FROM @sql;
  EXECUTE stmt;
  DEALLOCATE PREPARE stmt;
END