friends at present i am doing data migration from my old database to new DB.in my new Db I wrote User defined function for a table column.So the problem occur here
thank you....
CREATE OR REPLACE FUNCTION empdatamigration1()
RETURNS void AS
$BODY$
DECLARE
EMPYID CHARACTER VARYING(20);
EMPD CHARACTER VARYING(20);
begin
FOR EMPYID IN select udf_generateemployeeid(2, ('now'::text)::date) LOOP
select coalesce(max(cast(cast(empid as integer)+1 as text)),null,EMPYID) into EMPD from tblemployeemst where createddate = 'now'::date;
INSERT INTO tblemployeemst(givenname, surname, basicsal, hiredate, rgid, qualification,
otherqualif, experience, active, age, gender, dob, resphone, offphone, mobileno,emailid, mstatus, designationid, brid,empid)
SELECT distinct e.name, e.surname, e.basicsal,e.hiredate,2, e.qualification, e.otherqualif, e.experience, cast(e.actflag as boolean),ei.age,ei.gender,ei.dob, ei.resphone,
ei.offphone, ei.mobileno,ei.emailid, ei.mstatus,d.designationid,2,EMPD
FROM tabemployeemst e left outer Join tabemployeedtl ei on ei.eid=e.eid left outer join tbldesignationmst d on upper(d.designationname)=upper(e.designame);
END LOOP;
end;
$BODY$
LANGUAGE plpgsql VOLATILE
COST 100;
ALTER FUNCTION empdatamigration1() OWNER TO postgres;