Hi, below is my function, for some reason when trying to use the function, it says there is a 'Parse error at or new "1$", does anyone know why it is saying this because it looks ok to me ? Please see below:
CREATE FUNCTION newcalls(varchar, varchar, varchar, varchar, varchar, varchar, varchar) RETURNS varchar AS 'DECLARE
locationin ALIAS FOR $1;
ctype ALIAS FOR $2;
engineer ALIAS FOR $3;
cstatus ALIAS FOR $4;
notes ALIAS FOR $5;
entby ALIAS FOR $6;
eq ALIAS FOR $7;
locid INTEGER;
calltid INTEGER;
engid INTEGER;
status INTEGER;
enttime DATETIME;
entbyid INTEGER;
eqid INTEGER;
BEGIN
locid = (select id from location where ward = locationin);
calltid = (select id from type where type = ctype);
engid = (select id from users where lastname = engineer);
status = (select id from status where status = cstatus);
enttime = (getdate());
entbyid = (select id from users where lastname = entby);
eqid = (select id from equipment where equipment = eq);
INSERT INTO CallLog.calls(location, type, eng, status, timeenter, notes, enteredby, equipment, enterbyn, timecomp) values(locid, calltid, engid, status, enttime, notes, entbyid, eqid, entbyid, enttime);
END;
' LANGUAGE 'plpgsql';
Thanks in Advance, Mark.
CREATE FUNCTION newcalls(varchar, varchar, varchar, varchar, varchar, varchar, varchar) RETURNS varchar AS 'DECLARE
locationin ALIAS FOR $1;
ctype ALIAS FOR $2;
engineer ALIAS FOR $3;
cstatus ALIAS FOR $4;
notes ALIAS FOR $5;
entby ALIAS FOR $6;
eq ALIAS FOR $7;
locid INTEGER;
calltid INTEGER;
engid INTEGER;
status INTEGER;
enttime DATETIME;
entbyid INTEGER;
eqid INTEGER;
BEGIN
locid = (select id from location where ward = locationin);
calltid = (select id from type where type = ctype);
engid = (select id from users where lastname = engineer);
status = (select id from status where status = cstatus);
enttime = (getdate());
entbyid = (select id from users where lastname = entby);
eqid = (select id from equipment where equipment = eq);
INSERT INTO CallLog.calls(location, type, eng, status, timeenter, notes, enteredby, equipment, enterbyn, timecomp) values(locid, calltid, engid, status, enttime, notes, entbyid, eqid, entbyid, enttime);
END;
' LANGUAGE 'plpgsql';
Thanks in Advance, Mark.