Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: PL/SQL with Decode problem
Originally posted by Gm
>
>
> ok I can get rid of the distincts...here is the simplified
> code...Would there be a solution with this version of the code?
>
> Thanks,
> GM
>
> DECLARE
>
> v_my_var varchar2(20);
>
> BEGIN
>
> select new_emp_code into v_my_var
> from( select decode((select emp_code from
> emp_table), 'A', 'B',
> 'C') new_emp_code
> from emp;
>
> END;
The code as given makes no sense. For example:
decode((select emp_code from emp_table), 'A', 'B', 'C') new_emp_code
The first parameter to DECODE expects a VALUE, whereas you are giving it (select emp_code from emp_table) which returns a multi-row result!
It would probably be better for you to state your requirements, and ask how to accomplish them. It is impossible to infer the requirements from the invalid code above.
-- Posted via http://dbforums.comReceived on Tue May 06 2003 - 08:04:03 CDT
![]() |
![]() |