-
1. Re: Execute a virtual procedure from within another virtual procedure
rareddy Aug 4, 2015 11:08 AM (in response to kisienya)You are trying push cursor results from one procedure to another, I do not know if that is allowed
Alternatively, you can push your results into a temp table, like
CREATE VIRTUAL PROCEDURE BEGIN INSERT INTO #myTemp SELECT * FROM (EXEC virtual_procedure1 (value1)) AS @categoryid; EXEC procedure2 (); END
Then read from #myTemp in procedure2
Ramesh..
-
2. Re: Execute a virtual procedure from within another virtual procedure
shawkins Aug 4, 2015 6:56 PM (in response to rareddy)> You are trying push cursor results from one procedure to another, I do not know if that is allowed
No, we don't have a notion of passing a cursor to a source procedure.
What does procedure2 expect as input?
-
3. Re: Execute a virtual procedure from within another virtual procedure
kisienya Aug 4, 2015 11:39 PM (in response to rareddy)Thanks Ramesh, I will try this out.
-
4. Re: Execute a virtual procedure from within another virtual procedure
kisienya Aug 4, 2015 11:41 PM (in response to shawkins)Thanks Stephen, procedure2 expects an integer value that is an output from procedure1
-
5. Re: Execute a virtual procedure from within another virtual procedure
kisienya Aug 5, 2015 12:25 AM (in response to rareddy)Hi Ramesh,
Your suggested solution seems to be coming on really well, However, there is an error that I don't understand.
TEIID30146 No procedure plan exists for virtual_procedure1.
Much appreciate your contribution.
Regards
Morgan
-
6. Re: Execute a virtual procedure from within another virtual procedure
rareddy Aug 5, 2015 8:28 AM (in response to kisienya)Morgan,
If procedure2 expects a integer from procedure1, then you can try without the #temp table stuff, I was thinking procedure1 returns a result set.
CREATE VIRTUAL PROCEDURE BEGIN DECLARE integer x = EXEC virtual_procedure1 (value1); EXEC procedure2 (x); END
Ramesh..
-
7. Re: Execute a virtual procedure from within another virtual procedure
shawkins Aug 5, 2015 8:33 AM (in response to kisienya)> Thanks Stephen, procedure2 expects an integer value that is an output from procedure1
If it is a scalar result, then you can use a scalar subquery:
EXEC procedure2 ((SELECT intval FROM (EXEC virtual_procedure1 (value1)) AS x));
If you need to process a resultset of integers, then you would use Ramesh's suggestion:
LOOP ON (EXEC virtual_procedure1 (value1)) AS vals
BEGIN
--do something with EXEC procedure2(vals.intval)
END
> TEIID30146 No procedure plan exists for virtual_procedure1.
That is not expected. Can you provide a reproducing vdb?
-
8. Re: Execute a virtual procedure from within another virtual procedure
kisienya Aug 14, 2015 7:47 AM (in response to shawkins)I upgraded my Teiid to designer 9.1 and runtime 8.9 and the error is gone.
I am now able to deploy your suggestions successfully.
Many thanks for your help