好吧,對於大學我正在處理一些SQL任務,但我無法弄清楚這裏或其他什麼地方出了什麼問題..現在停留了幾個小時。PostgreSQL函數錯誤
所以我在這裏創建一個函數:
CREATE OR REPLACE FUNCTION ins_notitie(pn_patient_nr VARCHAR, pn_notitie_datum DATE, pn_notitie_commentaar VARCHAR, lst_bijwerkdat DATE)
RETURNS void AS
$$
INSERT INTO patient_notitie(pn_patient_nr, pn_notitie_datum, pn_notitie_commentaar, lst_bijwerkdat)
VALUES ($1, $2, $3, $4)
$$
LANGUAGE sql;
然後我嘗試插入新行:
SELECT ins_notitie('100001', now(), 'Test note', now());
不斷收到此錯誤:
ERROR: function ins_notitie(unknown, timestamp with time zone, unknown, timestamp with time zone) does not exist
LINE 1: SELECT ins_notitie('100001', now(), 'Test note', now());
^
HINT: No function matches the given name and argument types. You might need to add explicit type casts.
********** Error **********ERROR: function ins_notitie(unknown, timestamp with time zone, unknown, timestamp with time zone) does not exist
SQL state: 42883
Hint: No function matches the given name and argument types. You might need to add explicit type casts.
Character: 8
功能也得到正如我在postgresql的GUI中看到的那樣創建的。
我的上帝....不敢相信我沒有弄明白。哇,夥計,你讓我成爲一個快樂的人! – Nerotix
@Nerotix:或者使用'current_date'代替 - 返回一個'date' –