dbTalk Databases Forums  

need help on stored procedures

comp.databases.postgresql.novice comp.databases.postgresql.novice


Discuss need help on stored procedures in the comp.databases.postgresql.novice forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Pradeepkumar, Pyatalo
 
Posts: n/a

Default need help on stored procedures - 07-07-2004 , 05:13 AM







Hi all,

I have written a sample procedure where i pass 2 arguments. Based on the
arguments i need to select few fields from a table. After selecting the
fields i have to display them. How do i return the selected fields. The
procedure is as follows

CREATE FUNCTION PP_ReadParameter(integer,varchar) RETURNS TEXT AS '
DECLARE
ParamId INTEGER;
ParamName TEXT;
IsFixEnum BIT;
IsExpandEnum BIT;
BEGIN
IF $1 IS NOT NULL THEN
SELECT INTO ParamId,ParamName,IsFixEnum,IsExpandEnum
AttributeId,AttributeName,IsFixEnum,IsExpandEnum
FROM Attributes
WHERE AttributeId = $1
ORDER BY AttributeId;

RETURN ''$1 successfull'';
END IF;
......
......
END;
' LANGUAGE 'plpgsql';

So when i say SELECT PP_ReadParameter(50,Null)......it should return the
ParamId,ParamName,....
But to check the working of the function i just return ''$1 successfull'' as
i dont know how to return the tuple.

Please help me on this


Quote:
With Best Regards
Pradeep Kumar P J

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to majordomo (AT) postgresql (DOT) org)



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.