Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> Re: PL/SQL - Use bind variable in "from <table>" query
On 02/01/2005 12:05:06 AM, Lyndon Tiu wrote:
> Hello,
>=20
> I have a lookup table with a column.
That's interesting. Are you sure you have a column in the lookup table?
>=20
>=20
Lyndon, you misunderstood the concept of binding. Bind variables are parkin=
g lots. You draw a=20
little square on the concrete and imagine that there is a car in that squar=
e. When the parking=20
garage is used, a car does get in there. In other words, you "bind" your ca=
r to the "variable"=20
(parking lot) in the "SQL" (garage).
What you are trying to do is equivalent to building a garage on the fly, wh=
enever you want=20
to park the car. What you are talking about is constructing SQL dynamically=
, not binding.=20
You should be binding variables to an already parsed SQL statement ("parkin=
g garage") which=20
has placeholders to which variables should be bound ("parking lot"). Oracle=
cannot parse SQL=20
if it doesn't know about all the referenced objects. Oracle must check the =
accessibility of=20
the objects before the statement can be parsed. Dynamic SQL is another, ent=
irely different=20
story. Binding is not magic, it is parallel parking. You should practice i=
t in Manhattan,=20
around Broadway, at 08:30 AM, Mon-Fri. You'll love it.
--=20
Mladen Gogala
Oracle DBA
-- http://www.freelists.org/webpage/oracle-lReceived on Tue Feb 01 2005 - 00:32:26 CST
![]() |
![]() |