Subject Can I use a select statement with an update or insert?
Author Felipe Marin Cypriano
Hello,

I'm trying to fill a global temporary table using the new update or
insert statement, when I try to execute this sql I get an error:

insert into TMP_RPT_NF_INVENTARIO(ID_PRODUTO, QT_ENTRADA)
select
I.ID_Produto, cast(SUM(coalesce(PCI.Quant_Metros, PCI.Quant_Kilos,
I.Quant)) as decimal(12,4)) as QtEntrada
-- sql ommited
This is the error:
Invalid token.
Dynamic SQL Error.
SQL error code = -104.
Token unknown - line 2, column 1.
Select.

If I use just a insert statement with a select it works just fine. But I
need the update or insert.

What I'm doing wrong? Why don't work?

Regards,
Felipe Cypriano



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