Reputation: 53
Is there a way in Informix to create a ROW type named or unnamed that you can put a row resulted from a select into? I'm working in a stored procedure.
What I want is something like this:
DEFINE ROW rowVar;
SELECT * INTO rowVar FROM myTableName;
Haven't been able to find the correct syntax so far. I want the row object to behave sort-of like it would be SAMEAS with the table columns.
Upvotes: 1
Views: 1173
Reputation: 23
I do this regularly with Informix.
define o_Row row(cs_nr int not null, addr_nr int, last_name varchar(255));
foreach
select cs into o_Row from cs where cs_nr = 1234
end foreach;
if you are returning more than one row or are not in a foreach you can use a multiset.
define o_Row multiset(row(cs_nr int not null, addr_nr int, last_name varchar(255))not null);
Upvotes: 1
Reputation: 1451
It is not possible to use an "undefined" ROW
type in Informix Stored Procedure Language (SPL).
If you try the following (using Informix 12.10.FC8DE):
CREATE PROCEDURE sp_dummy();
DEFINE generic_row ROW;
END PROCEDURE;
It returns the following error:
-999 Not implemented yet.
The Informix manual does not seem to be correct:
The following statements show examples of generic ROW variables and named ROW variables:
DEFINE d ROW; -- generic ROW variable
If you define the fields of the ROW
then you can use it inside the SPL.
Upvotes: 0