display table contents using a stored proc - Mailing list pgsql-novice

From Manish Raj Sharma
Subject display table contents using a stored proc
Date
Msg-id 4343C3FE.9010502@aol.net
Whole thread Raw
List 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


pgsql-novice by date:

Previous
From: Jonathan Tse
Date:
Subject: Order by and index
Next
From: "Obe, Regina DND\\MIS"
Date:
Subject: Re: display table contents using a stored proc