2014-01-09 82 views
-1

我在postgresql中創建插入函數時,此函數執行插入數據時發生錯誤並在屏幕上顯示消息此函數does not exit。在查詢中插入數據有什麼問題?插入函數不在postgresql中執行

我的插入函數

CREATE OR REPLACE FUNCTION insertuserlogin(userloginidp integer, usercategoryidf integer, usertypeidf integer, usertypereferenceidf integer, loginname character varying, loginpassword character varying, menutypeidf integer, username character varying, dashboardconfig text, careprovideridf integer, isactive boolean) 
    RETURNS void AS 
$BODY$BEGIN 
INSERT INTO "tbuserlogin" VALUES (userloginidp,usercategoryidf,usertypeidf,usertypereferenceidf,loginname,loginpassword,menutypeidf,username,dashboardconfig,careprovideridf,isactive); 
END$BODY$ 
    LANGUAGE plpgsql VOLATILE 
    COST 100; 
ALTER FUNCTION insertuserlogin(integer, integer, integer, integer, character varying, character varying, integer, character varying, text, integer, boolean) 
    OWNER TO postgres; 

插入查詢

SELECT insertuserlogin(1,2,4,3,'fg','sdf',6,'err','fgsd',7); 

錯誤消息

function insertuserlogin(integer, integer, integer, integer, unknown, unknown, integer, unknown, unknown, integer) does not exist 
LINE 1: SELECT insertuserlogin(1,2,4,3,'fg','sdf',6,'err','fgsd',7); 
     ^

提示:No function matches the given name and argument types. You might need to add explicit type casts.

我怎樣才能增加明確的類型轉換在postgresql中的這個函數?

回答

5

原來的功能有11個參數,而

SELECT insertuserlogin(1,2,4,3,'fg','sdf',6,'err','fgsd',7);

只有10.您似乎忘記設置isactive(是真還是假) 嘗試:

`SELECT insertuserlogin(1,2,4,3,'fg','sdf',6,'err','fgsd',7,'t'); 
+0

不喜歡工作這個相同的錯誤生成 –

+2

在你的函數定義 – cur4so

+0

中用'text'替換'字符變化',並且你不需要在那裏指出名字 – cur4so