我有一個SQL函數:如何用參數創建SQL函數?
-- Function: insert_into_wgs()
-- DROP FUNCTION insert_into_wgs();
CREATE OR REPLACE FUNCTION insert_into_wgs()
RETURNS void AS
$BODY$
BEGIN
INSERT INTO parcels (num,vid,support_num,name_dispatcher,cadastr,the_geom,status_id)
SELECT num,vid,support_num,name_dispatcher,cadastr,ST_TRANSFORM(the_geom,4326),status_id
FROM parcels_temp
WHERE num NOT IN (SELECT num FROM parcels)AND deleted='no';
end;
$BODY$
LANGUAGE plpgsql VOLATILE
COST 100;
ALTER FUNCTION insert_into_wgs() OWNER TO postgres;
你看,它僅適用於parcels
,parcels_temp
表。我如何用參數insert_into_wgs(table, table_temp);
創建函數?
你是否已經嘗試過'CREATE OR REPLACE FUNCTION insert_into_wgs(表,table_temp)'? –
是的,它說表是筆記型。 –
我不知道這個功能是如何調用所以着問我的問題,谷歌( –