Re: Stored Procedures
Posted in 1998
Chris Jessen wrote: > I'm currently writing stored procedures in ODS 7.3. Does anyone have > a suggestion about returning field names with my resultsets??? Yeah, we all wish a stored procedure would return column names in the SQL DESCRIPTOR the way a select statement does. Sigh.. However, you can fake it: Before you return any data, you can do this: RETURN "Name", "Address", "AnyDataYouBloodyWellFeelLike" with resume; (You do NOT have to be in a FOREACH loop to do this, though the "with resume" clause was meant for returning a row within the foreach loop.) Then, when you proceed, you will actually be returning data: RETURN data1, data2, data3 WITH RESUME; Of course, this has a price: 1. I suspect if the SP was supposed to reuturn any numbers, BOMB goes the weasel! My suggestion would work ONLY if the SP always returns character data only. 2. Even if there is only 1 row of data to be returned, you would have to issue 2 calls to the SP to fetch it, because the first call returns only the bogus column names, not actual data. 3. An ignorant person issuing the SP call would get a first row of bogus data and would search the database frantically to find where this came from. Hmm.. Actually, it might be fun to watch! >;-) Let us know if this helps. -- -- Jake (Retrospectively realizes there is no future in hindsight) +------------------------------------------------------------+ | The expedient performance of a task with excessive concern | | regarding its duration-to-completion engenders a virtual | | certainty of diminished benefit therefrom. | | -- Benjamin Franklin (but he said it in 3 words) | +------------------------------------------------------------+