display table contents using a stored proc

From: Manish Raj Sharma <manishrs(at)aol(dot)net>
To: pgsql-novice(at)postgresql(dot)org
Subject: display table contents using a stored proc
Date: 2005-10-05 12:15:58
Message-ID: 4343C3FE.9010502@aol.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Hi,

I am new to stored procedures and have been trying to display the
contents of a table using a stored proc as follows:

create or replace function show_table (
cidr -- ip_block
) returns void
language plpgsql as '
declare
block alias for $1;
begin
select * from ip_table
where ip_block = block
return;
end;
';

When I call the function, I get the following:

mydb=# SELECT show_table('62.51.0.0/16');
ERROR: SELECT query has no destination for result data
HINT: If you want to discard the results, use PERFORM instead.
CONTEXT: PL/pgSQL function "show_table" line 4 at SQL statement

Any help?

Thanks,
-manish

Browse pgsql-novice by date

  From Date Subject
Next Message Obe, Regina DND\MIS 2005-10-05 13:08:52 Re: display table contents using a stored proc
Previous Message Jonathan Tse 2005-10-05 06:52:46 Order by and index