Stored Procedure - Outputing a temp table

244 views Asked by At

I have a stored procedure that creates multiple temp tables and uses them to output a variable. I want to test the data inside of my temp tables before moving forward. Is there a way to view my temp tables or at least output them from the stored procedure so that I can use them somewhere else?

Currently I have:

CREATE PROCEDURE Top10_SP_getMeasure007
(
    in :division char(2),
    in :startdate date,
    in :enddate date,
    out :QualifyingModels int
);

I was thinking the out variable could be the temp table.

1

There are 1 answers

0
mirtheil On

According to documentation, temp tables within Stored Procedures are only accessible outside the stored procedure if the temp table is a Global Temp Table. You cannot pass the temp table as an OUT parameter. You might be able to print (display) the data in your temp table within the procedure but that would take more effort.
My suggestion would be to pull the temp table portion out of the procedure and run it in the PCC.