Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: PL/SQL with Decode problem

Re: PL/SQL with Decode problem

From: andrewst <member14183_at_dbforums.com>
Date: Tue, 06 May 2003 13:04:03 +0000
Message-ID: <2845118.1052226243@dbforums.com>

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.com
Received on Tue May 06 2003 - 08:04:03 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US