我试图在我的代码中使用子选择,但它给了我一个错误。我找到了很多解决方案,但它仍然不起作用:
这是我的代码:
BEGIN;
IF (SELECT COUNT(*) FROM table1 WHERE Z = 'aaaaa') = 0
THEN
INSERT INTO table2 (X, Y) VALUES ("abc", 7)
END IF;
END;
和错误:
ERROR: syntax error at or near "IF"
LINE 2: IF (SELECT COUNT(*) FROM table1 WHERE Path = 'aaaaa') = 0
^
********** Error **********
ERROR: syntax error at or near "IF"
SQL state: 42601
Character: 8
你可以帮帮我吗?