FROM keyword not found where expected ,单独运行又是正确的解决思路
FROM keyword not found where expected ,单独运行又是正确的DECLARE A1 CHAR(12) A2 CHAR(2) A3 VARCHA
FROM keyword not found where expected ,单独运行又是正确的
DECLARE A1 CHAR(12);
A2 CHAR(2);
A3 VARCHAR(20);
A4 VARCHAR(20);
BEGIN
select AA1 INTO A1, AA2 into A2, AA3 into A3, AA4 into A4 FROM TABLENAME where "ID" = 2;
--UPDATE TABLENAME2 set AA1=A1, AA2=A2, AA3=A3 where ID=A4;
END;
直接报错
[Err] ORA-06550: line 6, column 38:
PL/SQL: ORA-00923: FROM keyword not found where expected
ORA-06550: line 6, column 1:
PL/SQL: SQL Statement ignored
但是单独写
select AA1 , AA2 , AA3 , AA4 FROM TABLENAME where "ID" = 2;
又是正确的。。。网上查了一堆都跟这个情况不一样
[解决办法]SELECT a1, a2, ..., an
INTO v_a1, v_a2, ..., v_an
FROM tb_name
WHERE id='xxx';
-- 是一次性INTO,而不应该分别去INTO。语法错误。而且INTO到变量的时候,查询语句应该只返回一行数据(这个容易理解:一个非数组变量不可能存储多个值)。