Skip to main content
added 95 characters in body
Source Link
Super Kai - Kazuya Ito
  • 43.4k
  • 24
  • 261
  • 261

I got the same error when passingcreated a PL/pgSQL function with 3OUT toparameter as shown below::

CREATE FUNCTION my_func(OUT value INTEGER) AS $$
BEGIN                -- ↑ ↑ ↑ Here ↑ ↑ ↑
END;
$$ LANGUAGE plpgsql;

Then, calling my_func(3) functiongot the same error as shown below because OUT parameter cannot get a value from the caller while it can return a value to the caller:

postgres=# SELECT my_func(3);
ERROR:  function my_func(integer) does not exist
LINE 1: SELECT my_func(3);
               ^
HINT:  No function matches the given name and argument types. You might need to add explicit type casts.

Because I set the OUT parameter which cannot get a value from the caller but can return a value to the caller as shown below:

CREATE FUNCTION my_func(OUT value INTEGER) AS $$
BEGIN                -- ↑ ↑ ↑ Here ↑ ↑ ↑
END;
$$ LANGUAGE plpgsql;

So, I set the INOUT parameter which can get a value from the caller and return a value to the caller as shown below, then the error was solved:

CREATE FUNCTION my_func(INOUT value INTEGER) AS $$
BEGIN                -- ↑ ↑ ↑ Here ↑ ↑ ↑
END;
$$ LANGUAGE plpgsql;

Or, I set the IN parameter which can get a value from the caller but cannot return a value to the caller and RETURNS VOID as shown below, then the error was solved:

CREATE FUNCTION my_func(IN value INTEGER) RETURNS VOID AS $$
BEGIN                -- ↑ ↑ ↑ Here ↑ ↑ ↑
END;
$$ LANGUAGE plpgsql;

Or, I set the parameter without IN keyword which is also recognized as an IN parameter and RETURNS VOID as shown below, then the error was solved:

CREATE FUNCTION my_func(value INTEGER) RETURNS VOID AS $$
BEGIN                -- ↑ ↑ Here ↑ ↑   ↑ ↑ Here ↑ ↑
END;
$$ LANGUAGE plpgsql;

I got the same error when passing 3 to my_func() function as shown below:

postgres=# SELECT my_func(3);
ERROR:  function my_func(integer) does not exist
LINE 1: SELECT my_func(3);
               ^
HINT:  No function matches the given name and argument types. You might need to add explicit type casts.

Because I set the OUT parameter which cannot get a value from the caller but can return a value to the caller as shown below:

CREATE FUNCTION my_func(OUT value INTEGER) AS $$
BEGIN                -- ↑ ↑ ↑ Here ↑ ↑ ↑
END;
$$ LANGUAGE plpgsql;

So, I set the INOUT parameter which can get a value from the caller and return a value to the caller as shown below, then the error was solved:

CREATE FUNCTION my_func(INOUT value INTEGER) AS $$
BEGIN                -- ↑ ↑ ↑ Here ↑ ↑ ↑
END;
$$ LANGUAGE plpgsql;

Or, I set the IN parameter which can get a value from the caller but cannot return a value to the caller and RETURNS VOID as shown below, then the error was solved:

CREATE FUNCTION my_func(IN value INTEGER) RETURNS VOID AS $$
BEGIN                -- ↑ ↑ ↑ Here ↑ ↑ ↑
END;
$$ LANGUAGE plpgsql;

Or, I set the parameter without IN keyword which is also recognized as an IN parameter and RETURNS VOID as shown below, then the error was solved:

CREATE FUNCTION my_func(value INTEGER) RETURNS VOID AS $$
BEGIN                -- ↑ ↑ Here ↑ ↑   ↑ ↑ Here ↑ ↑
END;
$$ LANGUAGE plpgsql;

I created a PL/pgSQL function with OUT parameter as shown below::

CREATE FUNCTION my_func(OUT value INTEGER) AS $$
BEGIN                -- ↑ ↑ ↑ Here ↑ ↑ ↑
END;
$$ LANGUAGE plpgsql;

Then, calling my_func(3) got the same error as shown below because OUT parameter cannot get a value from the caller while it can return a value to the caller:

postgres=# SELECT my_func(3);
ERROR:  function my_func(integer) does not exist
LINE 1: SELECT my_func(3);
               ^
HINT:  No function matches the given name and argument types. You might need to add explicit type casts.

So, I set the INOUT parameter which can get a value from the caller and return a value to the caller as shown below, then the error was solved:

CREATE FUNCTION my_func(INOUT value INTEGER) AS $$
BEGIN                -- ↑ ↑ ↑ Here ↑ ↑ ↑
END;
$$ LANGUAGE plpgsql;

Or, I set the IN parameter which can get a value from the caller but cannot return a value to the caller and RETURNS VOID as shown below, then the error was solved:

CREATE FUNCTION my_func(IN value INTEGER) RETURNS VOID AS $$
BEGIN                -- ↑ ↑ ↑ Here ↑ ↑ ↑
END;
$$ LANGUAGE plpgsql;

Or, I set the parameter without IN keyword which is also recognized as an IN parameter and RETURNS VOID as shown below, then the error was solved:

CREATE FUNCTION my_func(value INTEGER) RETURNS VOID AS $$
BEGIN                -- ↑ ↑ Here ↑ ↑   ↑ ↑ Here ↑ ↑
END;
$$ LANGUAGE plpgsql;
Source Link
Super Kai - Kazuya Ito
  • 43.4k
  • 24
  • 261
  • 261

I got the same error when passing 3 to my_func() function as shown below:

postgres=# SELECT my_func(3);
ERROR:  function my_func(integer) does not exist
LINE 1: SELECT my_func(3);
               ^
HINT:  No function matches the given name and argument types. You might need to add explicit type casts.

Because I set the OUT parameter which cannot get a value from the caller but can return a value to the caller as shown below:

CREATE FUNCTION my_func(OUT value INTEGER) AS $$
BEGIN                -- ↑ ↑ ↑ Here ↑ ↑ ↑
END;
$$ LANGUAGE plpgsql;

So, I set the INOUT parameter which can get a value from the caller and return a value to the caller as shown below, then the error was solved:

CREATE FUNCTION my_func(INOUT value INTEGER) AS $$
BEGIN                -- ↑ ↑ ↑ Here ↑ ↑ ↑
END;
$$ LANGUAGE plpgsql;

Or, I set the IN parameter which can get a value from the caller but cannot return a value to the caller and RETURNS VOID as shown below, then the error was solved:

CREATE FUNCTION my_func(IN value INTEGER) RETURNS VOID AS $$
BEGIN                -- ↑ ↑ ↑ Here ↑ ↑ ↑
END;
$$ LANGUAGE plpgsql;

Or, I set the parameter without IN keyword which is also recognized as an IN parameter and RETURNS VOID as shown below, then the error was solved:

CREATE FUNCTION my_func(value INTEGER) RETURNS VOID AS $$
BEGIN                -- ↑ ↑ Here ↑ ↑   ↑ ↑ Here ↑ ↑
END;
$$ LANGUAGE plpgsql;