quote in string

From: finecur <finecur(at)yahoo(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: quote in string
Date: 2008-05-21 17:36:53
Message-ID: 238cea47-716d-46a6-9034-2aad1f78a78a@q24g2000prf.googlegroups.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Bill Moran 2008-05-21 18:16:09 Re: Using role priviledges for pg_dump
Previous Message Albe Laurenz 2008-05-21 15:14:48 Re: escaping and quoting