From: | LENGYEL Zoltan <warnew(at)warnew(dot)nomaam(dot)hu> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | pgpsql help |
Date: | 2005-01-17 04:46:20 |
Message-ID: | 41EB431C.3070109@warnew.nomaam.hu |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hi,
I have a pgpsql function:
create or replace function new_uri(varchar,varchar,varchar) returns
integer as '
declare
src alias for $1;
tit alias for $2;
uri alias for $3;
article_id integer := nextval(''articleid'');
src_id integer;
state_id integer;
urit_id integer;
begin
select into src_id id from sources where name = src;
select into state_id id from state where name = ''collected'';
select into urit_id id from uritype where name = ''original html'';
raise notice ''insert into article (id,source,title,state) values
(%,%,%,%)'',article_id,src_id,tit,state_id;
insert into article (id,source,title,state) values
(article_id,src_id,tit,state_id);
raise notice ''insert into uri (articleid,uri,uritype) values
(%,%,%)'',article_id,uri,urit_id;
insert into uri (articleid,uri,uritype) values (article_id,uri,urit_id);
return 1;
end;
' language 'plpgsql';
An i also have some output:
ifa=> \i new_uri.sql
CREATE FUNCTION
ifa=> select new_uri('index.hu','juscsenko','index.hu/foobar');
NOTICE: insert into article (id,source,title,state) values
(56,3,juscsenko,1)
NOTICE: insert into uri (articleid,uri,uritype) values
(56,index.hu/foobar,3)
ERROR: syntax error at or near "$1" at character 14
CONTEXT: PL/pgSQL function "new_uri" line 17 at SQL statement
ifa=>
What should i do?
thx,
War_New
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Fuhr | 2005-01-17 05:02:16 | Re: pgpsql help |
Previous Message | Stuart Bishop | 2005-01-17 02:47:13 | Re: Postgresql 8.0 and Cancel/Kill backend functions |