如何编写此代码(Sql Server)以在Oracle PL / SQl中工作?
DECLARE @ID INTEGER
SELECT @ID = ISNULL(MAX(EmployeeID),0) + 1
FROM EmployeeTable
答案 0 :(得分:2)
以下是oracle
的等效代码declare
id number;
begin
select nvl(max(employeeid),0)+1 into id from employeetable;
dbms_output.put_line(id);
end;
答案 1 :(得分:1)
试试这个PL / SQL块:
DECLARE ID INTEGER;
BEGIN
SELECT
NVL(MAX(EmployeeID),0) + 1 INTO ID
FROM
EmployeeTable
END;
/