Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PL/SQL error parsing FOR x IN a..b LOOP #722

Open
DuShuYuan opened this issue Mar 7, 2024 · 1 comment
Open

PL/SQL error parsing FOR x IN a..b LOOP #722

DuShuYuan opened this issue Mar 7, 2024 · 1 comment
Labels

Comments

@DuShuYuan
Copy link

DuShuYuan commented Mar 7, 2024

Input data

PLSQL
v15.2.0

declare
  -- record 自定义所需的字段
  TYPE record_emp IS RECORD(
       v_empno STUDENT_INFO.sno%TYPE,   --引用emp中empno的类型
       v_ename STUDENT_INFO.sname%TYPE,
       v_sal STUDENT_INFO.bank%TYPE    
  );
BEGIN
  --构造方法,进行初始化一个空数组
  v_emp_array := emp_array();
 
 
  -- 遍历数组
  --first() 返回第一个元素下标,始终返回1
  --last() 返回最后一个元素下标,始终返回count()结果
  dbms_output.put_line('first()和last()遍历数组');
  FOR i IN v_emp_array.first() ..v_emp_array.last() LOOP
    dbms_output.put_line('员工号:'||v_emp_array(i).v_empno||' 员工名:'||v_emp_array(i).v_ename);
    END LOOP;
   
END;

error position

FOR i IN v_emp_array.first() ..v_emp_array.last() LOOP -- error token: ..
@DuShuYuan DuShuYuan added the bug label Mar 7, 2024
@DuShuYuan DuShuYuan changed the title [FORMATTING] Issue Title Here [FORMATTING] plsql error Mar 7, 2024
@nene nene changed the title [FORMATTING] plsql error PL/SQL error parsing FOR x IN a..b LOOP Mar 7, 2024
@nene
Copy link
Collaborator

nene commented Mar 7, 2024

Thanks for reporting, should be a simple thing to fix as similar syntax is supported for Transact-SQL.

Though the formatting of this kind of procedural SQL code is really very poorly supported by SQL Formatter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants