plsql - Missing expression when using REF CURSOR with dynamic SQL in Oracle -


i trying execute stored procedure dynamic sql query. got compile, returns following error:

ora-00936 - missing expression

where did go wrong?

package spec:

type t_cursor ref cursor;  procedure radnik (   p_id_oc_najvisa in radnik.id_najvisa_oc%type, --1   p_ime_prezime in radnik.ime%type, --2   ref_tabela in varchar2, --3   p_id_operater in z_transakcija.id_operater%type,    p_cursor out t_cursor ); 

package body:

procedure radnik (   p_id_oc_najvisa in radnik.id_najvisa_oc%type,   p_ime_prezime in radnik.ime%type,   ref_tabela in varchar2,   p_id_operater in z_transakcija.id_operater%type,    p_cursor out t_cursor )   radnikred radnik%rowtype; begin    open p_cursor   'select *   (select distinct   r.id_radnik,   r.prezime || '' ('' || r.ime_roditelja || '') '' || r.ime || '', '' || r.licni_broj   ime_prezime   radnik r,   (     select distinct rt.id_radnik '||ref_tabela||' rt rt.id_oc_najvisa='||p_id_oc_najvisa||') rt          (r.id_najvisa_oc = '||p_id_oc_najvisa||' , r.storno=''n'') or r.id_radnik=rt.id_radnik)   ime_prezime ''%'' || '||p_ime_prezime||' || ''%''   or '||p_ime_prezime||' null';   loop     fetch p_cursor radnikred;  end loop;  close p_cursor;  end radnik; 

it not easy tell exactly, suspect parameter values.

  • it might value of parameter p_id_oc_najvisa. value passing there? looks expecting number there. if not, might problem. (what result of this: (r.id_najvisa_oc = '||p_id_oc_najvisa||' ?)
  • it might value of p_ime_prezime. how concatenate p_ime_prezime . varchar string or column name?

if p_ime_prezime string need instead of:

  ime_prezime ''%'' || '||p_ime_prezime||' || ''%''   or '||p_ime_prezime||' null'; 

rather this:

  ime_prezime ''%'||p_ime_prezime||'%''   or '''||p_ime_prezime||''' null'; 

Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -