gpt4 book ai didi

sql - Postgresql - "ERROR: syntax error at or near "-“尝试将数字参数传递给存储过程时

转载 作者:行者123 更新时间:2023-11-29 14:16:30 30 4
gpt4 key购买 nike

我有这个问题:

CREATE TRIGGER notify_user_1
AFTER INSERT OR UPDATE OR DELETE
ON users
FOR EACH ROW
EXECUTE PROCEDURE notify_on_user_location_update(notify_user_1, 1, 43.4765965, -80.5391294, 500);

我得到这个错误:

ERROR:  syntax error at or near "-"
LINE 5: ...ser_location_update(notify_user_1, 1, 43.4765965, -80.539129...

如果我删除“-”,则查询成功。如何成功传递负数?

最佳答案

From the manual

The arguments are literal string constants. Simple names and numeric constants can be written here, too, but they will all be converted to strings

也许自动转换为字符串失败并返回负值,因此您应该使用:

... notify_on_user_location_update('notify_user_1', '1', '43.4765965', '-80.5391294', '500');

关于sql - Postgresql - "ERROR: syntax error at or near "-“尝试将数字参数传递给存储过程时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46986599/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com