oracle - DBMS_OUTPUT.PUT_LINE 返回错误

标签 oracle plsql

我正在尝试编写一个基本的 PL/SQL For 循环,但一直出现错误。我的声明是:

begin

  for tab_x in
    (select unique table_name from all_tables
     where owner like 'MSGCENTER_DBO%'
       and table_name like 'MSG_DETAIL%')
  loop
    DBMS_OUTPUT.PUT_LINE(tab_x);
  end loop;

end;
/

错误信息是

PLS-00306: wrong number or types of arguments in call to 'PUT_LINE'
ORA-06550: line 6, column 7:
PL/SQL: Statement ignored

我可能遗漏了一些非常明显的东西,但无法让它发挥作用。感谢您的帮助!

最佳答案

您想改为访问 tab_x.table_name

begin

   for tab_x in
    (select unique table_name from all_tables
     where owner like 'MSGCENTER_DBO%'
       and table_name like 'MSG_DETAIL%')
   loop
      DBMS_OUTPUT.PUT_LINE(tab_x.table_name );
  end loop;

end;
/

关于oracle - DBMS_OUTPUT.PUT_LINE 返回错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43876033/

相关文章:

java - 我如何告诉 querydsl-maven-plugin 使用 Long 而不是 BigDecimal 生成 NumberPath?

Oracle 连接和 VS2012

sql - 在 oracle 中使用正则表达式验证英国邮政编码

.net - LINQ to SQL/LINQ to Collections 性能

java - 将多个 ref 游标从 Oracle 过程返回到 Java

oracle - 存储过程中未实现的功能错误

oracle - 错误 : PLS-00428: an into clause is expected in this select statement

oracle - 无法在 PL/SQL 过程中禁用索引

oracle - 如何在 Oracle SQL Developer 中查看 refcursor 结果/输出?

Java到Excel不写入多个工作表