Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: PL/SQL - Dynamic SQL
Try this :
sql_str = 'select col1, col2 from ' || table_name || ' where col3 = ''' || char_var || ''''
HTH Philippe
Detlev Goebel wrote in message <36B8198B.F637A4BC_at_www.gzs.de>...
>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
>--------------------------------------------
>
>
Received on Wed Feb 03 1999 - 04:54:38 CST