SelectStatement in a VarChar2: how to execute?

Hello Everyone
In my function I have a quite long algorithm. The code for this one is repeated 3 times since my function has a parameter where you can choose what kinds of data are put into the algorithm. So, in order to remove this redundant code I have a query-varchar which is different according to the choice.
My problem now is, that I dont know how to execute this and put the result in a "for x in <myresult>"
I found out about execute immediate but this one seems to have quite some restrictions and I dont have dynamic parameters.
Here is how it looks until now:
if choice = 1 then
query := 'select a, b, c from myTable where a = 1'
elsif choice = 2 then
query := 'select a, b, c from myTable where b = 5'
elsif choice = 3 then
query := 'select a, b, c from myTable where c = 3'
<result> = <execute query>
for x in (
<result>)
loop
do some stuff
end loop;
Is there a way to achieve this? Its very important for me, since it would make the code much easier to read and maintain.
regard
Marc

Hi maschlegel
I've worked on a similar problem in past. Here is some skeleton code:
DECLARE
v_FinalSQL varchar2(5000);
TYPE RefCurTyp IS REF CURSOR;
cQPRList RefCurTyp;
v_IsChronic varchar2(1);
v_DefRespID integer;
v_VehDefID integer;
BEGIN
v_FinalSQL := 'select x,y,z from ...';
OPEN cQPRList FOR v_FinalSQL;
LOOP FETCH cQPRList INTO v_DefRespID, v_VehDefID, v_IsChronic;
EXIT WHEN cQPRList%NOTFOUND;
DO SOME STUFF;
END LOOP;
CLOSE cQPRList;
END;
Hope this Helps
Taner Akbulut

Similar Messages

  • How to execute a script(.sql) file from a PL\SQL procedure

    I would like to know how to execute a .sql file from a stored procedure and the result of it should update a table. My .sql file contains select statements.

    Hi!
    just go through the following piece of code -
    SQL> ed
    Wrote file afiedt.buf
      1  declare
      2    str varchar2(200);
      3  begin
      4    str := '@C:\RND\Oracle\Misc\b.sql';
      5    execute immediate(str);
      6* end;
    SQL> /
    declare
    ERROR at line 1:
    ORA-00900: invalid SQL statement
    ORA-06512: at line 5ORA-00900: invalid SQL statement
    Cause: The statement is not recognized as a valid SQL statement. This error can occur if the Procedural Option is not installed and a SQL statement is issued that requires this option (for example, a CREATE PROCEDURE statement). You can determine if the Procedural Option is installed by starting SQL*Plus. If the PL/SQL banner is not displayed, then the option is not installed.
    Action: Correct the syntax or install the Procedural Option.
    Regards.
    Satyaki De.

  • How to execute .sql file in Stored Procedure?

    Hi,
    I have an urgent requirement, where i have to execute .sql file form Stored Procedure.
    This .sql file will have set of update statement. I need to pass value to this update statement.
    Kindly please help me.
    Regards,
    Irfan

    This is required as part of Data Migration where  i have to do 100 of table's update. Each time update table will defer, so its better to have in separate script file (.sql). Can u paste some sample/syntax to exceute .sql file from stored procedure. I am new to this PL/SQL.
    How have you determined that it's "better" to have seperate scripts?  I assume you mean the table name will "differ" (and not "defer" - I assume that's just because English isn't your first language? no problem - I think I understand what you're asking).
    So what I think you're asking is that you have dynamic table names but each table needs to be updated in the same way?
    Question: Why do you have tables with different names that all need the same process doing to them?
    Assuming it's a valid requirement (and 99% of the time doing dynamic coding implies it's not).... you could use dynamic code, rather than 'scripts'...
    e.g.
    create procedure update_table(tbl_name varchar2) is
    begin
      execute immediate 'update '||tbl_name||' set lastupdate = null';
    end;
    As you haven't bothered to provide a database version, any example code/data or explanation of what you're actually doing, you're not going to get any detailed answer.  Please do take the time to read the FAQ and post appropriate details so people can help you.

  • How to execute the parametered stored procedure in sql *plus ?

    how to execute the parametered stored procedure in sql *plus ?
    my storedprocedure format
    CREATE OR REPLACE PROCEDURE SMS_SELECTMPLOYEE
    (empDOB out date, empEmpName out varchar2)
    thanks & regards
    mk_mur

    Oh, sorry... making many reading-too-fast mistakes today...
    You can't declare date variables in SQL*Plus (seel help var), but you can cast to varchar2:
    TEST> CREATE OR REPLACE PROCEDURE SMS_SELECTMPLOYEE (empDOB out date, empEmpName out varchar2) IS
      2  d date := sysdate;
      3  e varchar2(10) := 'bob';
      4  begin
      5  empdob := d;
      6  empempname := e;
      7  end;
      8  /
    Procedure created.
    TEST> var d varchar2(30)
    TEST> var n varchar2(30)
    TEST> call  SMS_SELECTMPLOYEE(:d,:n);
    Call completed.
    TEST> print d n
    D
    11/07/06
    N
    bobYoann.

  • How to execute the content of varchar  variable like a simple query

    Hi everyone!
    I did a PL/SQL region in apex, in this region I did the query which is storaged in a variable; it was did it concatenate several times,
    in the procedure I have several sentences.
    I thought that the command 'execute immediate' would get a good result but it do not print the result.
    declare
    variable varchar2(1000);
    begin
    --sentences
    --execute inmmediate( variable );
    --return variable
    end;
    I only want to how to execute the content of varchar variable.
    For example, suppose that the result of this procedure is
    'SELECT SYSDATE FROM DUAL'
    How and what do I must do for this query execute like a normal query that is in apex?
    I expect your prompt reply.
    Thank you for your help.
    Best regards

    Let us say your table containing SQL is
    t_sql_table
    and has two columns
    primary_key
    and
    sql_query.
    You would need to do the following:
    1. Create a Report of type "Function returning SQL Query"
    2. Put the following there:
    DECLARE
       v_query   VARCHAR2 (4000);
    BEGIN
       SELECT sql_query
         INTO v_query
         FROM t_sql_table
        WHERE primary_key = 1;
       RETURN v_query;
    END;Denes Kubicek
    http://deneskubicek.blogspot.com/
    http://www.opal-consulting.de/training
    http://apex.oracle.com/pls/otn/f?p=31517:1
    -------------------------------------------------------------------

  • How to execute an sql function containing a SELECT query as paramete

    Hi
    I want to execute this sql query using JDBC methods , but could not be able to find any appropriate method to execute this query.
    select dbms_xmlgen.getxml(select * from departments) from dual
    please some one help with appropriate java code to execute it.
    Thank you

    >
    I want to execute this sql query using JDBC methods , but could not be able to find any appropriate method to execute this query.
    select dbms_xmlgen.getxml(select * from departments) from dual
    please some one help with appropriate java code to execute it.
    >
    Java code? You can't execute that query at all since it is invalid. The parameter needs to be a query string NOT a query.
    select dbms_xmlgen.getxml('select * from departments') from dual See the DBMS_XMLGEN package in the docs
    http://docs.oracle.com/cd/B28359_01/appdev.111/b28419/d_xmlgen.htm#i1013206
    >
    Converts the results from the SQL query string to XML format, and returns the XML as a temporary CLOB, which must be subsequently freed using the DBMS_LOB.FREETEMPORARY call:
    DBMS_XMLGEN.GETXML (
    sqlQuery IN VARCHAR2,
    dtdOrSchema IN number := NONE)
    RETURN CLOB;
    >
    Then you execute that query like any other query that returns a result set. The result set will consist of one row and one column of CLOB datatype.
    See the JDBC Developer's Guide - it has examples of how to execute queries that return result sets.
    And this section shows how tow read/write CLOBs
    http://docs.oracle.com/cd/B28359_01/java.111/b31224/oralob.htm#sthref755

  • Pl/sql function overload package program and how to execute

    --creation overload package
    create or replace package pkg_overload is
    procedure get_emp(p_empid in number,p_empsal out number);
    procedure get_emp(p_ename in varchar2, p_empsal out number);
    end;
    -- define its body
    create or replace package body pkg_overload is
    procedure get_emp(p_empid in number,p_empsal out number) is
    begin
    select sal
    into p_empsal
    from emp
    where empno=p_empid;
    end;
    procedure get_emp (p_ename in varchar2,p_empsal out number) is
    begin
    select sal
    into p_empsal
    from emp
    where ename=p_ename;
    end;
    end pkg_overload;
    /* output of this :PACKAGE pkg_overload compiled
    Warning: execution completed with warning
    -- My question is about the warning and how to execute it
    --I tried that way to execute that program
    /*variable g_sal number;
    execute pkg_overload.get_emp(77934,:g_sal);
    RESULT
    Error starting at line 911 in command:
    execute pkg_overload.get_emp(77934,:g_sal)
    Error report:
    ORA-06550: line 1, column 7:
    PLS-00905: object SUBHAJIT.PKG_OVERLOAD is invalid
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored
    06550. 00000 - "line %s, column %s:\n%s"
    *Cause:    Usually a PL/SQL compilation error.
    *Action:
    emp table code
    -- File created - Thursday-April-12-2012
    -- DDL for Table EMP
    CREATE TABLE "SUBHAJIT"."EMP"
    (     "EMPNO" NUMBER(4,0),
         "ENAME" VARCHAR2(10 BYTE),
         "JOB" VARCHAR2(9 BYTE),
         "MGR" NUMBER(4,0),
         "HIREDATE" DATE,
         "SAL" NUMBER(7,2),
         "COMM" NUMBER(7,2),
         "DEPTNO" NUMBER(2,0)
    ) SEGMENT CREATION IMMEDIATE
    PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
    STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
    PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
    TABLESPACE "USERS" ;
    REM INSERTING into SUBHAJIT.EMP
    Insert into SUBHAJIT.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values (7369,'SMITH','CLERK',7902,to_date('17-DEC-80','DD-MON-RR'),800,null,20);
    Insert into SUBHAJIT.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values (7499,'ALLEN','SALESMAN',7698,to_date('20-FEB-81','DD-MON-RR'),1600,300,30);
    Insert into SUBHAJIT.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values (7521,'WARD','SALESMAN',7698,to_date('22-FEB-81','DD-MON-RR'),1250,500,30);
    Insert into SUBHAJIT.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values (7566,'JONES','MANAGER',7839,to_date('02-APR-81','DD-MON-RR'),2975,null,20);
    Insert into SUBHAJIT.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values (7654,'MARTIN','SALESMAN',7698,to_date('28-SEP-81','DD-MON-RR'),1250,1400,30);
    Insert into SUBHAJIT.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values (7698,'BLAKE','MANAGER',7839,to_date('01-MAY-81','DD-MON-RR'),2850,null,30);
    Insert into SUBHAJIT.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values (7782,'CLARK','MANAGER',7839,to_date('09-JUN-81','DD-MON-RR'),2450,null,10);
    Insert into SUBHAJIT.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values (7788,'SCOTT','ANALYST',7566,to_date('09-DEC-82','DD-MON-RR'),3000,null,20);
    Insert into SUBHAJIT.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values (7839,'KING','PRESIDENT',null,to_date('17-NOV-81','DD-MON-RR'),5000,null,10);
    Insert into SUBHAJIT.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values (7844,'TURNER','SALESMAN',7698,to_date('08-SEP-81','DD-MON-RR'),1500,0,30);
    Insert into SUBHAJIT.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values (7876,'ADAMS','CLERK',7788,to_date('12-JAN-83','DD-MON-RR'),1100,null,20);
    Insert into SUBHAJIT.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values (7900,'JAMES','CLERK',7698,to_date('03-DEC-81','DD-MON-RR'),950,null,30);
    Insert into SUBHAJIT.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values (7902,'FORD','ANALYST',7566,to_date('03-DEC-81','DD-MON-RR'),3000,null,20);
    Insert into SUBHAJIT.EMP (EMPNO,ENAME,JOB,MGR,HIREDATE,SAL,COMM,DEPTNO) values (7934,'MILLER','CLERK',7782,to_date('23-JAN-82','DD-MON-RR'),1300,null,10);
    -- Constraints for Table EMP
    ALTER TABLE "SUBHAJIT"."EMP" MODIFY ("EMPNO" NOT NULL ENABLE);
    Edited by: 923746 on Apr 12, 2012 1:18 PM

    >
    Warning: execution completed with warning
    >
    The package compiled with warnings. Post the exact error message.
    The code compiled with no errors for me in the SCOTT schema using that EMP table.

  • How to execute function takes user defined type parameters as input &output

    Hi All,
    I want to execute a function which takes user defined type as input & output parameters. But i don't know how to execute that function in pl/sql statements.
    CREATE TYPE T_INPUT AS OBJECT
    USER          VARCHAR2(255),
    APPLICATION     VARCHAR2(255),
    REFERENCE          VARCHAR2(30)
    ) NOT FINAL;
    CREATE TYPE T_ID UNDER T_INPUT
    E_ID                    VARCHAR2 (50),
    CODE                    VARCHAR2 (3),
    SERVICE                    VARCHAR2 (10),
    C_TYPE                    VARCHAR2 (1)
    ) NOT FINAL;
    CREATE TYPE T_OUTPUT AS OBJECT
         R_STATUS               NUMBER(10),
         E_DESC_LANG_1          VARCHAR2(1000),
         E_DESC_LANG_2          VARCHAR2(1000),
         A_REFERENCE          VARCHAR2(30)
    ) NOT FINAL;
    CREATE TYPE T_INFO UNDER T_OUTPUT
    E_INFO XMLTYPE
    CREATE FUNCTION Get_Dtls
    I_DETAILS IN T_ID,
    O_DETAILS OUT T_INFO
    RETURN NUMBER AS
    END;
    Here
    1. T_ID is an input parameter which is a combination of T_ID + T_INPUT,
    2. T_INFO is an output parameter which is a combination of T_INFO + T_OUTPUT.
    Here i'll assign the T_ID values.
    --- T_INPUT values
    USER          = "admin";
    APPLICATION     = "test";
    REFERENCE     = "null";
    ---- T_ID values
    E_ID               = "1234";
    CODE               = "TTT";
    SERVICE               = "NEW";
    C_TYPE = "P";
    Now i want to execute Get_Dtls function with T_ID,T_INFO parameters in pl/sql statements.
    I want to catch the E_INFO value from T_INFO type.
    How can i Do this ?
    Pls Help. Thanxs in advance.
    Anil.

    I am very new to this. New to Oracle, PL/SQL, OO programming or testing?
    set serveroutput on
    declare
      tst_obj ctype;
    begin
      tst_obj := pkg.proc(11);
      dbms_output.put_line('id='||tst_obj.id||'::code='||tst_obj.code||'::usage='||tst_obj.usage);
    end;
    /Generally I disapprove of the use of DBMS_OUTPUT (for just about anything) but it is sufficient to demonstrate the basic principle.
    Really you should start using proper testing practices, ideally with an automated test harness like QUTE.
    Cheers, APC
    Blog : http://radiofreetooting.blogspot.com/

  • How to execute the content of varchar as query

    Hi everyone!
    I did a PL/SQL region in apex, in this region I did the query which is storaged in a variable; it was did it concatenate several times,
    in the procedure I have several sentences.
    I thought that the command 'execute immediate' would get a good result but it do not print the result.
    declare
    variable varchar2(1000);
    begin
    --sentences
    --execute inmmediate( variable );
    --return variable
    end;
    I only want to how to execute the content of varchar variable.
    For example, suppose that the result of this procedure is
    'SELECT SYSDATE FROM DUAL'
    How and what do I must do for this query execute like a normal query that is in apex?
    I expect your prompt reply.
    Thank you for your help.
    Best regards

    Erik,
    Try dropping this into a PL/SQL region
    DECLARE
      v_result VARCHAR2(500);
    BEGIN
      SELECT SYSDATE
        INTO v_result
        FROM DUAL;
      htp.prn(v_result);
    END;
    {code}
    use the htp.prn command to write html you want to display. In this case we are just writing the date to the screen.
    Good luck,
    Tyson                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • How to execute a SQL procedure in UNIX

    How to execute a SQL procedure in UNIX

    Check this out..
    -Sri
    << a.sql >>
    create or replace procedure junk(nout out varchar2) is
            x varchar2(20);
    begin
            select 'Sam' into x
            from dual;
            nout := x;
    end;
    << Shell script >>
    sqlplus -s / << DOC
    scott/tiger
    variable x varchar2(20);
    set autoprint on
    @a.sql
    begin
    junk(:x);
    end;
    exit
    DOC
    << Execution of Shell SCript >>
    # sh b.sh
    Procedure created.
    PL/SQL procedure successfully completed.
    X
    Sam

  • How to execute each block in a multi-block canvas while select the tab?

    Hi All,
    How to execute each block in a multi-block canvas by selecting a tab? I mean to say when i select a particular tab in a tab canvas the records should execute.How can i set this?
    Arif

    Hi Arif
    Good Example Manu offered i wish it works if not pls try the following...
    Pls try in the when-tab-page-changed trigger in the form level
    DECLARE
        tp_name varchar2(30);
    BEGIN
    -- Retrieve the NAME of the top most tab page using the built-in GET_CANVAS_PROPERTY function.
    --Pass in the name of the Canvas your tabs are in and the system variable topmost_tab_page which stores a property number
    tp_name := GET_CANVAS_PROPERTY('CANVAS11',topmost_tab_page);
    -- Perform specific tasks based on the name of the top most tab
    IF tp_name = 'PAGE12' then
    GO_BLOCK('block_name');
       GO_ITEM('DATA_BLOCK_1.FIELD_1');
    EXECUTE_QUERY;
    ELSIF tp_name = 'PAGE38' then
    GO_BLOCK('block_name');
       GO_ITEM('DATA_BLOCK_2.FIELD_1');
    EXECUTE_QUERY;
    ELSIF tp_name = 'PAGE47' then
    GO_BLOCK('block_name');
       GO_ITEM('DATA_BLOCK_3.FIELD_1');
    EXECUTE_QUERY;
    END IF;
    END;
    Hope it helps...
    Note: i do agree with Craig
    Regards,
    Abdetu...
    Edited by: Abdetu on Feb 2, 2011 7:41 AM

  • How to execute dynamic if statement...

    Hi All,
    My PL/SQL Blocks looks like this
    declare
    i_string :='if 3>20 then 1 else 2 end if;' varchar2(100);
    begin
    end;
    Between begin and end i want a piece of code which executes that if statement and sends 2 as output in dbms_output.put_line since 3 is not >20 .Basically i want to know how to execute dynamic if statement.Please help
    Thanks,
    Preethi

    Hi,
    i agree with Cyn. Dynamic SQL is often a bad idea. Try to avoid it.
    Dynamic PL/SQL is even worse. If you really must do something dynamic, at least try to cast it as SQL rather than PL/SQL.
    Does this do what you want?
    CREATE OR REPLACE FUNCTION     eval_case
    (     in_txt     IN     VARCHAR2
    RETURN     NUMBER
    DETERMINISTIC
    IS
         return_val     NUMBER;
         sql_txt          VARCHAR2 (1000);
    BEGIN
         sql_txt := 'SELECT  CASE '
              ||           in_txt
              || '         END'
              || '  FROM  dual';
         EXECUTE IMMEDIATE sql_txt INTO return_val;
         RETURN     return_val;
    END     eval_case;
    SHOW ERRORSYou might use the function above like this:
    declare
         i_string  varchar2(100) :='WHEN 3>20 THEN 1 ELSE 2';
    begin
         dbms_output.put_line (  TO_CHAR (eval_case (i_string))
                        || ' = results of eval_case ('''
                        || i_string
                        || ''')'
    end;
    /

  • How to execute stored procedure that returns a cursor?

    How to execute a stored procedure that returns a cursor?
    Follow the code:
    CREATE OR REPLACE PROCEDURE stp_cashin_grupo
    (p_func IN VARCHAR
    ,p_cod_grup IN Integer
    ,p_des_grup IN VARCHAR
    ,p_logi IN VARCHAR
    ,p_curs_rset OUT infoc.pck_cashin_grupo.curs_rset
    IS
    BEGIN
    if p_func = '1' then
    OPEN p_curs_rset FOR
    select
    cod_grup
    ,des_grup
    ,dat_manu_grup
    ,des_logi_manu
    from infoc.tbl_cashin_grupo
    order by des_grup;
    end if;
    END stp_cashin_grupo;
    and the package:
    CREATE OR REPLACE PACKAGE pck_cashin_grupo
    AS
    TYPE curs_rset IS REF CURSOR;
    END pck_cashin_grupo;
    My question is how to execute in sql plus?
    EXEC stp_cashin_grupo('1',0,'','465990', my doubt is how to pass the cursor as return
    Thanks

    my doubt is how to pass the cursor as returnExample :
    TEST@db102 > var c1 refcursor;
    TEST@db102 > create or replace procedure ref1 (
      2     v1 in varchar2,
      3     cur1 out sys_refcursor)
      4  is
      5  begin
      6     open cur1 for 'select * from '||v1;
      7  end;
      8  /
    Procedure created.
    TEST@db102 > exec ref1('dept',:c1);
    PL/SQL procedure successfully completed.
    TEST@db102 > print c1
        DEPTNO DNAME          LOC
            10 ACCOUNTING     NEW YORK
            20 RESEARCH       DALLAS
            30 SALES          CHICAGO
            40 OPERATIONS     BOSTON
    TEST@db102 >

  • How to execute a string formula and assign the result to a number field

    How to execute a string formula and assign the result to a number field
    Hi,
    we have a function that returns a string like this:
    '(45+22)*78/23'
    After we should calculate this string and assign the value to a numeric block field
    Example:
    k number(16,3);
    k:=fun1('(45+22)*78/23'); where fun1 execute and translate to number the string.
    Does exist a function like fun1 ??
    How can we do ?
    Regards

    Hello,
    this is the code that does the job:
    SQL> set serveroutput on
    SQL> DECLARE
    2 ch VARCHAR2(20) :='22+10' ;
    3 i NUMBER ;
    4 BEGIN
    5 EXECUTE IMMEDIATE 'select ' || ch || ' from dual' INTO i;
    6 dbms_output.put_line ('i = ' || TO_CHAR(i));
    7 END ;
    8 /
    i = 32
    Procédure PL/SQL terminée avec succès.
    SQL>
    just you have to do is to create a small stored function that take the string to calculate and return the number result
    Francois

  • How to execute a mapping or workflow in a job?

    hi all:
    I want to write a procedure use pl/sql,
    and how to execute mapping or workflow in procedure ?
    then I write a job use script ,the job schedule execute
    procedure.
    please give me a sample.

    Hi,
    You can write a procedure something on these lines -
    CREATE OR REPLACE PROCEDURE Test_Proc(p_task_name IN VARCHAR2, p_task_type IN VARCHAR2, p_loc IN VARCHAR2 ) AS
    lv_rt_code NUMBER(1) DEFAULT 0;
    lv_repo VARCHAR2(64) DEFAULT NULL;
    lv_loc VARCHAR2(64) DEFAULT 'LOC_EDW_PROCESS_FLOWS';
    lv_task_type VARCHAR2(64) DEFAULT 'PROCESS';
    lv_task_name VARCHAR2(64) DEFAULT 'ETL_FIXED_RATE';
    lv_sys_par VARCHAR2(64) DEFAULT ',';
    lv_cust_par VARCHAR2(64) DEFAULT ',';
    lv_oem NUMBER(1) DEFAULT 0;
    lv_fnc_call VARCHAR2(4000) DEFAULT NULL;
    BEGIN
         IF ( p_task_name IS NOT NULL AND p_task_type IS NOT NULL AND p_loc IS NOT NULL) THEN
         lv_task_name := p_task_name;
         lv_task_type := p_task_type;
         lv_loc := p_loc;
         END IF;
         SELECT Wb_Rt_Platform_Repository INTO lv_repo FROM dual;
    lv_fnc_call := 'BEGIN '
    ||':lv_rt_code'
    || ' := '
    || lv_repo
    ||'.fnc_exec_owb_process(p_repos_owner => :lv_repo'
    ||', p_location_name => :lv_loc'
    ||', p_task_type => :lv_task_type'
    ||', p_task_name => :lv_task_name'
    ||', p_system_params => :lv_sys_par'
    ||', p_custom_params => :lv_cust_par'
    ||', p_oem_friendly => :lv_oem'
              ||'); END;'
    --dbms_output.put_line(lv_fnc_call);
    EXECUTE IMMEDIATE lv_fnc_call USING OUT lv_rt_code, IN lv_repo, lv_loc, lv_task_type, lv_task_name, lv_sys_par, lv_cust_par, lv_oem;
    DBMS_OUTPUT.PUT_LINE('RETURN CODE IS '|| lv_rt_code);
    EXCEPTION
    WHEN OTHERS THEN
    dbms_output.put_line(SUBSTR(SQLERRM,1,255) );
    END;
    and use DBMS_JOB to schedule the above.
    HOpe this helps.
    Thanks
    Mahesh

Maybe you are looking for

  • Creating a package. How to include standatd PL/SQL procedure?

    Dear All, I need to create a job in oracle schema where in it should to do the following actions. 1. Refresh the Mat View Refresh group. 2. Execute a procedure immediately after the above refresh happens. Hence I tried to create a package to include

  • Default Native directory password for accessing openldap data

    hi everyone , i was trying to read openldap data from hyperion shared services . i know i can change the password in change native directory password for the root and i can read all the Ldap data. I was wondering if there is any default password for

  • Still having problems with opening iTunes. Any suggestions?

    I have already completely deleted iTunes, Quicktime, Apple update, and all others and tried to reinstall iTunes and Quicktime. I've tried to delete Quicktime and repair through iTunes and still the program won't work. I really need to get to my music

  • SSLVPN/webvpn in multiple context mode?

    We already know that ASA 9.0 supports site-to-site VPN in multiple context mode. But remote access VPN isn't supported. Obviously, SSL-VPN is a very important feature for most multi-tenant deployment scenarios where each context acts as a border fire

  • ADF Faces + BC 10.1.3: prompting to save changes after any navigation

    Hello all, Working on an application that uses ADF Faces + Business Components. We're using the PanelPage component and using a menu tree model bean specified in faces-config.xml for the menu1, menu2, and menu3 facets of the PanelPage. What we'd like