Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: PL/SQL - Dynamic SQL

Re: PL/SQL - Dynamic SQL

From: <chandrasekar_at_my-dejanews.com>
Date: Fri, 05 Feb 1999 14:43:07 GMT
Message-ID: <79f01o$qvu$1@nnrp1.dejanews.com>


HI Goebel,

   The solution for your problem is define a variable and assign 4 single quotes to it. Then use this variable as one single quote . For eg
declare
a varchar2(5);
begin
a := '''' ;
> sql_str = 'select col1, col2 from ' || table_name || ' where col3 = ' ||a||
> char_var||a ;

I 'ope this helps u .

cheers
chandrasekar

In article <36B8198B.F637A4BC_at_www.gzs.de>,   Detlev Goebel <goebel_at_www.gzs.de> wrote:
> Hello all
>
> I'm in need to create a stored procedure with dynamic sql.
>
> The query looks like that :
>
> sql_str = 'select col1, col2 from ' || table_name || ' where col3 = ' ||
> char_var
>
> The Problem: There are no single quotes at var_char and dbms_sql.parse
> pops up an error message
> saying invalid column name. Now I'm trying to get the single quotes in
> that string but that doesn't work so far.
>
> Is there somone on the list who could help me ???
>
> Detlev Goebel
>
> GZS Gesellschaft für Zahlungssysteme m.b.H.
>
> Theodor Heuss Allee 80
>
> 60486 Frankfurt
>
> Tel.: +49 (0) 69 7933 1097
> Fax : +49 (0) 69 7933 1940
>
> mailto:goebel_at_www.gzs.de
> mailto:detlev.goebel_at_gzs.de
>
> http://www.gzs.de
> --------------------------------------------
>
>

-----------== Posted via Deja News, The Discussion Network ==---------- http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own Received on Fri Feb 05 1999 - 08:43:07 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US