出于某种原因,这不会起作用。我已经把它归结为最基本的操作来尝试和排除故障。
BEGIN
FOR rec IN (
select REGISTRATION_UID from DIM_REGISTRATION_SET
)
LOOP
dbms_output.put_line('Testing 123');
END LOOP;
end;
/
我的错误如下:
Error starting at line 1 in command:
BEGIN
FOR rec IN (
select REGISTRATION_UID from DIM_REGISTRATION_SET
)
LOOP
dbms_output.put_line('Testing 123');
END LOOP;
end;
Error report:
ORA-06550: line 4, column 6:
PLS-00103: Encountered the symbol " " when expecting one of the following:
loop
06550. 00000 - "line %s, column %s:\n%s"
*Cause: Usually a PL/SQL compilation error.
*Action:
答案 0 :(得分:1)
您的代码中似乎有一个意外的字符。如果您复制并粘贴此问题的渲染输出,那么它运行正常。如果您复制问题源代码(来自编辑对话框),则会收到该错误。
转储代码(再次从源代码复制,而不是渲染)显示:
select dump('(
select REGISTRATION_UID from DIM_REGISTRATION_SET
) ', 16)
from dual;
DUMP('(SELECTREGISTRATION_UIDFROMDIM_REGISTRATION_SET) ',16)
--------------------------------------------------------------------------------
Typ=96 Len=73: 28,a,20,20,20,20,20,20,20,20,20,20,73,65,6c,65,63,74,20,52,45,47,
49,53,54,52,41,54,49,4f,4e,5f,55,49,44,20,66,72,6f,6d,20,44,49,4d,5f,52,45,47,49
,53,54,52,41,54,49,4f,4e,5f,53,45,54,a,20,20,20,20,20,20,20,20,29,c2,a0
因此,右括号后的空格实际上不是空格,它是Unicode字符c2a0,which is a non-breaking space。
错误消息也显示,如果您转储:
select dump ('Encountered the symbol " "', 16) from dual;
DUMP('ENCOUNTEREDTHESYMBOL" "',16)
--------------------------------------------------------------------------------
Typ=96 Len=27: 45,6e,63,6f,75,6e,74,65,72,65,64,20,74,68,65,20,73,79,6d,62,6f,6c
,20,22,c2,a0,22
我猜你从某个地方复制了那个代码(Word?)并且它拾取了那个角色,并且它还没有被翻译成普通空间。只需用空格替换它,或者将其删除,因为它仍然是冗余的空格。
实际上还有其他几个;两个在LOOP
行的开头(后跟两个普通空格),两个紧接在END LOOP;
之前(前面有两个普通空格),一个在该语句之后;所以这些都需要更换。 (我很想重新输入整个内容,但这可能对您的完整代码不切实际。)