quote in string - Mailing list pgsql-general

From finecur
Subject quote in string
Date
Msg-id 238cea47-716d-46a6-9034-2aad1f78a78a@q24g2000prf.googlegroups.com
Whole thread Raw
Responses Re: quote in string  ("Scott Marlowe" <scott.marlowe@gmail.com>)
Re: quote in string  (Alban Hertroys <dalroi@solfertje.student.utwente.nl>)
List pgsql-general
Hi, I have a function and it's interface is :

    my_flexible_sql_function(cmd)

where cmd is another sql command.  I call this function like this:

select * from my_flexible_sql_function('select * from employee where
id < 100')

Inside this functioin, I will first retrieve all data by calling
'select * from employee where id < 100' and do some calculation about
the result and then return.

No I run into a problem, I need to call it like this:

select * from my_flexible_sql_function('select * from employee where
dep ='Eng'    ')

But looks like there is a problem to include a string inside the cmd.
The way I write 'Eng' is not right. Is there a way to include quote in
string?

Thanks,

ff

pgsql-general by date:

Previous
From: Gordon
Date:
Subject: Re: Results of stored procedures in WHERE clause
Next
From: iSteve
Date:
Subject: Re: tsearch2 on-demand dictionary loading & using functions in tsearch2