Hi I am creating database and I am trying to create function which returns total number of people from 2 tablets.
Table 1
*
CREATE TABLE Zamestnanci
(
id_Zamestnanca int not null,
Meno varchar(50) null,
Priezvisko varchar(50)null,
Adresa varchar(50) null,
Datum_narodenia date null,
PRIMARY KEY (id_Zamestnanca)
);*
Table 2 :
*
CREATE TABLE ObčaniaSR
(
id_Občana int not null,
Meno varchar(50) null,
Priezvisko varchar(50) null,
Adresa varchar(50) null,
Datum_narodenia date null,
Zápis_v_trestnom_registry varchar(50) null,
PRIMARY KEY (id_Občana)
);*
Function I am trying to declare :
*use A20762_AK1DS_Projekt
CREATE OR REPLACE FUNCTION VseciZamestnanci
RETURN id_Zamestnanca IS
total number(2) := 0;
BEGIN
SELECT count(*) into id_Zamestnanca
FROM Zamestnanci;
RETURN id_Zamestnanca;
END;
/ *
I got this Error : *Msg 102, Level 15, State 1, Line 3
Incorrect syntax near 'REPLACE'.
Msg 178, Level 15, State 1, Line 10
A RETURN statement with a return value cannot be used in this context.
*
Thank you for your answers and advices.