Friday, March 20, 2015

How to use Parameter in where clause of oracle cursor

An example of Dynamic where clause in Oracle Cursor

declare
    v_deptnos  varchar2(100) ;
    v_rc       sys_refcursor;
    v_dept_name varchar2(200);
     str_sql varchar2(200);
    begin
       v_deptnos := '10,20';
       str_sql:=' or dept_name=''Accounting'';
       open l_rc for 'select dept_name from dept where deptno in (' || v_deptnos || ')'||str_sql;
     loop
       fetch v_rc into v_dept_name;
       exit when v_rc%notfound;
       dbms_output.put_line(v_dept_name);
    end loop;
      close v_rc;
  end;

Sunday, March 8, 2015

Passing parameters to a procedure executed by Oracle DBMS_SCHEDULER


Passing parameters to a procedure executed by
Oracle DBMS_SCHEDULER



You should first create the job, then define the arguments, and then run it. When you create it, set the enabled attribute to false, so it won't run yet:

For Detail click here