pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedDoubt about User-defined function.
2+ messages / 2 participants
[nested] [flat]
* Doubt about User-defined function.
@ 2006-07-15 10:38 sathiya moorthy <mail2sathiyamoorthy@gmail.com>
2006-07-15 22:10 ` Re: Doubt about User-defined function. Aaron Bono <postgresql@aranya.com>
0 siblings, 1 reply; 2+ messages in thread
From: sathiya moorthy @ 2006-07-15 10:38 UTC (permalink / raw)
To: pgsql-sql
I have doubt about user-defined function returns value :
* why function returns( accepts ) One attribute in the
arguments of function/table, Otherwise it returns the whole record of the
table. Function accept more than arguments .
* Why it doesn`t return more than one arguments in
the function (or) Attribute of that table.
* Its like same as C-language function, Because in C function
returns one value (or) structure/array of characters.
* My question is, In psql user-defined function doesn`t
returns more than one attribute. Is it possible (or) Not.
Some examples :
i) create function com2(text,integer) returns text as '
select city.city from city,weather
where weather.city=$1 AND city.pop>$2' language sql;
Res : Return type of the function is Text, As well as it
is one of the argument of function.
( At the type of returning, why it doesn`t
also accepts integer ).
ii) create function usrs_tab(text,integer) returns city as
'select city.city,city.pop,city.state from
city,weather where weather.city=$1 AND city.pop>$2' language
sql;
Res : Return one record from City table ( table
contains city, pop, state only ).
Thanking you.
--
sathiyamoorthy
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: Doubt about User-defined function.
2006-07-15 10:38 Doubt about User-defined function. sathiya moorthy <mail2sathiyamoorthy@gmail.com>
@ 2006-07-15 22:10 ` Aaron Bono <postgresql@aranya.com>
0 siblings, 0 replies; 2+ messages in thread
From: Aaron Bono @ 2006-07-15 22:10 UTC (permalink / raw)
To: sathiya moorthy <mail2sathiyamoorthy@gmail.com>; +Cc: pgsql-sql
I am really confused about what your question is. Functions can take zero
to many arguments and return one value. The argument types are different
from (or at least are independent of) the return value. Arguments are not
returned, they are passed into the function. Your use of the terminology
appears to be inconsistent with the definitions of these words.
-Aaron
On 7/15/06, sathiya moorthy <mail2sathiyamoorthy@gmail.com> wrote:
>
> I have doubt about user-defined function returns value :
>
> * why function returns( accepts ) One attribute in the
> arguments of function/table, Otherwise it returns the whole record of the
> table. Function accept more than arguments .
> * Why it doesn`t return more than one arguments in
> the function (or) Attribute of that table.
>
> * Its like same as C-language function, Because in C
> function returns one value (or) structure/array of characters.
>
> * My question is, In psql user-defined function doesn`t
> returns more than one attribute. Is it possible (or) Not.
>
> Some examples :
> i) create function com2(text,integer) returns text as '
> select city.city from city,weather
> where weather.city=$1 AND city.pop>$2' language sql;
>
> Res : Return type of the function is Text, As well as
> it is one of the argument of function.
> ( At the type of returning, why it doesn`t
> also accepts integer ).
> ii) create function usrs_tab(text,integer) returns city as
> 'select city.city,city.pop,city.state from
> city,weather where weather.city=$1 AND city.pop>$2'
> language sql;
>
> Res : Return one record from City table ( table
> contains city, pop, state only ).
>
==================================================================
Aaron Bono
Aranya Software Technologies, Inc.
http://www.aranya.com
==================================================================
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2006-07-15 22:10 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2006-07-15 10:38 Doubt about User-defined function. sathiya moorthy <mail2sathiyamoorthy@gmail.com>
2006-07-15 22:10 ` Aaron Bono <postgresql@aranya.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox