[oracle] ORA-01747: invalid user.table.column, table.column, or column specification

Get the above error when the execute immediate is called in a loop

Update CustomersPriceGroups set  1AO00=:disc  Where cuno=:cuno
    Parameters:   disc=66 cuno=000974
Update CustomersPriceGroups set  1AP00=:disc  Where cuno=:cuno
    Parameters:   disc=70.5 cuno=000974
Update CustomersPriceGroups set  1AQ00=:disc  Where cuno=:cuno
    Parameters:   disc=66 cuno=000974
Update CustomersPriceGroups set  1ZA00=:disc  Where cuno=:cuno
    Parameters:   disc=60 cuno=000974

What does this mean ?

Here is the code fragment

  fetch c into comno,cuno,nama,cpls;
  exit when c%notfound;
    fetch g into comno,cpgs,n;
    fetch d into comno,cpls,cuno,cpgs,stdt,tdat,qanp,disc,src;
    sQ:='Update saap.CustomersPriceGroups set "'|| trim(cpgs)||'"=:disc '
       || ' Where cuno=:cuno';
    execute immediate sQ using disc,cuno; 
    dbms_output.put_line( sQ );
    dbms_output.put_line( chr(9)||'Parameters:   disc='|| disc||' cuno='||cuno);
    exit when g%notfound;
  end loop;
  close g;
  close d;
end loop;

This question is related to oracle plsql dynamic-sql

The answer is

check your query for double comma.

insert into TABLE_NAME (COLUMN1, COLUMN2,,COLUMN3) values(1,2,3);

(there is extra comma after COLUMN2).

Update: recently (some people have special talents) i succeed to get same exception with new approach:

update TABLE_NAME set COLUMN1=7, set COLUMN2=8

(second SET is redundant)

Similar questions with oracle tag:

Similar questions with plsql tag:

Similar questions with dynamic-sql tag: