Subject | Is there possibility to return dynamic number of columns from EXECUTE BLOCK /SP? |
---|---|
Author | un_spoken |
Post date | 2012-07-03T19:11:52Z |
Hello.
I am pretty sure that is not possible. I've read all info I could get on the web and it clearly says that output variables /columns must be defined for stored procedure or execute block. But maybe I am wrong?
Maybe it is somehow possible to do something like this?
SET TERM ^ ;
EXECUTE BLOCK
AS
DECLARE S varchar(255);
BEGIN
S = 'SELECT ' || DYNAMIC_COL1 || ' , ' || DYNAMIC_COL2 || ' FROM MY_TABLE';
EXECUTE STATEMENT S;
END^
The thing is that I am trying to build a query that will return a different number of columns (with varying names) basing on the input parameters.
But I guess that is not possible?:(
Thanks for your time.
I am pretty sure that is not possible. I've read all info I could get on the web and it clearly says that output variables /columns must be defined for stored procedure or execute block. But maybe I am wrong?
Maybe it is somehow possible to do something like this?
SET TERM ^ ;
EXECUTE BLOCK
AS
DECLARE S varchar(255);
BEGIN
S = 'SELECT ' || DYNAMIC_COL1 || ' , ' || DYNAMIC_COL2 || ' FROM MY_TABLE';
EXECUTE STATEMENT S;
END^
The thing is that I am trying to build a query that will return a different number of columns (with varying names) basing on the input parameters.
But I guess that is not possible?:(
Thanks for your time.