| Ребят, подскажите в чём ошибка Уже несколько дней не могу понять почему не работает
PHP код: CREATE PROCEDURE `procedure3`()
BEGIN
DECLARE nDate DATETIME;
DECLARE nTitle TEXT;
DECLARE nText LONGTEXT;
DECLARE nIcon VARCHAR(255);
DECLARE postAuthor BIGINT(20) DEFAULT 1;
DECLARE postType VARCHAR(20);
DECLARE IDPost1 BIGINT(20);
DECLARE IDPost2 BIGINT(20);
DECLARE metaKey VARCHAR(255);
set postType = 'attachment', metaKey = '_wp_attached_file';
DECLARE rCursor CURSOR FOR
SELECT n_date, n_title, n_text, n_icon FROM `news`;
DECLARE CONTINUE HANDLER FOR SQLSTATE '02000' SET done=1;
OPEN rCursor;
FETCH rCursor INTO nDate, nTitle, nText, nIcon;
WHILE done = 0 DO
INSERT INTO wp_posts (post_author, post_date, post_content, post_title)
VALUE(postAuthor, nDate, nText, nTitle)
IDPost1 = SELECT ID
FROM wp_posts
where post_title = nTitle
INSERT INTO wp_posts (post_author, post_date, post_type, guid )
VALUE(postAuthor, nDate, postType, ('/news/icon/'+ CAST(nIcon AS varchar(255)) +'.jpg'))
IDPost = SELECT ID
FROM wp_posts
where post_date = nDate and postType = 'attachment'
INSERT INTO wp_postmeta (post_id, meta_key, meta_value)
VALUE(IDPost1, metaKey, CAST(IDPost2 AS longtext))
FETCH rCursor INTO nDate, nTitle, nText, nIcon;
END WHILE;
CLOSE rCursor;
END
Вот что отвечает SQL: #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 3 Apache/2.4.17 MyAdmin 4.5.1 |