Help with returning affected rows from a function
От | Pradeepkumar, Pyatalo (IE10) |
---|---|
Тема | Help with returning affected rows from a function |
Дата | |
Msg-id | 77ED2BF75D59D1439F90412CC5B109740DBA4B9B@ie10-sahara.hiso.honeywell.com обсуждение исходный текст |
Список | pgsql-novice |
Hi, I m porting stored procedures from SQL to PGSQL. I dont know much about PGSQL. I have problems in returning affected rows from the function. I could not find much information about this. I would really appreciate if anyone can help me out with this. This is the procedure i m trying to execute... CREATE FUNCTION PP_ReadParameter(INTEGER,VARCHAR) RETURNS VARCHAR AS ' DECLARE paramId ALIAS FOR $1; paramName ALIAS FOR $2; use_t Attributes%ROWTYPE; BEGIN IF paramId IS NOT NULL THEN SELECT AttributeID AS ParameterID, AttributeName AS ParameterName, IsFixEnum, IsExpandEnum INTO use_t FROM Attributes WHERE AttributeID = paramID ORDER BY AttributeID; RETURN ''paramID successful''; ELSE IF paramName IS NOT NULL THEN SELECT AttributeID AS ParameterID, AttributeName AS ParameterName, IsFixEnum, IsExpandEnum INTO use_t FROM Attributes WHERE AttributeName = paramName ORDER BY AttributeID; RETURN ''paramName successful''; ELSE SELECT AttributeID AS ParameterID, AttributeName AS ParameterName, IsFixEnum, IsExpandEnum INTO use_t FROM Attributes ORDER BY AttributeID; RETURN ''paramID AND paramName not successful''; END IF; END IF; END; ' LANGUAGE 'plpgsql'; The Attributes table structure is Attributes(AttributeID LONG INTEGER, AttributeName VARCHAR (50), AttributeDataType VARCHAR (20), AttributeDataSource VARCHAR (20), AttributeDataSourceAttribute INTEGER, IsFixEnum Bit, IsExpandEnum Bit); Just to chk the working of the function i m returning some text....actually i want to return the rows that are affected and print them. Thanks in advance. > With Best Regards > Pradeep Kumar P J > >
В списке pgsql-novice по дате отправления: