oracle - Error in dynamic SQL query. Missing expression with correct syntax -


i have problem working stored procedure on work.

it's stored procedure used several bigger procedures. procedure work called c, , ones call a , b.

the problem have when run a, goes smoothly, when run b, missing expression error, don't when call a, tough b , a have same flow of procedure calls (so, it's kind of weird error).

the c procedure has same code:

procedure c ( lo in varchar2,               en in varchar2,               ca in array1d,               ia in number,               ar in array2d )   cq varchar2(5);   et varchar2(2000);   ol varchar2(100);   ne varchar2(100);   te varchar2(100);   xu varchar2(100); begin   lo := '05';   te := 'var';   cq := '''';   ol := cq || lo || cq;   te := cq || te || cq;   ne := cq || en || cq;    et := 'par1 = ' || ca(1) || ',' ||         'par2 = ' || ca(2) || ',' ||         'par3 = ' || ca(3) || ',' ||         'par4 = ' || ca(4) || ',' ||         'par5 = ' || ca(5) || ',' ||         'par6 = ' || ca(6) || ',' ||         'par7 = ' || ca(7) || ',' ||         'par8 = ' || ca(8) || ',' ||         'par9 = ' || ca(9);    execute immediate 'update table_st set ' || et || '                       field1 = ' || ol || '                         , field2 = ' || ne || '                         , field3 = ' || te; end; 

the error missing expression, , seems appear on first line of execute immediate. after analysis, realized data 2d array initialized empty strings ''.

i wondering if me see error new perspective, because see it, there seems no syntax error justify missing expression error get, know may wrong. if further details needed, let me know.

at minimum, i'd variables lo, cq haven't been declared, , en , ca haven't been declared or initialized.

also, declared ne verchar2 when think meant varchar2.

i agree juan's observation may want double check line:

cq  := q'[']'; 

did mean:

cq  := q'['']'; 

honestly not sure, worth look.

oracle should tell if procedure compiles, , think these errors alone prevent doing that. if don't ever declare contents of en , ca, might still compile fail when runs.


Comments

Popular posts from this blog

java - Static nested class instance -

c# - Bluetooth LE CanUpdate Characteristic property -

JavaScript - Replace variable from string in all occurrences -