Search Postgresql Archives

SQL function and input variables

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I was makeing an SQL function and got an error which on a sintax that
I thouhgt would work:

CREATE OR REPLACE FUNCTION dicInsertarPalabra(p TEXT)
RETURNS INT AS $body$
	INSERT INTO public.diccionario (palabra) VALUES (quote_literal(p));
	SELECT COALESCE(codigo,0) FROM public.diccionario
	       WHERE palabra = quote_literal(p);
$body$ LANGUAGE 'SQL';

Changing p for $1 in the body of the function makes it work. But,
can't we label input arguments like how I did here?

-- 
Martín Marqués
select 'martin.marques' || '@' || 'gmail.com'
DBA, Programador, Administrador

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux