Reputation: 1
How I can write this code ( Sql Server) to work in Oracle PL/SQl ?
DECLARE @ID INTEGER
SELECT @ID = ISNULL(MAX(EmployeeID),0) + 1
FROM EmployeeTable
Upvotes: 1
Views: 58
Reputation: 2813
Below is the equivalent code for oracle
declare
id number;
begin
select nvl(max(employeeid),0)+1 into id from employeetable;
dbms_output.put_line(id);
end;
Upvotes: 2
Reputation: 666
Try this PL/SQL block:
DECLARE ID INTEGER;
BEGIN
SELECT
NVL(MAX(EmployeeID),0) + 1 INTO ID
FROM
EmployeeTable
END;
/
Upvotes: 1