Subject Re: [firebird-support] Any UDF or Built in Finction to handle "escaping" single quotes in strings
Author Martijn Tonies
Hi,

> Is anyone aware of a simple way of escaping imbedded single quotes in
> strings within a PSQL procedure / trigger (short of writing a UDF)? I
> need to receive a string parameter which then will be processed via
> an "execute statement" and "execute block" combination and so any
> imbedded single quotes need to be duplicated.
>
> (version is Firebird 2.1)
>
> I haven't been able to find anything obvious though it's not the
> easiest thing to search for.

I'm not sure if you need one --

For example, in this procedure:

CREATE PROCEDURE P_EXEC_TEST (
P VarChar(200))
AS
begin
execute statement :p;
end

in a database where I have a table:
CREATE TABLE A3
(
ID INTEGER NOT NULL,
ZZ VARCHAR( 150) COLLATE ISO8859_1,
CONSTRAINT PK_A3 PRIMARY KEY (ID)
);

And I use this for parameter "p":
insert into a3 (id, zz) values (-1, 'test')

It executes just fine.


Are you trying to do something different?

Martijn Tonies
Database Workbench - tool for InterBase, Firebird, MySQL, NexusDB, Oracle &
MS SQL Server
Upscene Productions
http://www.upscene.com
My thoughts:
http://blog.upscene.com/martijn/
Database development questions? Check the forum!
http://www.databasedevelopmentforum.com