Question:
I am trying to run this
pl/sql code but getting the error ORA-01008 : Not
all variables bound below. Any idea what's wrong?
ORA-01008 : Not all variables bound
DECLARE
myoper varchar(12);
oper varchar(12);
loti varchar(12);
prod varchar(25);
quant varchar(12);
CURSOR C1 IS
SELECT nOperno FROM d2f_prod_0_report.factoryloops
WHERE wtflag = 'Y' ORDER BY ecdorder;
BEGIN
OPEN C1;
LOOP
FETCH C1 INTO myoper;
SELECT operation , Lot , Product , Qty1
FROM d2f_prod_0_report.f_lot
WHERE operation = :myoper
AND Route = 'SL00.2RZS'
AND Product LIKE '%IX190%';
END LOOP;
CLOSE C1;
END;
ORA-01008 : Not all variables bound
Answer by Edward Stoever:
The err utility shows this for the
ORA-01008 error:
ORA-01008 not
all variables bound
Cause: A SQL statement
containing substitution variables was executed
without all variables bound. All substitution
variables must have a substituted value before the
SQL statement is executed.
Action: In OCI,
use an OBIND or OBINDN call to substitute the
required values
Lots wrong here... you are
attempting to use a bind variable (:myoper) that is
not bound to a value.
Also, your select
statement
SELECT operation ,
Lot , Product ,
Qty1 FROM
d2f_prod_0_report.f_lot WHERE
operation = :myoper AND Route =
'SL00.2RZS' AND Product LIKE '%IX190%';
needs to "select
into", because you cannot simply select like that in
PL/SQL. If you think about it, it makes sense; if
you don't select into, or open a cursor so that the
values can be of use, then you are just selecting to
waste time, and that will not compile.
|
|
|
Oracle Training from Don Burleson
The best on site
"Oracle
training classes" are just a phone call away! You can get personalized Oracle training by Donald Burleson, right at your shop!

|
|
|
|
|