Within IBExpert I'm looping over Dates within a "Master Procedure" and try to set the currently looped date as value within the "Date" Column of the Table I'm inserting into.
The Table I'm inserting into is very simple:
Table Name: FTE_TABLE
|---------------------|------------------|------------------|
| GESCHST | DATUM | FTE |
|---------------------|------------------|------------------|
| Integer | Date | Integer |
|---------------------|------------------|------------------|
I've tried numerous approaches. My understanding though is that it should look somewhat like this:
FOR EXECUTE STATEMENT
('
SELECT
geschst,
:XDATUM_FILTER as DATUM,
count(personalnr)
FROM personal
WHERE
eintritt1 is not null
and (austritt1 is null or austritt1 >= :XDATUM_FILTER)
GROUP BY geschst, DATUM
')
(XDATUM_FILTER := XDATUM_FILTER)
on external 'xxx'
as user 'xxx' password 'xxx'
into :XGESCHST, :XDATUM, :XFTE
do
begin
execute statement
('insert into FTE (GESCHST, DATUM, FTE_TABLE)
values
(:GESCHST, :DATUM, :FTE)
')
(GESCHST:= XGESCHST, DATUM := XDATUM, FTE:=XFTE)
on external 'xxx'
as user 'xxx' password 'xxx';
end
I get this Errormessage:
Error Message:
----------------------------------------
Unsuccessful execution caused by system error that does not preclude
successful execution of subsequent statements.
Execute statement error at isc_dsql_prepare :
335544569 : Dynamic SQL Error
335544436 : SQL error code = -804
335544573 : Data type unknown
The expected result would be that the the columns GESCHST and FTE are filled with the return values of the SELECT Statement while the DATUM Column in filled with the variable XDATUM_FILTER
Thanks in advance for any hints!