From: | "Pradeepkumar, Pyatalo (IE10)" <Pradeepkumar(dot)Pyatalo(at)honeywell(dot)com> |
---|---|
To: | aspire420(at)hotpop(dot)com, "Pradeepkumar, Pyatalo (IE10)" <Pradeepkumar(dot)Pyatalo(at)honeywell(dot)com> |
Cc: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: Function Parameters - need help !!! |
Date: | 2004-06-21 10:48:10 |
Message-ID: | 77ED2BF75D59D1439F90412CC5B109740DCFBDCC@ie10-sahara.hiso.honeywell.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
Well this is right for the local variables....but what about the function
parameters. Okay, I will make it more simple....say I want to write a
function like this....
CREATE FUNCTION test(integer,integer) RETURNS INTEGER AS '
DECLARE
param1 ALIAS FOR $1;
param2 ALIAS FOR $2;
BEGIN
-------
------
-------
END;
' LANGUAGE 'plpgsql';
Now i want to define default values to param1 and param2....if i dont pass a
value....the function should take default values for those
arguments.....that is what i was trying to implement....need help on this
-----Original Message-----
From: V i s h a l Kashyap @ [Sai Hertz And Control Systems]
[mailto:sank89(at)sancharnet(dot)in]
Sent: Monday, June 21, 2004 3:12 PM
To: Pradeepkumar, Pyatalo (IE10)
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: [SQL] Function Parameters - need help !!!
Dear Pradeep ,
>CREATE PROC PP_ReadPointByValue
>@SessionID int = NULL, --these r default parameters
>
>
SessionID INT := NULL;
>@SPSID int = 1,--default value
>
>
SPSID int := 1 ;
>@ParameterName nvarchar (50) = NULL, -- if NULL read all parameters
>
>
ParameterName varchar(50) := NULL ;
>@NumValue real = NULL,
>@StrValue nvarchar (255) = NULL,
>
>
same as ParameterName varchar(50) := NULL ;
>@ParameterID int = NULL
>
>
ParameterID int := NULL;
Kindly note :
1. This all is for plpgsql procedure
2. All the variable in upcase would be used as lower case i.e
SessionID would be sessionid untll it is not as "SessionID"
3. If a value is not intiliazed it is defaulted to NULL.
--
Best Regards,
Vishal Kashyap
Director / Lead Software Developer,
Sai Hertz And Control Systems Pvt Ltd,
http://saihertz.rediffblogs.com [Comming Soon http://www.saihertz.com]
Yahoo IM: coeb_college[ a t ]yahoo.com
From | Date | Subject | |
---|---|---|---|
Next Message | Phil Endecott | 2004-06-21 11:52:48 | Re: Function Parameters - need help !!! |
Previous Message | Richard Huxton | 2004-06-21 10:14:59 | Re: Strange behaviour updating primary key column. |