MySQL Forums
Forum List  »  Stored Procedures

Variable Table name in Stored Procedure issue
Posted by: A G
Date: March 08, 2012 11:18PM

Hi,
I am a newbie. I am facing a problem while constructing a stored procedure.
I need to :
1). Make a stored procedure which uses a 'temporary' table (which extracts its data form a 'main' table)
2). The temporary table is processed in several functions to yield the final data.
3). There is a lot of data (ie. many 'main' unique tables). I need this stored procedure to run concurrently on separate threads.

Now, I try to run this stored procedure with a hard-coded temporary table name, and access the temporary table data , the multi-threaded simultaneous calls corrupts the data.

A dynamic SQL query can solve to problem of creating 'temporary' tables with variable names (i.e. names derived off the unique 'main' table names). But, I can't send this name into the functions (processing the 'temporary' table) as dynamic SQL queries arent allowed in functions.

Can you help me find a way ?
( cuz my options seem to be :
1. Avoid Multithreading
2. Avoid SQL Functions (and write everything in the stored proecdure)

Thank you for reading
Amit

Options: ReplyQuote


Subject
Views
Written By
Posted
Variable Table name in Stored Procedure issue
3943
A G
March 08, 2012 11:18PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.