Home:ALL Converter>Postgresql -CREATE FUNCTION

Postgresql -CREATE FUNCTION

Ask Time:2016-07-07T14:41:11         Author:Sayeekrishnan Subramaniam

Json Formatter

CREATE OR REPLACE FUNCTION  udf_get_emp_name(p_empcode integer)
returns text
AS 
$BODY$

    DECLARE l_emp_name  TEXT;
   select emp_name into l_emp_name from employee  where empcode = p_empcode;

   return l_emp_name;
END;

$BODY$
  LANGUAGE plpgsql VOLATILE
  COST 100;

This function gets created successfully and postgresql doesn't check if table exist or column exist. Is there any option to check if column name and table names are correct and exist at the time of CREATE or REPLACE FUNCTION

Author:Sayeekrishnan Subramaniam,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/38238967/postgresql-create-function
yy