![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hi. I'm relatively new to plSQL, and I have a bit of a problem. I'd like to make a package with one procedure creating some tables, and another procedure SELECTing from them. Is this even possible? My problem is that (as far as I know), plSQL only allows creating tables through EXECUTE IMMEDIATE. And if the table creator procedure uses EXECUTE IMMEDIATE to create the tables, the other procedures can't see that the tables exist, and the whole thing refuses to compile, giving a "Table or view does not exist" error. Any help with this one? |
#3
| |||
| |||
|
#4
| |||
| |||
|
|
laszlo_spamhole (AT) freemail (DOT) hu wrote: Hi. I'm relatively new to plSQL, and I have a bit of a problem. I'd like to make a package with one procedure creating some tables, and another procedure SELECTing from them. Is this even possible? My problem is that (as far as I know), plSQL only allows creating tables through EXECUTE IMMEDIATE. And if the table creator procedure uses EXECUTE IMMEDIATE to create the tables, the other procedures can't see that the tables exist, and the whole thing refuses to compile, giving a "Table or view does not exist" error. Any help with this one? What is it you are trying to achieve, really? In all probability, creating tables via EXECUTE IMMEDIATE is not the correct solution. |
|
Mayeb you want a GLOBAL TEMPORARY table? |
#5
| |||
| |||
|
|
You can SELECT FROM the tables created on the fly with another EXECUTE IMMEDIATE 'SELECT...'. (They must exist when the select is executed). hth. |
|
Carlos. |
#6
| |||
| |||
|
|
andrewst (AT) onetel (DOT) com wrote: Mayeb you want a GLOBAL TEMPORARY table? Since creating the search tables takes a fair amount of time and the graph is fairly non-volatile, I don't want to have to re-generate the search tables every session. I actually (kind of) solved the problem by generating dummy search tables manually... this allowed my package to compile, and the creator procedure then did what it was supposed to (find the table, drop it, and re-create it with all the necessary data). But while this _does_ work (as long as nobody drops my tables), it's not exactly the most elegant solution. |
#7
| |||
| |||
|
|
laszlo_spamh... (AT) freemail (DOT) hu wrote: andrewst (AT) onetel (DOT) com wrote: Mayeb you want a GLOBAL TEMPORARY table? Since creating the search tables takes a fair amount of time and the graph is fairly non-volatile, I don't want to have to re-generate the search tables every session. I actually (kind of) solved the problem by generating dummy search tables manually... this allowed my package to compile, and the creator procedure then did what it was supposed to (find the table, drop it, and re-create it with all the necessary data). But while this _does_ work (as long as nobody drops my tables), it's not exactly the most elegant solution. So why do you need to drop and re-create the tables each time? Do you generate a different set of columns each time? |

#8
| |||
| |||
|
|
laszlo_spamh... (AT) freemail (DOT) hu wrote: andrewst (AT) onetel (DOT) com wrote: Mayeb you want a GLOBAL TEMPORARY table? Since creating the search tables takes a fair amount of time and the graph is fairly non-volatile, I don't want to have to re-generate the search tables every session. I actually (kind of) solved the problem by generating dummy search tables manually... this allowed my package to compile, and the creator procedure then did what it was supposed to (find the table, drop it, and re-create it with all the necessary data). But while this _does_ work (as long as nobody drops my tables), it's not exactly the most elegant solution. So why do you need to drop and re-create the tables each time? Do you generate a different set of columns each time? |

#9
| |||
| |||
|
|
Hi. I'm relatively new to plSQL, and I have a bit of a problem. I'd like to make a package with one procedure creating some tables, and another procedure SELECTing from them. Is this even possible? My problem is that (as far as I know), plSQL only allows creating tables through EXECUTE IMMEDIATE. And if the table creator procedure uses EXECUTE IMMEDIATE to create the tables, the other procedures can't see that the tables exist, and the whole thing refuses to compile, giving a "Table or view does not exist" error. Any help with this one? Thanks, Laszlo |
#10
| |||
| |||
|
|
Hmm... actually, I think I see your point. I'm not sure why I'm dropping the table instead of doing a DELETE FROM, when the data needs to be recreated from scratch. |
![]() |
| Thread Tools | |
| Display Modes | |
| |