Subject Stored procedure, execute statement, & external tables
Author Rick Debay
When executing a stored procedure in Firebird 1.5 which calls EXECUTE
STATEMENT in order to select from an external table, I get this error:

Dynamic SQL Error
SQL error code = -206
Column unknown
BERGEN_PRICE_FILE_S_TST.DB_KEY
At line 3, column 32.

The field DB_KEY isn't in my procedure. The procedure was created from
an existing procedure which had to be dropped every time the external
file was dropped, thus the attempt to use EXECUTE STATEMENT. In case
the error is with that change, here's the difference between the two
procedures:

FOR EXECUTE STATEMENT 'SELECT
VENDOR_SKU,
LTRIM(UNIT_SIZE),
SIZE_CODE,
LTRIM(STRENGTH_QTY),
STRENGTH_CODE,
ITEM_DESCRIPTION,
CASE_QUANTITY,
PURCHASE_UNITS,
ACQUISITION,
NDDF_PKG_SIZE,
FINELINE,
NDC,
GENERIC_DESCRIPTION,
GENERIC_NUMBER,
THERAPEUTIC_CLASS,
GENERIC_FORM_CODE,
LTRIM(GENERIC_STRENGTH_QUANTITY),
GENERIC_STRENGTH_CODE,
UNIT_DOSE,
FORM_CODE,
CONTRACT_NUMBER,
CONTRACT_START,
CONTRACT_EXPIRE,
CONTRACT_PRICE,
VENDOR_NUMBER,
VENDOR_NAME,
NDDF_AWP,
PACKAGE_SIZE_DIVISOR,
SUPERNET_PRICE_INDICATOR,
AWP,
NDC_UPC_FORMAT_CODE,
RETAIL_PRICE,
SUBSTRING(LTRIM(RECORD_TYPE) FROM 1 FOR 1)
FROM EXTERN_FILE'
INTO
:VENDOR_SKU,
:UNIT_SIZE,
:SIZE_CODE,
:STRENGTH_QTY,
:STRENGTH_CODE,
:ITEM_DESCRIPTION,
:CASE_QUANTITY,
:PURCHASE_UNITS,
:T_ACQUISITION,
:T_NDDF_PKG_SIZE,
:FINELINE,
:NDC,
:GENERIC_DESCRIPTION,
:GENERIC_NUMBER,
:THERAPEUTIC_CLASS,
:GENERIC_FORM_CODE,
:GENERIC_STRENGTH_QUANTITY,
:GENERIC_STRENGTH_CODE,
:UNIT_DOSE,
:FORM_CODE,
:CONTRACT_NUMBER,
:T_CONTRACT_START,
:T_CONTRACT_EXPIRE,
:T_CONTRACT_PRICE,
:VENDOR_NUMBER,
:VENDOR_NAME,
:T_NDDF_AWP,
:T_PACKAGE_SIZE_DIVISOR,
:SUPERNET_PRICE_INDICATOR,
:T_AWP,
:NDC_UPC_FORMAT_CODE,
:T_RETAIL_PRICE,
:RECORD_TYPE
DO BEGIN

Disclaimer: This message (including attachments) is confidential and may be privileged. If you have received it by mistake please notify the sender by return e-mail and delete this message from your system. Any unauthorized use or dissemination of this message in whole or in part is strictly prohibited. Please note that e-mails are susceptible to change. RxStrategies, Inc. shall not be liable for the improper or incomplete transmission of the information contained in this communication or for any delay in its receipt or damage to your system. RxStrategies, Inc. does not guarantee that the integrity of this communication has been maintained nor that this communication is free from viruses, interceptions or interference.