Here is my code. I am getting a syntax error for "IF NOT EXISTS..." statement. It is pretty self-explanatory on what I want to do here. If the record exists in the terms table, I want to know the unique term_id. If the record does not exist, I want to insert a new record and get the unique term_id which will be needed in the subsequent statement.
How to write this statement syntactically correct while preserving the logic. Thanks.
 INSERT INTO `koolkat_temp`.`creatives` (`creative_id`, `creative_title`, `creative_image_name`) VALUES (NULL, 'xyz', 'xyz');
 SET @record_pointer = LAST_INSERT_ID();
 IF NOT EXISTS (SELECT `term_id` INTO @term_id_placement FROM `terms` WHERE `name` LIKE 'xyz.com' and `taxonomy` LIKE 'placement') THEN
     INSERT INTO `terms` (`term_id` ,`name` ,`slug`, `taxonomy`, `description` ,`parent`, `count`) VALUES (NULL, 'xyz.com', 'xyz.com',  'placement', '', 0, 0);
     SET @term_id_placement = LAST_INSERT_ID();
 ENDIF; 
 INSERT IGNORE INTO `term_relationships` (`creative_id` ,`term_id` ,`term_order`) VALUES (@record_pointer, @term_id_placement, 0);
 
    