Ask a Question related to Informix, Design and Development.
-
navdeep virk #1
SP Temp Tables
Hi All,
I am creating temp tables and dropping them after the processing is done in
a stored procedure , however if users abort and try to run again we get the
error " t_temp etc.. already in the database" . Is there any workaround to
check if this temp table exists then drop it and create the temp table again
..
Navdeep
__________________________________________________ _______________
See when your friends are online with MSN Messenger 6.0. Download it now
FREE! [url]http://msnmessenger-download.com[/url]
sending to informix-list
navdeep virk Guest
-
Dynamic identification of Informix temp tables
I would like to develop a process which can determine if there were temp tables created during my current database connection. I am the system... -
Temp tables and jdbc 2.21.jc3 on IDS 9.4.UC1
The following query uses a TEMP table. I get the results in dbaccess, but the query fails when submitted from a java program using JDBC 2.21.jc3...... -
Schedule maitenance or temp tables
I'm developing a content management system to use for the web. I want to allow users to alter data, delete data, and add data for each individual... -
Accessing Temp Tables
Hello Graham, You could try using global temp tables with a "##", in your case it would be - ##UserAccess. K "Graz79"... -
Question about optimizer with (big) temp tables
If I ask query analyser to give me an estimated query plan, how does it work this out since my temp table will only be populated when I fire the... -
Paul Watson #2
Re: SP Temp Tables
If the user aborts in the SPL code you can trap on the exception and
tidy up. Otherwise always drop the table first and then use the
exception
to resume a failed drop.
navdeep virk wrote:-->
> Hi All,
>
> I am creating temp tables and dropping them after the processing is done in
> a stored procedure , however if users abort and try to run again we get the
> error " t_temp etc.. already in the database" . Is there any workaround to
> check if this temp table exists then drop it and create the temp table again
> .
>
> Navdeep
>
> __________________________________________________ _______________
> See when your friends are online with MSN Messenger 6.0. Download it now
> FREE! [url]http://msnmessenger-download.com[/url]
>
> sending to informix-list
Paul Watson #
Oninit Ltd # Growing old is mandatory
Tel: +44 1436 672201 # Growing up is optional
Fax: +44 1436 678693 #
Mob: +44 7818 003457 #
[url]www.oninit.com[/url] #
Paul Watson Guest
-
rkusenet #3
Re: SP Temp Tables
"navdeep virk" <nvirk@msn.com> wrote in message news:bnbo7c$k58$1@terabinaries.xmission.com...There are two ways of dealing with this problem.>
> Hi All,
>
> I am creating temp tables and dropping them after the processing is done in
> a stored procedure , however if users abort and try to run again we get the
> error " t_temp etc.. already in the database" . Is there any workaround to
> check if this temp table exists then drop it and create the temp table again
> .
1. Create an exception block to ignore errors and drop the temp table at the
start of the procedure. No error will be returned if the table does not exists.
BEGIN
ON EXCEPTION
--
END EXCEPTION WITH RESUME
DROP TABLE TMP_TABLE ;
END
2. Run this query at the start of the SP.
SELECT count(*)
into w_count
from sysmaster:systabnames s,sysmaster:systabinfo i
where i.ti_partnum = s.partnum
and sysmaster:BITVAL(i.ti_flags,'0x0020') = 1
and s.tabname = 'your_tmp_table_name' ;
The query will return 1 if the temp table exists.
I would go for option (1).
Ravi
--
email id is bogus
rkusenet Guest
-
Gregg Walker #4
Re: SP Temp Tables
Here's a procedure I have that does the same kind of thing you're talking
about. You could essentialy add the begin end block logic to the top of
your procedure.
Hope this helps.
Gregg Walker
Create Procedure ClearShiftEntries(
pShiftCardID integer
)
--set debug file to "/tmp/ClearShiftEntries.out";
--trace on;
begin
on exception in (-206)
begin
create temp table tShiftEntry (
shift_card_id integer not null,
line_num smallint default 0 not null,
entry_time datetime year to second not null,
clock_entry_id integer
)
with no log;
end
end exception with resume
delete from
tShiftEntry
where
shift_card_id = pShiftCardID;
end
End Procedure; -- ClearShiftEntries
"navdeep virk" <nvirk@msn.com> wrote in message
news:bnbo7c$k58$1@terabinaries.xmission.com...in>
> Hi All,
>
> I am creating temp tables and dropping them after the processing is donethe> a stored procedure , however if users abort and try to run again we getagain> error " t_temp etc.. already in the database" . Is there any workaround to
> check if this temp table exists then drop it and create the temp table> .
>
>
> Navdeep
>
> __________________________________________________ _______________
> See when your friends are online with MSN Messenger 6.0. Download it now
> FREE! [url]http://msnmessenger-download.com[/url]
>
> sending to informix-list
Gregg Walker Guest
-
Jean Sagi #5
Re: SP Temp Tables
As you could see there are some "ways" to lead to this "issue"...
What I wondwer is: Why this happen? Why a delete delay to delete?
Funny...
Chucho!
navdeep virk wrote:--> Hi All,
>
> I am creating temp tables and dropping them after the processing is done
> in a stored procedure , however if users abort and try to run again we
> get the error " t_temp etc.. already in the database" . Is there any
> workaround to check if this temp table exists then drop it and create
> the temp table again .
>
>
> Navdeep
>
> __________________________________________________ _______________
> See when your friends are online with MSN Messenger 6.0. Download it now
> FREE! [url]http://msnmessenger-download.com[/url]
>
> sending to informix-list
>
>
Atte,
Jesús Antonio Santos Giraldo
[email]jeansagi@myrealbox.com[/email]
[email]jeansagi@netscape.net[/email]
sending to informix-list
Jean Sagi Guest
-
Unregistered #6
Re: SP Temp Tables
do this before using the temp table
if object_id("[tempdb].[dbo].[#TempTableName]") is not null drop #TempTableName
create table #TempTableName
(
column1 DataType1,
column2 DataType2,
...
)
This solves the problem.
-YordanosUnregistered Guest
-
yordanos #7
Re: SP Temp Tables
do this before using the temp table
if object_id("[tempdb].[dbo].[#TempTableName]") is not null drop #TempTableName
create table #TempTableName
(
column1 DataType1,
column2 DataType2,
...
)
This solves the problem.
-Yordanos
Junior Member
- Join Date
- Feb 2011
- Location
- Maryland
- Posts
- 1



Reply With Quote

