集合与case 这代码什么原因 求救

来源:百度知道 编辑:UC知道 时间:2024/09/22 04:19:16
set serveroutput on;
declare
type card is table of varchar2(9 char) not null ;
carde card:=card();
begin
for i in 1..6 loop
carde.extend;
case when i=1 then
carde(i):='dfdf';
when i=2 then
carde(i):='terer';
when i=3 then
carde(i):='ggg';
end case;
end loop;
for i in 1..6 loop
dbms_output.put_line(i||' '||carde(i));
end loop;
end;
这段代码有什么问题啊, 运行报错啊,报错为:
declare
*

第 1 行出现错误:
ORA-06592: 执行 CASE 语句时未找到 CASE
ORA-06512: 在 line 7

请帮帮我啊,是什么原因啊

oracle中,case只能用在select中,不能单独使用,具体用法:
SELECT CASE PROD_TYPE
WHEN '原材料' THEN
'原材料'
WHEN '馏出口' THEN
'中控类'
ELSE
'成品'
END
FROM SAMPLE;

case 加一个 else ;
type card is table of varchar2(9);