我正在创建一个临时表,并从多个表中获取数据并将数据插入其中。当我尝试从表中取回数据时,出现错误:
Run Code Online (Sandbox Code Playgroud)[42601] ERROR: query has no destination for result data Hint: If you want to discard the results of a SELECT, use PERFORM instead.
do
$$
DECLARE
sampleproductId varchar;
productIds text[] := array [
'abc1',
'abc2'
];
tId varchar;
DECLARE result jsonb;
DECLARE resultS jsonb[];
begin
CREATE TEMP TABLE IF NOT EXISTS product_temp_mapping
(
accountid int,
productUID varchar,
sampleproductId text
);
FOREACH sampleproductId IN ARRAY productIds
LOOP
tId := (select id
from product.product
where uid = sampleproductId);
INSERT into product_temp_mapping …Run Code Online (Sandbox Code Playgroud)