Subject Re: [firebird-support] insert from select in psql
Author W O
If the tables have always the same name you don't need the EXECUTE STATEMENT

Greetings.

Walter.



On Tue, Jul 30, 2013 at 2:39 AM, Nagy Szilveszter <
nagy_szilveszter@...> wrote:

> **
>
>
>
>
> I found a simple solution:
>
> EXECUTE STATEMENT 'insert into A select * from B';
>
> :D
>
> ________________________________
> From: Nagy Szilveszter <nagy_szilveszter@...>
> To: "firebird-support@yahoogroups.com" <firebird-support@yahoogroups.com>
> Sent: Tuesday, July 30, 2013 9:15 AM
> Subject: [firebird-support] insert from select in psql
>
>
>
>
> Hi all,
>
> i have a table A which contains user introduced data.
>
> I have an identical structured table B.
>
> I want to append all data from A into B at each end of month, and empty
> table A so it will be small and fast for operations...and from table B i do
> the reportings.
>
> In PSQL i cannot use something like this:
>
> INSERT INTO A SELECT * FROM B;
>
> It gives this error:
>
> An error was found in the application program input parameters for the SQL
> statement.
> Dynamic SQL Error.
> SQL error code = -804.
> Count of read-write columns does not equal count of values.
>
> Of course this is a restriction, because i cannot guarantee for my stored
> procedure that the tables will always have the same structure.
>
> The only way it works is to list all fields in the insert statement
> (INSERT INTO A VALUES (F1, F2, ...) SELECT F1, F2, ... FROM B;) but i'd
> like to have a simple way if it exists (because the table contains too many
> fields and they might change in the future - the only sure thing is that
> both tables will always have the same structure)
>
> Do you have a better way?
>
> Thanks,
> Szilvi
>
> [Non-text portions of this message have been removed]
>
> [Non-text portions of this message have been removed]
>
>
>


[Non-text portions of this message have been removed]