oracle - CURSOR...IF...CURSOR..else condition -
i trying use cursor loop inside if condition , getting error. here details:
open c_tab_var v_sql; loop fetch c_tab_var v_cur_inv_var; exit when c_tab_var%notfound; v_cur_bde in ( select distinct bde.col1, bde.col2 tab bde order bde.col1, bde.col2, bde.col3.... ) loop if v_cur_bde.col1 = v_cur_inv_var.col1 , v_cur_bde.col2 = v_cur_inv_var.col2 ( v_cur_var in ( select..... ) loop - - - ) else ( - - - ) end if;
here error getting:
compilation errors procedure abc
error: pls-00103: encountered symbol "for" when expecting 1 of following:
( - + case mod new not null <an identifier> <a double-quoted delimited-identifier> <a bind variable> continue avg count current exists max min prior sql stddev sum variance execute forall merge time timestamp interval date <a string literal character set specification> <a number> <a single-quoted sql string> pipe <an alternatively-quoted string literal character set specification> <an alternative
line: 57 text: v_cur_var in
error: pls-00103: encountered symbol ")" when expecting 1 of following:
( begin case declare end exception exit goto if loop mod null pragma raise return select update while <an identifier> <a double-quoted delimited-identifier> <a bind variable> << continue close current delete fetch lock insert open rollback savepoint set sql execute commit forall merge pipe purge
line: 210 text: )
any appreciated!!!!
well, have tons of syntax errors. start 3 loops, there not 1 "end loop" in there instance.
the closest can without syntax errors this:
begin open c_tab_var v_sql;
loop fetch c_tab_var v_cur_inv_var;
exit when c_tab_var%notfound; v_cur_bde in ( select distinct bde.col1, bde.col2 tab bde order bde.col1, bde.col2, bde.col3) loop if v_cur_bde.col1 = v_cur_inv_var.col1 , v_cur_bde.col2 = v_cur_inv_var.col2 v_cur_var in (select 1 dual) --add select statement loop loop null; --do end loop; else null; -- else end if; end loop; end loop; end;
but without knowing context, it's impossible answer question
Comments
Post a Comment