Re: Dynamic SQL Question - Bind Variables

From: Vladimir M. Zakharychev <bob_at_dpsp-yes.com>
Date: Fri, 21 Feb 2003 10:27:31 +0300
Message-ID: <b34kd5$1sg$1_at_babylon.agtel.net>


>
> The basic questions I'm asking are:
>
> 1) Can you dynamically construct a column name in a dynamic SQL statement
> using bind variables?
> 2) Can you pass the table name into a dynamic SQL statement via bind
> variables?
>

No and no. You should use string concatenation to build SQL statements with proper table and column names. I doubt any other RDBMS out there supports binding of table or column names - how such statements are supposed to be parsed, optimized and shared when the optimizer has absolutely no idea which object is accessed at parse time (it has to peek at the bind variables values at runtime to figure it out) and can't be sure that the same object will be accessed the next time you run the same statement (thus the statement is actually not shareable, which is the main purpose of bind variables)?

-- 
Vladimir Zakharychev (bob_at_dpsp-yes.com)                http://www.dpsp-yes.com
Dynamic PSP(tm) - the first true RAD toolkit for Oracle-based internet applications.
All opinions are mine and do not necessarily go in line with those of my employer.
Received on Fri Feb 21 2003 - 08:27:31 CET

Original text of this message