Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> PL/SQL with Decode problem
I am getting an error message when I try to assign the value of a
decode query into a PL/SQL variable.
The error seems to be caused by the decode's col/expression value
which is another select statement.
The error does NOT occur if I take out the select and just use a column name but I need to use the query. The code is as follows:
DECLARE v_my_var varchar2(20);
BEGIN
select new_emp_code into v_my_var
from(
select distinct new_emp_code from(
select decode((select distinct emp_code from
emp_table), 'A', 'B',
'C') new_emp_code
from emp;
END; Does anybody know how I can get around this problem?
Thanks in advance,
George
Error Message:
select decode((select distinct emp_code from emp_table), 'A', 'B',
*
ERROR at line 6:
ORA-06550: line 6, column 16:
PLS-00103: Encountered the symbol "SELECT" when
expecting one of the following:
( - + mod not null others <an identifier>
<a double-quoted delimited-identifier> <a bind
variable> avg
count current exists max min prior sql stddev sum
variance
execute forall time timestamp interval date
<a string literal with character set specification>
<a number> <a single-quoted SQL string>
ORA-06550: line 6, column 63:
PLS-00103: Encountered the symbol "," when expecting
one of the following:
Received on Mon May 05 2003 - 21:33:14 CDT