Re: Dynamic SQL

From: hackman <m_at_m.com>
Date: Thu, 10 Feb 2000 02:57:13 GMT
Message-ID: <dOpo4.12414$Mk2.498347_at_newsread2.prod.itd.earthlink.net>


whenever you have a single quote within your sql command you have to escape it with another ' for instance -
select 'select * from '||table_name|| ' where sample_column = ''foo'' (<= those are two single quotes not double qoutes) from user_tables where table_name like '%BLAH';

My Name <gxck_at_mindspring.com> wrote in message news:38A21B7D.C4C673E6_at_mindspring.com...
> Hello all:
> I am having problem with this dynamic sql because of the single quote
> around foo. Is there a way around it?
>
> select 'select * from '||table_name|| ' where sample_column = 'foo''
> from user_tables where table_name like '%BLAH';
>
>
Received on Thu Feb 10 2000 - 03:57:13 CET

Original text of this message