Reputation: 683
Here is what I would like to do:
declare maxNum integer;
maxNum = select MAX(rn) from :ColumnList;
The sql statement returns a table with one row/col (one value).
Is there an easy way to assign this value to a scalar variable?
Upvotes: 0
Views: 584
Reputation: 683
The variable will be stored as an integer with this syntax.
declare maxNum integer;
select MAX(rn) into maxNum from :ColumnList;
Edit: Thanks to Lars Br. for the explanation why this works.
Upvotes: 3