Search Postgresql Archives

Re: Passing a String with special character as an input

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

 



Hello

2010/11/23 akp geek <akpgeek@xxxxxxxxx>:
> Hi -
> ÂÂ Â Â Â Â This is related to my earlier post. For the function I am passing
> a string. But the string some time has a single quote inside the string like
> "IT's a String Test" , How can I handle that, can you please help?

on stored procedure level you can do nothing

in SQL level, you have to duble quotes

like INSERT INTO data VALUES('Peter''s book');

regards

Pavel Stehule


>
>
> CREATE OR REPLACE FUNCTION test_repl(x character varying)
> ÂÂRETURNS character varying AS
> $BODY$
> DECLARE
> ret_var varchar(4000);
> a record;
> begin
> ret_var := x;
> for a in select * from lookup
> loop
> ÂÂret_var := replace(ret_var,a.code,a.codeword);
> end loop;
> return ret_var;
> END;
> $BODY$
> ÂÂLANGUAGE 'plpgsql' VOLATILE
> ÂÂCOST 100;
> ALTER FUNCTION test_repl(character varying) OWNER TO postgres;

-- 
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