Hi, I'm practicing writing PL\pgsql custom function using pgadminIII
This is the automatically generated code after setting the configuration options in the "New Function" popup
Code:CREATE OR REPLACE FUNCTION "getID"(tname character varying, tarname character varying) RETURNS integer AS $BODY$BEGIN SELECT id FROM tname WHERE name=tarname; END$BODY$ LANGUAGE plpgsql VOLATILE COST 100; ALTER FUNCTION "getID"(character varying, character varying) OWNER TO postgres;
Error Generated
attempt to call function from query window within pgadminIII, that generated errorCode:ERROR: function getid(unknown, unknown) does not exist LINE 1: SELECT getID('test','lliok'); ^ HINT: No function matches the given name and argument types. You might need to add explicit type casts. ********** Error ********** ERROR: function getid(unknown, unknown) does not exist SQL state: 42883 Hint: No function matches the given name and argument types. You might need to add explicit type casts. Character: 8
Tried this tooCode:SELECT getID('test','Biggie');
but got this errorCode:SELECT "getID"('test','Biggie');
any suggestions? thanksCode:ERROR: relation "tname" does not exist LINE 1: SELECT id FROM tname WHERE name=tarname ^ QUERY: SELECT id FROM tname WHERE name=tarname CONTEXT: PL/pgSQL function "getID" line 2 at SQL statement ********** Error ********** ERROR: relation "tname" does not exist SQL state: 42P01 Context: PL/pgSQL function "getID" line 2 at SQL statement


Reply With Quote
Victor Nijegorodov 
