on 2012 Aug 01 11:08 AM
Hi / I got this error after moving to asa 12 from asa 10 . Recompile of all procedure did not help . Store procedure just failing from time to time ( in 20 % cases on the different data ) / Can anybody help ? Error reference suggest to recompile procedures . It dos not help . Thanks
Request clarification before answering.
If you use a temporary table inside a procedure and there is a chance that the table definition is different in each procedure call, then you must use the temporary table with execute immediate statements only (e.g EXECUTE IMMEDIATE WITH RESULT SET ON "select * from tmp2"). All procedure statements except "execute immediates" are parsed and annotated when they are used the first time. So a "select * from tab2" has a fixed parse tree after the 1st run and if the table definition is different during the next procedure call you see the error. Hope this helps.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I add this post only because of the error code. We are migrating from SQLA7 to 12 and get the same error now when calling a stored procedure twice. The second run causes the error. Imagine the following: 1. Create some data into #temptable1_first 2. Now group this data by "select col1,sum(col2) as col2 into #temptable1 from #temptable1_first group by col1"
The problem here is that the column types of col1 and col2 are not well-defined (although #temptable1_first has data in both calls). To avoid this problem you have to make sure that the column types are known before grouping the data:
Select cast(null as integer) as col1, cast(null as integer) as col2 into #temptable1; delete from #temptable1; insert into #temptable1 select... from #temptable1_first;
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
76 | |
30 | |
8 | |
8 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.