From: | "John Sidney-Woollett" <johnsw(at)wardbrook(dot)com> |
---|---|
To: | "Uros" <uros(at)sir-mag(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: parse error in function |
Date: | 2004-01-15 14:58:21 |
Message-ID: | 2372.192.168.0.64.1074178701.squirrel@mercury.wardbrook.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Apologies, I jumped the gun, amd misread your e-mail.
Isn't the syntax for "select into"...
select column1, column2 into variable1, variable2 from {yourtable} where
{some-condition};
Your statement would be:
SELECT id_user INTO tmp FROM user WHERE id_user = email;
See http://www.postgres.org/docs/current/interactive/sql-selectinto.html
Hope that helps.
John
Uros said:
> Hello John,
>
> This happen when i run my function and I check for this characters. I
have
> only spaces.
>
> Thursday, January 15, 2004, 3:29:35 PM, you wrote:
>
> JSW> Have you got any funny characters in your function definition (like
a
> TAB
> JSW> character) - I can't tell from your e-mail.
>
> JSW> I've seen problems before inserting function using psql when this
is
> the
> JSW> case.
>
> JSW> John Sidney-Woollett
>
> JSW> Uros said:
>>> Hello!
>>> I have problem with my function and I can find what's wrong.
>>> WARNING: Error occurred while executing PL/pgSQL function
>>> fn_insert_entry_pending
>>> WARNING: line 26 at SQL statement
>>> ERROR: parser: parse error at or near "$1" at character 58
>>> create or replace function
>>> "fn_insert_entry_pending"(varchar,varchar,varchar,varchar,varchar,boolean,boolean,date,int,int)
returns integer as '
>>> declare
>>> email alias for $1;
>>> caption alias for $2;
>>> description alias for $3;
>>> keywords alias for $4;
>>> url alias for $5;
>>> is_company alias for $6;
>>> is_novelty alias for $7;
>>> expire alias for $8;
>>> category1 alias for $9;
>>> category2 alias for $10;
>>> tmp record;
>>> id_entry_tmp integer;
>>> begin
>>> SELECT INTO tmp id_user FROM "user" WHERE id_user = email; if not
found then
>>> execute ''INSERT INTO "user" (id_user) VALUES ('' ||
>>> quote_literal(email) || '')'';
>>> end if;
>>> select into id_entry_tmp id_entry from "directory_entry" where
>>> url=url
>>> and is_novelty=is_novelty;
>>> DELETE FROM "directory_entry_pending" WHERE "url"=url and
>>> "id_entry"=id_entry_tmp and "is_novelty"=is_novelty;
>>> INSERT INTO "directory_entry_pending"
>>> (id_entry,id_user,caption,url,is_company,is_novelty,expire,hash)
VALUES (id_entry_tmp,$1,$2,$5,$6,$7,$8,''1'');
>>> return 1;
>>> end;
>>> ' language 'plpgsql';
>>> ---------------------------(end of
>>> broadcast)---------------------------
>>> TIP 7: don't forget to increase your free space map settings
>
>
>
>
> ---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
> (send "unregister YourEmailAddressHere" to majordomo(at)postgresql(dot)org)
>
From | Date | Subject | |
---|---|---|---|
Next Message | Bill Moran | 2004-01-15 15:02:13 | Returning large select results from stored procedures |
Previous Message | Eric Anderson Vianet SAO | 2004-01-15 14:57:14 | Re: sql to get the column names of a table |