I need to assign two variables(tmp_x and tmp_y) with dynamic sql, because I need to select the right table at runtime. the sql as below:
updateSql:= 'select p.gis_x,p.gis_y into tmp_x,tmp_y from publish_'
||splitCollection(indexs).city_no ||'.t_customer p
where p.customer_id=:1 and p.gis_x is not null and p.gis_y is not null';
execute immediate updateSql using splitCollection(indexs).CUSTOMER_ID;
the compilation is OK ,but occur the runtime error about "lack of keyword", how can I fix that?
SELECTstatement generated in the code appears to be an invalid SQL query. Instead of "execute immediate", export the statement as text (useDBMS_OUTPUT.PUT_LINE(updateSql)) and inspect it and/or try to run it. Do you get the same error? Post the exact stringupdateSqlhere for more help.returning intoclause. Remove that from the select statementinto tmp_x,tmp_yand add it like so:execute immediate updateSql using splitCollection(indexs).CUSTOMER_ID into tmp_x,tmp_y;.