How to use BYDATE to run a procedure on a given list of dates ..?

Hi all,
Our client has a meeting schedule and he needs a report prior to every meeting. He had sent us the meeting dates and my manager asked me to schedule a job in the database to run prior to his meeting so that we can get him the report on time. Now I have to schedule a job which should be executed on the dates he has given. I tried to configure the BYDATE parameter in dbms_scheduler.create_schedule but its giving me an error. My database is Oracle 10g R1 and OS is Solaris 9.
select * from V$version;
BANNER
Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - 64bi
PL/SQL Release 10.1.0.2.0 - Production
CORE 10.1.0.2.0 Production
TNS for Solaris: Version 10.1.0.2.0 - Production
NLSRTL Version 10.1.0.2.0 - Production
select PLATFORM_NAME from v$database;
PLATFORM_NAME
Solaris[tm] OE (64-bit)
BEGIN
dbms_scheduler.create_schedule (
          schedule_name => 'CLIENT_REPORT_JOB',
          repeat_interval => 'FREQ=DAILY;BYDATE=20080912,20080913',
comments => 'Client Report');
END;
ERROR at line 1:
ORA-27412: repeat interval contains invalid keyword: BYDATE
ORA-06512: at "SYS.DBMS_ISCHED", line 595
ORA-06512: at "SYS.DBMS_SCHEDULER", line 1045
ORA-06512: at line 2
Can someone help me, please...?
Thanks in advance.
Regards,
FlameThrower

Hi,
Many of the Scheduler Calendar enhancements were introduced in 10gR2. Since you are using 10gR1 you should check the Scheduler documentation for 10gR1 to see if BYDATE is supported in that release (I don't think it is).
If it isn't, as a workaround, you can use a PL/SQL date function which has the list of dates hardcoded in it and returns the next applicable date.
Hope this helps,
Ravi.

Similar Messages

  • How to use pool connection run oracle procedure?

    Hi, All:
              I am facing a difficulty I can not find the solution. Maybe you can help
              me.
              I want to call an oracle stored procedure whenever I talk to datebase to
              make the application more efficient. I was able to run the procedure using
              oracle thin driver but not the connection pool using Weblogic jDriver for
              JDBC2.0.
              Please check the following code and see what I did wrong:
              The code in JSP file in Weblogic:
              <%-- JSP page directive --%>
              <%@ page
              import="java.io.*,java.util.*,java.sql.*,weblogic.common.*,weblogic.jdbc20.c
              ommon.*" %>
              <%-- JSP Declaration --%>
              <%!
              protected Connection con = null;
              ResultSet rset = null;
              %>
              <%-- JSP Scriptlet --%>
              <% try {
              Properties props = new Properties();
              props.setProperty("user", "james");
              props.setProperty("password", "aimjames");
              Driver myDriver =
              (Driver) Class.forName
              ("weblogic.jdbc.pool.Driver").newInstance();
              con = myDriver.connect("jdbc:weblogic:pool:hdj2Pool", props);
              String userid = (String)session.getAttribute("user.id");
              int subid =
              Integer.parseInt((String)session.getAttribute("sub.id"));
              String query = "begin pkg_select.sel_req_in_001(" + userid +
              ", " + subid + ", ?); end;";
              weblogic.jdbc.common.OracleCallableStatement cstmt =
              (weblogic.jdbc.common.OracleCallableStatement)con.prepareCall(query);
              cstmt.registerOutParameter(1,java.sql.Types.OTHER);
              cstmt.execute();
              rset = cstmt.getResultSet(1);
              When I run this JSP file, the compilation is fine but the result shows
              nothing. That's means I can not get the ResultSet for some reason.
              The working file when I use oracle thin driver (NOT use a connection pool):
              String userid = (String)session.getAttribute("user.id");
              int subid = Integer.parseInt((String)session.getAttribute("sub.id"));
              String query = "begin pkg_select.sel_req_in_001(" + userid +", " +subid
              +", ?); end ";
              CallableStatement cstmt = con.prepareCall(query);
              cstmt.registerOutParameter(1,OracleTypes.CURSOR);
              cstmt.execute();
              ResultSet rset = (ResultSet)cstmt.getObject(1);
              You may notice that I am trying to bind a parameter to an Oracle cursor. Is
              there anything I did wrong in using weblogic API? I just want to let you
              that in the weblogic JSP file, I also tried to use
              weblogic.jdbc.oci.CallableStatement and
              weblogic.jdbc20.oci.CallableStatement instead of
              weblogic.jdbc.common.OracleCallableStatement, but none of them seems work.
              I did check the bea site at
              http://www.weblogic.com/docs51/classdocs/API_joci.html#1080420 for the
              example to use:
              cstmt.registerOutParameter(1,java.sql.Types.OTHER);
              and I think I followed the exact procedure the example did.
              Please help!
              James Lee
              Artificial Intelligence in Medicine, Inc.
              2 Berkeley Street, Suite 403
              Toronto, Ontario M5A 2W3
              Tel: 416-594-9393 ext. 223
              Fax: 416-594-2420
              Email: [email protected]
              

    Joseph
    Thanks for the suggestion about latest version of Weblogic Server.
    "coding best-practices" is not mentioned in the post.
    In order to make servlet application run significantly faster, my servet how to use connection poo is much moreresonable?
    It is reasonable to expect servlet to run significantly faster with connection pooling.
    Is it true that geting and close a connection whenever
    one time database access finished?
    Already answered. Applications use a connection from the pool then return it when finished using the connection.
    Will the solution affect the servlet performance?
    Yes. Already answered. Connection pooling enhances performance by eliminating the costly task of creating database connections for the application.
    Is there any official document to introduce connection pool program?
    For the latest version
    http://download.oracle.com/docs/cd/E17904_01/web.1111/e13726/toc.htm
    http://download.oracle.com/docs/cd/E17904_01/web.1111/e13737/jdbc_datasources.htm#insertedID0

  • How to use bind variables in this procedure

    Hi Experts,
    How to use bind variables in this procedure for static queries.
    PROCEDURE DELETE_MER_PROC (M_id IN NUMBER)
    IS
    BEGIN
    V_date DATE;
    SELECT PD_DATE INTO v_date FROM PD_MAINTAIN;
        DELETE FROM MER_CLEAR
        WHERE MER_DT < v_date
        AND ID = M_ID;
    COMMIT;
    END;   
    How to use  v_date and m_id as bind variables in this procedure to avoid hard parsing.
    Please help me.
    Thanks.

    976208 wrote:
    How to use  v_date and m_id as bind variables in this procedure to avoid hard parsing.
    You cannot avoid hard parsing - as the 1st time a SQL statement (like the SELECT or DELETE statements in your code) is encountered, it does not reside in the server's Shared Pool, and needs to be added into the pool via a hard parse.
    Bind variables does not prevent hard parsing. Hard parsing happens when the SQL statement (with or without bind variables) is a brand new statement encountered by the server.
    Bind variables enables the same SQL cursor to be reused, by simply changing the bind variable value.
    Not using bind variables means that each SQL statement is unique and not shareable - as the value is hardcoded into the statement and cannot be changed via a bind value. This typically means LOTS of different SQL statements (where the only difference is the changed value in the statement) are created - with each statement being a new statement not seen before in the Shared Pool and needing to be hard parsed.
    One does not design one's code not to be hard parsed. There ALWAYS will be a hard parse in order to get a SQL statement into the Shared Pool. One designs one's code to REUSE cursors in the Shared Pool.

  • How to use order by in stored procedure base block?

    How to use order by in stored procedure base block? I need to change order by dynamically

    Use SET_BLOCK_PROPERTY('BLOCK_NAME',ORDER_BY,'COLUMN_NAME1, COLUMN_NAME2');

  • In SQLScript, how to use EXEC to call another procedure with parameters in procedure?

    Hi experts,
    In SQLScript, How to use EXEC to call another procedure with input and output parameters in procedure?thanks very much

    Hi Sagar,
    thank you! I generate another procedure with an input parameter and an output parameter in a procedure. Then i need to call the generated procedure using EXEC. Here is my code:
    create procedure ftest1(out sum_num bigint)
    as
    begin
    declare fa_output bigint;
    declare v_sql_drop varchar(200);
    declare v_sql varchar(500);
    declare cursor c_cursor1 for select num from TABLE1;
    --v_sql_drop := 'drop procedure fe';
    --exec v_sql_drop;
    v_sql := 'create procedure fe(in i_num bigint,out o_num bigint) as begin';
    v_sql := :v_sql || ' o_num := :i_num * 2 + :i_num * :i_num;';
    v_sql := :v_sql || ' end';
    exec v_sql;
    open c_cursor1;
    for c_item as c_cursor1 do
    exec 'call fe(c_item.num,o_num=>fa_output)';
    if sum_num is null then
    sum_num := fa_output;
    else
    sum_num := :sum_num + fa_output;
    end if;
    end for;
    close c_cursor1;
    end;
    The underline code is using exec to call the generated procedure. But this method cannot work. Any suggestion? thanks again!

  • How to use @jws:sql call Stored Procedure from Workshop

    Is there anyone know how to use @jws tag call Sybase stored procedure within
    Workshop,
    Thanks,

    Anurag,
    Do you know is there any plan to add this feature in future release? and
    when?
    Thanks,
    David
    "Anurag Pareek" <[email protected]> wrote in message
    news:[email protected]..
    David,
    In the current release, we do not support calling stored procedures from a
    database control. You will have to write JDBC code in the JWS file to call
    stored procedures.
    Regards,
    Anurag
    Workshop Support
    "David Yuan" <[email protected]> wrote in message
    news:[email protected]..
    Anurag,
    I know how to use DB connection pool and create a db control with it. In
    fact, we have created a Web Service with the db control using plain SQL
    in
    @jws:sql. However, my question here is how to use @jws tag in Weblogic
    Workshop to create a Web Services based on Sybase stored procedure orany
    Stored Proc not plain SQL.
    Thanks,
    David
    "Anurag Pareek" <[email protected]> wrote in message
    news:[email protected]..
    David,
    You can use a database control to obtain a connection from any JDBC
    Connection Pool configured in the config.xml file. The JDBC Connectionpool
    could be connecting to any database, the database control is
    independent
    of
    that.
    Regards,
    Anurag
    Workshop Support
    "David Yuan" <[email protected]> wrote in message
    news:[email protected]..
    Is there anyone know how to use @jws tag call Sybase stored
    procedure
    within
    Workshop,
    Thanks,

  • How to use ICROleObject to run SetOleLocation

    I am trying to located what library ICROleObject is found in.  I want to use SetOleLocation to send a Word Document or an Excel Spreadsheet to a report section.
    I have found an example on Business Objects DevLibrary:
    http://devlibrary.businessobjects.com/BusinessObjectsXIR2SP2/en/devsuite.htm
    cOLEObj.SetOleLocation App.Path & "\res\SampleExcel1.xls"
    cOLEObj.Height = 1800
    cOLEObj.Width = 5791
    But I cannot find any information on how to declare or use the   cOLEObj
    After googling, I found that it should be declared as   ICROleObject
    I cannot find this Interface in any of the libraries.   I cannot find any documentation how to use this.
    Can anyone please give me an example or point me where to find how to add a OLE Object into a Report. 
    This must be done in .Net, not in the designer.  I am dynamically adding sections and objects into this report,
    so it must be dynamically added into a section.
    To add a picture, I am using this and it works great, but I also need to be able to add Word Docs and PDF's into a report
    boPictureObject = boReportClientDocument.ReportDefController.ReportObjectController.ImportPicture( _
    strImportFileName, boSection, 1, 1)
    Thank you,
    Jeff

    After talking with a Crystal Support tech, it turns out this feature does not work.  It sure would be nice if they got this working.
    Jeff

  • How to use materialized view in stored procedure

    in my stored procedure I use couple of queries (see the script below). I want to create materialized views to replace these queries. Is it possible to achieve and how to achieve it in my case? thanks in advance
    set serveroutput on
    DECLARE
      v_cur_tid NUMBER(5):=0;
      v_cur_cs_attendance NUMBER(5):=0;
      v_cur_c_tot_enrolments NUMBER(5):=0;
      v_most_enrolments NUMBER(5):=0;
      v_least_enrolments NUMBER(5):=0;
      v_most_pop_cid NUMBER(5):=0;
      v_least_pop_cid NUMBER(5):=0;
      CURSOR class_cursor IS
    select
    id,
    name,
    max_attendees
    from
    class
    where
    id in (select distinct(event_id) from trainer_schedule where event_type='c' and is_active='y')
    order by id;
    BEGIN
    DBMS_OUTPUT.PUT_LINE('==================================================================================================================================');
    --print the report header
    DBMS_OUTPUT.PUT_LINE('Summary Report No.3: Training Class Active Schedules Summary Report');
    FOR r_class IN class_cursor LOOP
    --print the header or subsection
    select sum(enrolments) into v_cur_c_tot_enrolments from class_schedule where class_id = r_class.id;
    IF v_most_enrolments < v_cur_c_tot_enrolments OR v_most_enrolments = 0
    THEN v_most_enrolments := v_cur_c_tot_enrolments; v_most_pop_cid := r_class.id;
    END IF;
    IF v_least_enrolments > v_cur_c_tot_enrolments OR v_least_enrolments = 0
    THEN v_least_enrolments := v_cur_c_tot_enrolments; v_least_pop_cid := r_class.id;
    END IF;
    DBMS_OUTPUT.PUT_LINE('******************************************************************************************');
    DBMS_OUTPUT.PUT_LINE('CLASS_ID: '  || r_class.id ||'     '|| 'CLASS_NAME: '  || r_class.name ||'     '||'CAPACITY: '  || r_class.max_attendees ||'     '||'TOTAL_ENROLMENTS: '  || v_cur_c_tot_enrolments);
    DBMS_OUTPUT.PUT_LINE(rpad('____________', 12) || lpad('____________', 12) || lpad('____________________', 20) || lpad('____________________', 20) || lpad('____________',12) || lpad('____________',12));
    DBMS_OUTPUT.PUT_LINE(rpad('SCHEDULE_ID', 12) || lpad('TRAINER_ID',12) || lpad('START_TIME', 20) || lpad('END_TIME',20) || lpad('ENROLMENTS',12) || lpad('ATTENDANCE',12));
    DBMS_OUTPUT.PUT_LINE(rpad('____________', 12) || lpad('____________',12) || lpad('____________________', 20) || lpad('____________________', 20) || lpad('____________',12) || lpad('____________',12));
    FOR r_cs IN (select id,to_char(start_time,'DD-MM-YYYY HH24:Mi') as start_time, to_char(end_time,'DD-MM-YYYY HH24:Mi') as end_time, enrolments from class_schedule where class_id = r_class.id order by id)
    LOOP
    select trainer_id into v_cur_tid from trainer_schedule where event_type='c' and event_id = r_cs.id;
    select count(training_session.id) into v_cur_cs_attendance
    from training_session, class_schedule
    where training_session.attended = 'y' and
    training_session.type='c'and
    to_char(training_session.start_time,'DD-MM-YYYY HH24:Mi') = to_char(class_schedule.start_time,'DD-MM-YYYY HH24:Mi') and
    class_schedule.id = r_cs.id;
    DBMS_OUTPUT.PUT_LINE(rpad(r_cs.id, 12) || lpad(v_cur_tid,12) || lpad(r_cs.start_time, 20) || lpad(r_cs.end_time,20) || lpad(r_cs.enrolments,12) || lpad(v_cur_cs_attendance,12));
    END LOOP;
    END LOOP;
    DBMS_OUTPUT.PUT_LINE('******************************************************************************************');
    DBMS_OUTPUT.PUT_LINE('******************************************************************************************');
    DBMS_OUTPUT.PUT_LINE('MOST_POPULAR_CLASS:  '||v_most_pop_cid||'      TOTAL_ENROLMENTS_TO_DATE: '||v_most_enrolments);
    DBMS_OUTPUT.PUT_LINE('LEAST_POPULAR_CLASS: '||v_least_pop_cid||'      TOTAL_ENROLMENTS_TO_DATE: '||v_least_enrolments);
    DBMS_OUTPUT.PUT_LINE('==================================================================================================================================');
    END;
    /

    Hi,
    you could use Dynamic SQL /Execute immediate to run DDL from a stored procedure.
    http://download-uk.oracle.com/docs/cd/B10501_01/appdev.920/a96624/11_dynam.htm
    Could you please tell why do you want to create a materialized view in stored procedure ?
    How frequently you will runt this procedure . It would is better to create a MV once and use it.
    thanks

  • How to use DBMS_JOB to run the OWB scripts?

    Can anyone pls explain how I can use the DBMS_JOB to run the scripts which are generated by OWB.
    Suroop

    CREATE OR REPLACE PACKAGE "LOAD_DATAMART"
    AS
    TYPE t_global IS RECORD
    ( plsql_map VARCHAR2(50) := 'transactions_map_exp', -- Default mapping plsql program
    plsql_map_main VARCHAR2(50) := 'transactions_map_exp.main', -- Default mapping plsql main program
    servers NUMBER(2) := 19, -- Default concurrent loading servers
    max_reloads NUMBER(3) := 3 , -- Default maximum load retrys
    mail_sender VARCHAR2(99) := '"Certegy Data Warehouse"', -- Default Mail Sender
    mail_notice VARCHAR2(99) := '[email protected]', -- Default Recepient Notification
    mail_error VARCHAR2(99) := '[email protected]' -- Default Recepient for Errors.
    GLOBAL t_global ;
    PROCEDURE start_monitor_load(p_date IN DATE);
    PROCEDURE monitor_load( p_date IN DATE , p_dwh_load# IN NUMBER DEFAULT NULL, p_servers IN NUMBER DEFAULT GLOBAL.servers );
    PROCEDURE start_load(p_dwh_load# IN NUMBER, p_load_seq IN NUMBER, p_rbs IN VARCHAR2);
    PROCEDURE create_job_load(p_dwh_load# IN NUMBER, p_load_seq IN NUMBER, p_rbs VARCHAR2 DEFAULT 'batch01_rbs' );
    FUNCTION dependency_on(p_type IN VARCHAR2, p_date IN DATE) RETURN BOOLEAN;
    PROCEDURE send_mail (p_sender IN VARCHAR2, p_recipient IN VARCHAR2, p_subject IN VARCHAR2, p_message IN VARCHAR2);
    PROCEDURE start_load_guard;
    PROCEDURE load_guard(p_job IN INTEGER);
    END load_datamart;
    CREATE OR REPLACE PACKAGE BODY "LOAD_DATAMART"
    AS
    PROCEDURE start_monitor_load(p_date IN DATE) IS
    v_plsql VARCHAR2(32000);
    BEGIN
    v_plsql := 'load_datamart.monitor_load(to_date('''||TO_CHAR(p_date,'DD-MON-YYYY HH24:MI:SS')||''',''DD-MON-YYYY HH24:MI:SS''));';
    EXECUTE IMMEDIATE 'declare v_job integer; begin dbms_job.submit(v_job,:v_plsql); end;'
    USING v_plsql;
    END start_monitor_load;
    PROCEDURE monitor_load( p_date IN DATE, p_dwh_load# IN NUMBER DEFAULT NULL , p_servers IN NUMBER DEFAULT GLOBAL.servers ) IS
    TYPE t_server IS TABLE OF NUMBER INDEX BY BINARY_INTEGER;
    v_server t_server;
    v_dwh_load# NUMBER;
    v_reload_limit NUMBER := 0;
    v_plsql_error VARCHAR2(32000);
    pending_jobs BOOLEAN;
    p_batch VARCHAR2(20) := 'batch01_rbs';
    FUNCTION job_server_running(p_dwh_load_seq NUMBER) RETURN BOOLEAN IS
    CURSOR c1 IS SELECT * FROM DWH_LOAD_DETAIL
    WHERE dwh_load# = v_dwh_load#
    AND load_seq = p_dwh_load_seq;
    r1 c1%ROWTYPE;
    PROCEDURE try_resubmit_job(p_dwh_load_seq OUT NUMBER) IS
    v_load_seq NUMBER;
    BEGIN
    SELECT COUNT(*) INTO v_load_seq
    FROM DWH_LOAD_DETAIL
    WHERE dwh_load# = v_dwh_Load#;
    IF v_load_seq < v_reload_limit THEN
    INSERT INTO DWH_LOAD_DETAIL(dwh_load#,load_seq,load_server,plsql_map,map_parameters)
    VALUES(v_dwh_load#,v_load_seq+1,0,r1.plsql_map,r1.map_parameters||'| SEQ '||v_load_seq);
    COMMIT;
                   ELSE
                   RAISE_APPLICATION_ERROR(-20000,'Maximum '||v_reload_limit||' retrys reached, load aborted.');
    END IF;
    END;
    BEGIN
    OPEN c1;
    FETCH c1 INTO r1;
    IF c1%NOTFOUND THEN
    RETURN FALSE;
    ELSIF c1%FOUND AND r1.job_end_time IS NULL THEN
    RETURN TRUE;
    ELSIF c1%FOUND AND r1.job_end_time IS NOT NULL THEN
    IF r1.job_end_time = 'BROKEN' THEN
    try_resubmit_job(r1.load_seq); -- Oracle Errors
    END IF;
    RETURN FALSE;
    END IF;
    CLOSE c1;
    END job_server_running;
    FUNCTION get_next_load_seq(p_dwh_load_server IN NUMBER) RETURN NUMBER IS
    CURSOR c1 IS SELECT * FROM DWH_LOAD_DETAIL
    WHERE dwh_load# = v_dwh_load#
    AND load_server = 0
    ORDER BY dwh_load#,load_seq
    FOR UPDATE OF load_server;
    r1 c1%ROWTYPE;
    BEGIN
    OPEN c1;
    FETCH c1 INTO r1;
    IF c1%FOUND THEN
    UPDATE DWH_LOAD_DETAIL
    SET load_server = p_dwh_load_server
    WHERE CURRENT OF c1;
    END IF;
    CLOSE c1;
    COMMIT;
    RETURN r1.load_seq;
    END get_next_load_seq;
    BEGIN
    v_dwh_load# := p_dwh_load#;
    -- Defining the Max Retry to load
    SELECT COUNT(*) + GLOBAL.max_reloads INTO v_reload_limit
    FROM DWH_LOAD_DETAIL
    WHERE dwh_load# = v_dwh_load#;
    FOR i IN 1..99 LOOP
    v_server(i) := NULL;
    END LOOP;
    LOOP
    pending_jobs := FALSE;
    FOR i IN 1..p_servers LOOP
    IF NOT job_server_running(v_server(i)) THEN
    v_server(i) := get_next_load_seq(i);
    IF v_server(i) IS NOT NULL THEN
    load_datamart.create_job_load(v_dwh_load#,v_server(i),p_batch);
    IF p_batch = 'batch01_rbs' THEN
    p_batch :='batch02_rbs';
    ELSIF p_batch = 'batch02_rbs' THEN
    p_batch :='batch03_rbs';
    ELSIF p_batch = 'batch03_rbs' THEN
    p_batch :='batch01_rbs';
    END IF;
    END IF;
    END IF;
    IF v_server(i) IS NOT NULL THEN
    pending_jobs := TRUE;
    END IF;
    END LOOP;
    EXIT WHEN NOT pending_jobs;
    dbms_lock.sleep(05);
    END LOOP;
    COMMIT;
    UPDATE DWH_LOAD_HEADER
    SET plsql_error = 'Completed'
    WHERE dwh_load# = v_dwh_load#;
    COMMIT;
    EXCEPTION WHEN OTHERS THEN
    v_plsql_error := SUBSTR(SQLERRM,1,4000);
    load_datamart.send_mail(load_datamart.GLOBAL.mail_sender,load_datamart.GLOBAL.mail_error,
    'Load Datamart - Load '||TO_CHAR(p_date,'MM/DD/YYYY HH24:MI:SS')||' not completed',
    v_plsql_error||CHR(10)||
    ':::::::::::::::::::::::::::::::::::::::::'||CHR(13)||
    '- Parameter Date '||TO_CHAR(p_date,'MM/DD/YYYY')||CHR(13)||
    ':::::::::::::::::::::::::::::::::::::::::'||CHR(13)||
    '- Transmission time '||TO_CHAR(p_date,'hh24:mi:ss')||CHR(13)||
    '- Load Seq# '||TO_CHAR(v_dwh_load#)||CHR(13)||
    ':::::::::::::::::::::::::::::::::::::::::'||CHR(13));
    v_plsql_error := SUBSTR(SQLERRM,1,4000);
    UPDATE DWH_LOAD_HEADER
    SET plsql_error = v_plsql_error
    WHERE dwh_load# = v_dwh_load#;
    COMMIT;
                        RAISE_APPLICATION_ERROR(-20000,v_plsql_error);
    END monitor_load;
    PROCEDURE start_load(p_dwh_load# IN NUMBER, p_load_seq IN NUMBER, p_rbs IN VARCHAR2) IS
    v_plsql_map VARCHAR2(200);
    v_sqlerrm VARCHAR2(4000);
    BEGIN
    UPDATE DWH_LOAD_DETAIL
    SET job_start_date = TRUNC(SYSDATE) ,
    job_start_time = TO_CHAR(SYSDATE,'HH24:MI:SS')
    WHERE dwh_load# = p_dwh_load#
    AND load_seq = p_load_seq
    RETURN plsql_map INTO v_plsql_map;
    COMMIT;
    EXECUTE IMMEDIATE 'set transaction use rollback segment '||p_rbs;
    v_plsql_map := 'begin '||v_plsql_map||' end;';
    EXECUTE IMMEDIATE v_plsql_map;
    EXECUTE IMMEDIATE 'begin
    UPDATE DWH_LOAD_DETAIL
    SET job_end_date = SYSDATE,
    job_end_time = TO_CHAR(SYSDATE,''HH24:MI:SS''),
    rta_iid = '||global.plsql_map||'.get_runtime_audit_id,
    rta_select = '||global.plsql_map||'.get_selected,
    rta_update = '||global.plsql_map||'.get_updated,
    rta_insert = '||global.plsql_map||'.get_inserted,
    rta_errors = '||global.plsql_map||'.get_errors,
    rta_delete = '||global.plsql_map||'.get_deleted
    WHERE dwh_load# = :p_dwh_load#
    AND load_seq = :p_load_seq;
    UPDATE DWH_LOAD_HEADER
    SET rows_inserted = NVL(rows_inserted,0) + NVL('||global.plsql_map||'.get_inserted,0)
    WHERE dwh_load# = :p_dwh_load#;
    END;' using p_dwh_Load#,p_load_seq;
    COMMIT;
    EXCEPTION WHEN OTHERS THEN
    v_sqlerrm := SUBSTR(SQLERRM,1,3999);
    EXECUTE IMMEDIATE ' begin
    UPDATE DWH_LOAD_DETAIL
    SET job_end_date = SYSDATE,
    job_end_time = ''BROKEN'',
    rta_iid = '||global.plsql_map||'.get_runtime_audit_id,
    rta_select = '||global.plsql_map||'.get_selected,
    rta_update = '||global.plsql_map||'.get_updated,
    rta_insert = '||global.plsql_map||'.get_inserted,
    rta_errors = '||global.plsql_map||'.get_errors,
    rta_delete = '||global.plsql_map||'.get_deleted,
    plsql_error = :v_sqlerrm
    WHERE dwh_load# = :p_dwh_load#
    AND load_seq = :p_load_seq;
    UPDATE DWH_LOAD_HEADER
    SET rows_inserted = NVL(rows_inserted,0) + NVL('||global.plsql_map||'.get_inserted,0)
    WHERE dwh_load# = :p_dwh_load#;
    END; ' using v_sqlerrm, p_dwh_load#,p_load_seq;
    COMMIT;
    END start_load;
    PROCEDURE create_job_load(p_dwh_load# IN NUMBER, p_load_seq IN NUMBER, p_rbs VARCHAR2 DEFAULT 'batch01_rbs' ) IS
    p_job INTEGER;
    v_date DATE;
    BEGIN
    -- Submitting Job Load
    DBMS_JOB.SUBMIT(p_job,'load_datamart.start_load('||p_dwh_load#||','||p_load_seq||','||''''||p_rbs||''');');
    COMMIT;
    END create_job_load;
    FUNCTION dependency_on(p_type IN VARCHAR2, p_date IN DATE) RETURN BOOLEAN IS
    CURSOR c1 IS SELECT * FROM DWH_DATA_LOADS
    WHERE data_type = p_type
    AND file_date >= TRUNC(p_date);
    r1 c1%ROWTYPE;
    BEGIN
    OPEN c1;
    FETCH c1 INTO r1;
    IF c1%FOUND AND r1.status = 'Done' THEN
    RETURN FALSE;
    END IF;
    CLOSE c1;
    RETURN TRUE;
    END;
    PROCEDURE send_mail (p_sender IN VARCHAR2,
    p_recipient IN VARCHAR2,
    p_subject IN VARCHAR2,
    p_message IN VARCHAR2) IS
    * This procedure is usefull for sending e-mails for single or multiples recipients up to 50 *
    * the limitation is Lotes Notes e-mail service. *
    * Lewis Cunnigham Package is good also for massive distribuition to multiples e-mails, *
    v_mailhost VARCHAR2(30) := '172.27.2.157'; -- Titan and Eagle available SMTP service, through the GATEWAY
    v_mailhost    VARCHAR2(30) := 'STPMTA1ML';      old one
    v_mailhost    VARCHAR2(30) := 'stpnh1ml';       Main SMTP, all other are replicated, not available.
    v_mailhost    VARCHAR2(30) := 'STPMS6ML';       Replicated server, not available.
    v_mail_conn utl_smtp.connection;
    v_crlf VARCHAR2(2) DEFAULT CHR(13)||CHR(10);
    v_date VARCHAR2(255) DEFAULT TO_CHAR( SYSDATE, 'MM/DD/YYYY hh24:mi AM' ); -- Lotus Notes default format.
    --pragma autonomous_transaction;
    PROCEDURE writeData( p_text IN VARCHAR2 ) AS
    BEGIN
    IF ( p_text IS NOT NULL ) THEN
    utl_smtp.write_data( v_mail_conn, p_text || v_crlf );
    END IF;
    END;
    BEGIN
    v_mail_conn := utl_smtp.open_connection(v_mailhost, 25); -- Default port
    utl_smtp.helo(v_mail_conn, v_mailhost);
    utl_smtp.mail(v_mail_conn, p_sender);
    utl_smtp.rcpt(v_mail_conn, p_recipient);
    utl_smtp.open_data(v_mail_conn);
    writeData( 'To: '|| p_recipient ); -- Redundant, but necessary to complete format
    writeData( 'From: ' || p_sender); -- Redundant, but necessary to complete format
    writeData( 'Date: ' || v_date ); -- Database completion time
    writeData( 'Subject: ' || NVL( p_subject , '(no subject) ' ) ); -- Default Subject
         --writeData( 'Content-Type: text/html');
    utl_smtp.write_data(v_mail_conn, '' || v_crlf );
    utl_smtp.write_data(v_mail_conn, p_message ); -- Message body
    utl_smtp.close_data(v_mail_conn );
    utl_smtp.quit(v_mail_conn);
    --commit;
    EXCEPTION WHEN OTHERS THEN null;                                Since we are just sending e-mails,
    -- We don't care about mail errors like when server down, only when needed.
    END;
    PROCEDURE start_load_guard IS
    v_job INTEGER;
    BEGIN
    DBMS_JOB.SUBMIT(v_job,'load_datamart.load_guard(100);',SYSDATE+100);
         DBMS_JOB.CHANGE(v_job,'load_datamart.load_guard('||v_job||');',SYSDATE,'sysdate+((1/60)*1/24)');
         COMMIT;
    END start_load_guard;
    PROCEDURE load_guard(p_job IN INTEGER) IS
    v_job INTEGER;
         CURSOR c1 IS SELECT * FROM DWH_DATA_LOADS
         WHERE file_date BETWEEN TRUNC(SYSDATE) AND TRUNC(SYSDATE)+(86399/86400);
    did_PAYC_load BOOLEAN := NULL;
    did_ARMS_load BOOLEAN := NULL;
    did_CLMS_load BOOLEAN := NULL;
    did_STAT_load BOOLEAN := NULL;
    did_TRAN_load BOOLEAN := NULL;
    did_VCOM_load BOOLEAN := NULL;
    did_BCRD_load BOOLEAN := NULL;
    did_PNET_load BOOLEAN := NULL;
    BEGIN
    FOR i IN c1 LOOP
         NULL;
         --if i.status in ('Ready','Done') then
         --if i.data_type = 'PAYC' then
         END LOOP;
         IF NOT ( SYSDATE >= TO_DATE(TO_CHAR(SYSDATE,'DD-MON-YYYY')||' 13:35:00','DD-MON-YYYY HH24:MI:SS') )THEN
    send_mail('"Load Datamart"','[email protected]','I am the guard','This is my body messaje at '||TO_CHAR(SYSDATE,'DD-MON-YYYY HH24:MI:SS')||'.');
    ELSE
    send_mail('"Load Datamart"','[email protected]','I am the guard, this is the last message.','This is my body messaje at '||TO_CHAR(SYSDATE,'DD-MON-YYYY HH24:MI:SS')||'.');
    DBMS_JOB.SUBMIT(v_job,'begin dbms_job.next_date('||p_job||',to_date('''||TO_CHAR(SYSDATE+1,'DD-MON-YYYY')||' 03'||''',''DD-MON-YYYY HH24'')); commit; exception when others then null; end;',TRUNC(SYSDATE));
         END IF;
    COMMIT;
    EXCEPTION WHEN OTHERS THEN
    load_datamart.send_mail('"Load Datamart"','[email protected]','I am the guard, I break at '||TO_CHAR(SYSDATE,'DD-MON-YYYY HH24:MI:SS'),SQLERRM);
    END load_guard;
    END load_datamart;

  • How to use array as parameter in procedure

    Hello,
    I am using Oracle SQL Developer 1.5.5
    I wanted to write a procedure which does insert into table.
    It should take 2 parameters.How to take array as parameter?
    One is a array of strings ('abc','def','erg') and another is a varchar ('abc').
    How to do this?
    Can somebody pls give a small example?
    Thanks
    Edited by: user13305573 on Aug 5, 2010 11:27 PM

    Hello,
    I am sorry if u didnt get my point.
    My req is i am using Orcale SQL Developer.
    Db is Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
    I want to write a procedure which will be called from a java file.
    The parameter to that procedure will be a arr(array of strings) and username(varchar).
    I want to insert that data into a tableA.
    like if parameters are
    (abc01,edfg02,efg03) as arr and honey as username
    then it should insert 3 rows to the tableA
    abc01 honey
    edfg02 honey
    efg03 honey
    Thanks
    Edited by: user13305573 on Aug 5, 2010 11:54 PM

  • How to use Update Statement in ODI Procedure

    Hi,
    How can I use an update statement inside an ODI procedure.
    Thanks

    Hi,
    You do not need the BEGIN and END. ODI procedures are free text, so you can simply write your update statement, as you would in toad/sql developer etc etc. Just make sure you set the Technology and the logical schema. It is how ever best practice to also use the API:
    <%=odiRef.getSchemaName("YOUR_LOGICAL_SCHEMA_NAME", "D")%>. to prefix tables. This way, you select data from different schema's in the same instance (as long a your user has the correct privs).
    Cheers
    Bos
    Edited by: Bos on Jun 22, 2011 3:09 PM

  • How to use JNI and run javah

    When using a DLL I'm supposed to use javah on my class file, for creation of a C headerfile. How's this done in JDeveloper?

    JDeveloper doesn't include a wizard for this. You can run setvars.bat from the JDeveloper\Bin directory from a command prompt and that will set up your path and CLASSPATH for using the command line tools.
    You can then run the javah command directly to generate the header files to use when creating your C/C++ JNI code.
    Take Care,
    Rob
    null

  • Question: how to use JAVAEE to run the WAP program of mobile phone  on web?

    I want to develop a web program by JAVAEE. It uses the simulator of mobile phone to run the WAP program of mobile phone on web. You can operate the program on the page just as do on mobile phone. tell me how to develop on details soon. show the code, please.

    Haha, there's no way in hell you can do that. And nobody in their right mind would write the code for you, at least for free.
    Jesus with you people these days..."Java_Researcher". I bet you've never written a single line of Java.

  • How to use IPad to run IMac Remotely?

    How do we use our I Pad to run proclaim worship program remotely from the stage through our I Mac in a church service. We have  two VGA projectors that run the slide and the sound is run through the sound board. The iMac and soundboard are in the back of the worship center.

    ms have a free remote desktop app
    and there are teamviewer and a long line of other vnc and remote desktop clients in apps tore

  • How to use OEM to run a script against many targets and send result by emai

    Is there a way to use OEM to query the RMAN backup against many targets (databases) and have all the results send to you by a single email?
    The script is :
    SELECT a.instance_name, b.session_key, b.session_recid, b.session_stamp, b.command_id,
    b.status, b.start_time, b.time_taken_display, b.input_type,
    b.output_device_type, b.input_bytes_display, b.output_bytes_display,
    b.output_bytes_per_sec_display
    FROM
    v$instance a, V$RMAN_BACKUP_JOB_DETAILS b WHERE ( b.start_time > (SYSDATE - 30) ) order
    by b.start_time
    Thanks.

    Are you using a RMAN catalog? If not, you can used UDM's (this will be messy w/o a RMAN catalog) for what you want to do.
    What I started out doing was....
    You can create a UDM and push that UDM out to the targets you want. The problem with UDM's, is you can only pull 1 or 2values. I started down this same path and wrote a sql to concatenate the data into one value, such as
    SELECT '|'||input_type||'|'||status||'|'||start_time||'|'||end_time||'|'||ROUND(elapsed_seconds,2)||'|'||time_taken_display||'|'
    FROM v$rman_backup_job_details
    WHERE (INPUT_TYPE, START_TIME)
    IN
    ( SELECT input_type, MAX(START_TIME)
    FROM v$rman_backup_job_details
    GROUP BY INPUT_TYPE
    AND INPUT_TYPE = 'DB FULL';
    Do not put any warning/critical thresholds in the UDM and just let OEM Agent gather the data and pull it back into the SYSMAN repository.
    You can then look at this view, SYSMAN. MGMT$METRIC_DETAILS to find the correct SQL to pull out the data you need. This view is made up of a 4 way union between 4 sql's. Once you find the SQL you need, then you can pull this information out and into a custom table of your own.
    Once you have data into another table, you will then have to extract the concatenated string out, parse it out and report on it. This is where I stopped and said there has to be a better way.
    I then thought about it and the RMAN catalog has all this, assuming you are using a RMAN Catalog.
    I wrote a piece of dynamic sql to loop through the rman catalog to pull this out into a historical table and store the data. Then I can report on it from there. If you have a RMAN catalog, this works much better.
    I also use UDM's to use OEM as a data extract tool to pull the number of archivelogs and bytes my databases create on an hourly basis. I pull 2 values, bytes and # of logs. So this works well with UDM's, don't have to concatenate a bunch of values and then parse it back out again.
    I push this UDM to all databases, and have it run hourly. Then daily, I extract this information into a custom table and then use analytic functions to determine how much space is needed on the db servers for archivelogs for a 24 hour time frame. This helps with sizing our log destinations and gives us legitimate reports for Storage teams.
    I can also build reports on how many archive logs are generated on a daily, weekly, monthly basis per database. Good for analysis and charge back methods.

Maybe you are looking for

  • Space Designer - Loading Split Stereo IR's

    Hi, First of all please accept my apologies if this question has been answered before. I've finally started creating presets for the 100's of IR's I have, and I just wanted to check that my assumption is correct: When attempting to load a split stere

  • How do i find out how many ppl  download my podcast

    I wanna know if there is a way to find out how many ppl download my podcast (not only from itunes, but from everywhere) thanks for helping, cheers! download my podcast, its on itunes, its called: Idiots on fire podcast xml url: http://www.switchpod.c

  • Icons vanish when arranging on desktop. Why?

    Some of the Ap icons vanish but the Ap is still there with the title underneath when I rearrange them on the desktop. Known bug? Fix?

  • Cannot get NexDef to install on MacBook Pro - Ideas?

    Hey folks...I've been trying for a while to get the NexDef add-in for Safari to install properly to no avail.  If anyone has found a good, step-by-step process to make this thing install successfully on Mac OSX 10.8.5, please let me know.

  • MP54G2 MiniPCI WiFi Car - WPA2 and Linux drivers or support?

    Hi All, I have a Rock Quddra T64 laptop with a MP54G2 module installed. I am looking for two thing from the MP54G2 WiFi module. 1) Support of WPA2 encryption. The standard driver for windows support WPA but even with the update from MS, they do not a