在Oracle查询中,您可以使用CEIL函数对数值进行向上取整
CREATE TABLE employees (
id NUMBER PRIMARY KEY,
name VARCHAR2(50),
salary NUMBER
);
INSERT INTO employees (id, name, salary) VALUES (1, 'Alice', 5000.50);
INSERT INTO employees (id, name, salary) VALUES (2, 'Bob', 6000.25);
INSERT INTO employees (id, name, salary) VALUES (3, 'Charlie', 7000.75);
COMMIT;
SELECT id, name, CEIL(salary) AS rounded_salary
FROM employees;
这将返回以下结果:
ID | NAME | ROUNDED_SALARY
---------------------------
1 | Alice | 5001
2 | Bob | 6001
3 | Charlie | 7001
在此示例中,我们使用CEIL函数将员工薪水向上取整,并将结果作为新列"rounded_salary"返回。