L
L
Light7772014-10-02 14:05:50
Oracle
Light777, 2014-10-02 14:05:50

Why doesn't the oracle function compile?

create or replace function aaa_aaa(
cel_cred in number,
prog_cred in number)
  return varchar2 is
  res varchar2(10);
begin
  select case 

           when ABC in(206, 207, 208, 209, 210, 211, 212, 220, 221, 17) then '206'
         end as res
    from TABLE_NAME t;
  return res;
end aaa_aaa;

Error:
Compilation errors for FUNCTION UCRED.AAA_AAA
Error: PLS-00428: an INTO clause is expected in this SELECT statement
Line: 7
Text: select case

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Serg, 2014-10-02
@Light777

select case
when ABC in(206, 207, 208, 209, 210, 211, 212, 220, 221, 17) then '206'
end INTO res

D
DmitrySytkov, 2014-11-13
@DmitrySytkov

In PLSQL blocks, columns in selects must be bound to variables, unlike SQL selects. PLSQL is a language separate from SQL, SQL-like commands/queries are different there.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question