Hi have a query its returning text that text i am trying to store it in string but i am getting nothing in variable.
query:
CREATE OR REPLACE FUNCTION fngetlastcodeofvillage(
text,
text,
text)
RETURNS text AS
$BODY$
DECLARE
schoolcode text;
BEGIN
SELECT schcd into schoolcode FROM villagerural_school_form where districtna=$1 and talukname=$2 and villagenam=$3 order by id desc limit 1;
IF schoolcode IS NULL THEN
return (select census2011||'01' from villagerural b where b.districtna=$1 and b.talukname=$2 and b.villagenam=$3);
else
return (cast(cast(schoolcode as bigint)+1 as text ));
END IF;
end
$BODY$
LANGUAGE plpgsql VOLATILE
COST 100;
ALTER FUNCTION fngetlastcodeofvillage(text, text, text)
OWNER TO postgres;
above query i am calling in asp.net like
public string Getschoolcodebyddl(String districtna, String talukname, String villagename)
{
return Helper.ExecuteSelectCommand("select * from fngetlastcodeofvillage('" + districtna + "','" + talukname + "','" + villagename + "');", CommandType.Text).ToString();
}
can any one tell what is wrong i am doing here.query is executing pgsql getting write value but why i am not getting returned text
What I have tried:
i have tried by returning as table and setof text