Search Postgresql Archives

void stored procedure does return something?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I have the following stored procedure return void.

CREATE OR REPLACE FUNCTION sandbox()
  RETURNS void AS
$BODY$DECLARE
    DECLARE me text;
    DECLARE he int;
BEGIN
    he = 100;
    RAISE NOTICE 'he is %', he;
    -- me = "Hello PostgreSQL";
END;$BODY$
  LANGUAGE 'plpgsql' VOLATILE
  COST 100;
ALTER FUNCTION sandbox() OWNER TO postgres;

When I perform query :

SELECT * FROM sandbox();

Everything is fine.

"he is 100" is being printed in message area.

However, when I remove "--" from 
me = "Hello PostgreSQL";

I get the following error :
================================================
ERROR:  column "Hello PostgreSQL" does not exist
LINE 1: SELECT  "Hello PostgreSQL"
                ^
QUERY:  SELECT  "Hello PostgreSQL"
CONTEXT:  PL/pgSQL function "sandbox" line 7 at assignment
================================================

But isn't my stored procedure is void? Isn't it shouldn't return anything?

Thanks and Regards
Yan Cheng CHEOK


      


-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux