missing expression in oracle dynamic sql -
am trying print hierarchy information through store procedure. when execute simple statement able retrieve records. when running in loop using cursor, throwing missing expression.
declare --var1 varchar2(200):='''810011148'''; resutl1 varchar2(2000); v__rowid_party_child_fk varchar2(2000); v__rowid_party_parent_fk varchar2(2000); v_connectby_iscycle number; stm1 varchar2(2000); var1 varchar2(200) ; cursor c1 select distinct s_rowid_party_child_fk var1 c_rel_party_xref rownum <10; begin c2 in c1 loop stm1 := 'select * ( select level, s_rowid_party_child_fk , s_rowid_party_parent_fk ,connect_by_iscycle iscycle c_rel_party_xref start s_rowid_party_child_fk ='|| var1||' connect nocycle prior s_rowid_party_parent_fk=s_rowid_party_child_fk )a a.iscycle=1'; -- execute immediate stm1 ; execute immediate stm1 resutl1, v__rowid_party_child_fk,v__rowid_party_parent_fk , v_connectby_iscycle ; dbms_output.put_line(resutl1 || ','|| v__rowid_party_child_fk || ','|| v__rowid_party_parent_fk || ','|| v_connectby_iscycle); end loop; end;
thanks
should be:
cursor c1 select distinct s_rowid_party_child_fk c_rel_party_xref rownum <10;
and
begin c2 in c1 loop select * resutl1, v__rowid_party_child_fk,v__rowid_party_parent_fk , v_connectby_iscycle ( select level, s_rowid_party_child_fk , s_rowid_party_parent_fk ,connect_by_iscycle iscycle c_rel_party_xref start s_rowid_party_child_fk = c2.s_rowid_party_child_fk connect nocycle prior s_rowid_party_parent_fk=s_rowid_party_child_fk ) a.iscycle=1 ; dbms_output.put_line(resutl1 || ','|| v__rowid_party_child_fk || ','|| v__rowid_party_parent_fk || ','|| v_connectby_iscycle) end loop; end;
Comments
Post a Comment