Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在寻找我的 DBMS 窗口来读取平均工资:$2,843.76 我有一个简单的 SQL 语句,我想知道如何让它显示在 dbms 输出中。我在想一些事情。
dbms_output.put_line('Average Salary = ' (salary)) SELECT avg(salary) avg_salary FROM employee;
如果您从 PL/SQL 运行,您将需要一个匿名块:
DECLARE avgSalary NUMBER; BEGIN SELECT avg(salary) into avgSalary FROM employee; DBMS_Output.Put_Line('Average Salary = ' || avgSalary); END; /
并且不要忘记使用 DBMS_Output 您需要SET SERVEROUTPUT ON. 我知道我通常这样做:)
SET SERVEROUTPUT ON