Subject | not EM goal, but question about firebird statement |
---|---|
Author | Olaf Kluge |
Post date | 2012-06-12T11:58:28Z |
Hello,
I created the following stored procedure:
create procedure P_DB_MOVE_RECORDS (
TOID integer)
as
declare variable STR_J char(4);
declare variable STMTXT varchar(300);
declare variable CHKPROZ integer;
begin
for select substring(ts from 1 for 4) as tsz from t_dt where lnr < :toid
group by tsz into :str_j
do
begin
if(str_j is not null) then
begin
if (not exists(select 1 from rdb$relations where rdb$relation_name =
'B_' || :str_j)) then
begin
select proz_status from p_db_add_new_btable(:str_j) into :chkproz;
end
stmtxt = 'insert into B_' || :str_j ||( ..) ' select * from t_dt;';
execute statement :stmtxt;
end
end
end
The first question: If I call the stored procedure p_db_add_new_btable
before with the parameter 2012, it works and the statement knows this
table. If I call the stored procedure p_db_move_records (calls too this
procedure), then the statement dont know this table, it dont exists. Why
this?
The second question, I have many table columns. Is there a trick to get all
columns like: insert into table(*) select * from othertable where condition
Thank you.
Best regards.
Olaf
Mit freundlichen Grüßen / with best regards
Olaf Kluge
S A T R O N Sachsen
Steuerungstechnik GmbH
Johann-Gottlob-Pfaff Straße 7
D-09405 Zschopau
Tel: +49 (0) 3725 / 3506-31
Fax: +49 (0) 3725 / 3506-12
Mobil: +49 (0) 170 / 9292375
E-Mail: <blocked::mailto:olaf.kluge@...> olaf.kluge@...
Internet: <blocked::http://www.satron.de/> http://www.satron.de/
............................................................................
................
Geschäftsführer: Bernd Grötzschel, Gerd Kaden
Amtsgericht: Chemnitz HRB1218
Ust-ID-Nr: DE141294791
............................................................................
................
Diese E-Mail ist vertraulich. Wenn Sie nicht der beabsichtigte Empfänger
sind, dürfen Sie die Informationen nicht offen legen oder benutzen. Wenn Sie
diese E-Mail durch einen Fehler bekommen haben, teilen Sie uns dies bitte
mit, indem Sie die E-Mail an den Absender zurücksenden. Bitte löschen Sie
danach diese E-Mail.
This email is confidential. If you are not the intended recipient, you must
not disclose or use the information contained in it.
If you have received this mail in error, please tell us immediately by
return email and delete the document.
[Non-text portions of this message have been removed]
I created the following stored procedure:
create procedure P_DB_MOVE_RECORDS (
TOID integer)
as
declare variable STR_J char(4);
declare variable STMTXT varchar(300);
declare variable CHKPROZ integer;
begin
for select substring(ts from 1 for 4) as tsz from t_dt where lnr < :toid
group by tsz into :str_j
do
begin
if(str_j is not null) then
begin
if (not exists(select 1 from rdb$relations where rdb$relation_name =
'B_' || :str_j)) then
begin
select proz_status from p_db_add_new_btable(:str_j) into :chkproz;
end
stmtxt = 'insert into B_' || :str_j ||( ..) ' select * from t_dt;';
execute statement :stmtxt;
end
end
end
The first question: If I call the stored procedure p_db_add_new_btable
before with the parameter 2012, it works and the statement knows this
table. If I call the stored procedure p_db_move_records (calls too this
procedure), then the statement dont know this table, it dont exists. Why
this?
The second question, I have many table columns. Is there a trick to get all
columns like: insert into table(*) select * from othertable where condition
Thank you.
Best regards.
Olaf
Mit freundlichen Grüßen / with best regards
Olaf Kluge
S A T R O N Sachsen
Steuerungstechnik GmbH
Johann-Gottlob-Pfaff Straße 7
D-09405 Zschopau
Tel: +49 (0) 3725 / 3506-31
Fax: +49 (0) 3725 / 3506-12
Mobil: +49 (0) 170 / 9292375
E-Mail: <blocked::mailto:olaf.kluge@...> olaf.kluge@...
Internet: <blocked::http://www.satron.de/> http://www.satron.de/
............................................................................
................
Geschäftsführer: Bernd Grötzschel, Gerd Kaden
Amtsgericht: Chemnitz HRB1218
Ust-ID-Nr: DE141294791
............................................................................
................
Diese E-Mail ist vertraulich. Wenn Sie nicht der beabsichtigte Empfänger
sind, dürfen Sie die Informationen nicht offen legen oder benutzen. Wenn Sie
diese E-Mail durch einen Fehler bekommen haben, teilen Sie uns dies bitte
mit, indem Sie die E-Mail an den Absender zurücksenden. Bitte löschen Sie
danach diese E-Mail.
This email is confidential. If you are not the intended recipient, you must
not disclose or use the information contained in it.
If you have received this mail in error, please tell us immediately by
return email and delete the document.
[Non-text portions of this message have been removed]