Re: Calling Functions

From: "Josh Berkus" <josh(at)agliodbs(dot)com>
To: Oleg Lebedev <olebedev(at)waterford(dot)org>, pgsql-sql(at)postgresql(dot)org
Subject: Re: Calling Functions
Date: 2001-10-02 04:16:33
Message-ID: web-129183@davinci.ethosmedia.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Oleg,

> Hi,
> this is a very silly question, but how do I run PL/pgSQL function
> from SQL?
> I created a function test(varchar, varchar) and I am trying to invoke
> it with
> parameters 'hello', 'world' using an SQL statement. I tried selects
> and executes
> - nothing works.
> Please help,

SELECT test('hello','world');

If you aren't getting the result you expect, then you have made a
mistake in your function name, parameters, return type, or a syntax
error in the function itself.

For example, if you do in fact have the function:

CREATE FUNCTION test (VARCHAR, VARCHAR) RETURNS VARCHAR AS '
DECLARE ....

And if
SELECT test('hello','world');
returns
Parser Error at or near ';'
then the database is telling you that you have a bad function, not that
it doesn't understand the SELECT.

-Josh

______AGLIO DATABASE SOLUTIONS___________________________
Josh Berkus
Complete information technology josh(at)agliodbs(dot)com
and data management solutions (415) 565-7293
for law firms, small businesses fax 621-2533
and non-profit organizations. San Francisco

Attachment Content-Type Size
unknown_filename text/plain 2 bytes
unknown_filename text/plain 2 bytes
unknown_filename text/plain 2 bytes

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Markus Wagner 2001-10-02 04:32:15 using SQL to evaluate arbitrary expressions?
Previous Message Oleg Lebedev 2001-10-02 00:45:21 Re: On Differing Optimizer Choices ( Again)