Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: 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;
Your select statement has 4 opening paranthesis
and only two closing ones.
Rene Nyffenegger
-- Projektleitung und Entwicklung in Oracle/C++/C# Projekten http://www.adp-gmbh.ch/cv.htmlReceived on Wed May 07 2003 - 03:55:12 CDT