Help: Unable to execute a procedure

Hello Folks,
Am having a procedure and am trying to execute the procedure in the querytool of sql server. Somehow its returning back with an error.
I have no clue where am going wrong. Please advice if anyone has any idea.Thanks
execute process_040_series(01-OCT-09,31-OCT-09)
its returning Msg 170, Level 15, State 1
Line 1: Incorrect syntax near '01'.
/*for refernce this is the code behind procedure */
CREATE PROCEDURE process_040_series (@start_date     smalldatetime = null ,
                         @end_date       smalldatetime = null, 
                                     @rep_no_in      int = null,
                         @client_code_in char(20) = null,
                         @p_bimonth      int = 0)

Oops, missed SQL Server thing. You are on erong forum. Anyway, to execute it in SQL Server use:
execute process_040_series '01-OCT-09','31-OCT-09'SY.

Similar Messages

  • Unable to execute a procedure via an odbc dsn

    Hi forum,
    I'm facing an unique problem.
    When I execute a procedure (through sql advantage) that has a call to another procedure on a remote server, it works fine.But when I connect to sybase server via an ODBC or OLEDB dsn, it displays a message as "Login to site '%S_SRVID' failed". The connection works perfect when i execute other procedures that do not have a call to any remote procedure.
    If anybody can help...

    Oops, missed SQL Server thing. You are on erong forum. Anyway, to execute it in SQL Server use:
    execute process_040_series '01-OCT-09','31-OCT-09'SY.

  • Unable to execute packaged procedure in PLSQL

    DECLARE
    CURSOR c1
    IS
    SELECT NAME
    FROM v$hm_check
    WHERE internal_check = 'N' AND NAME NOT LIKE '%ASM%';
    sql_text VARCHAR2 (2000) := NULL;
    random_value VARCHAR2 (50);
    BEGIN
    FOR hm_check IN c1
    LOOP
    random_value := dbms_random.string('U', 20);
    sql_text :=
    'dbms_hm.run_check('''
    || hm_check.NAME
    || ''','''
    || random_value
    || ''',null,null);';
    DBMS_OUTPUT.put_line (sql_text);
    EXECUTE IMMEDIATE (' begin ' || sql_text || ' end; ');
    END LOOP;
    END;
    Error at line 4
    ORA-48615: Parameter [CF_BL_NUM] value not specified
    ORA-06512: at "SYS.DBMS_HM", line 191
    ORA-06512: at line 1
    ORA-06512: at line 24
    if i exeucte commenting execute immediate then i will be able.. but i want to execute with execute immediate...
    can you please help out.. thanks...

    knowledgespring wrote:
    I changed the code
    sql_text:='begin '||sql_text|| ' end;';
    in the given procedure
    it generates
    begin dbms_hm.run_check('DB Structure Integrity Check','NUCQGGPVQLVJELKJMMGW',null,null); end;
    begin dbms_hm.run_check('CF Block Integrity Check','SYWCMEEPBLYNNQCAQAHV',null,null); end;
    begin dbms_hm.run_check('Data Block Integrity Check','KILLVEYBLEVVEVLAYGGI',null,null); end;
    begin dbms_hm.run_check('Redo Integrity Check','ROJDCYKULSFWURHNCUDY',null,null); end;
    begin dbms_hm.run_check('Transaction Integrity Check','IZLGHJOLXJIIORYMGVFG',null,null); end;
    begin dbms_hm.run_check('Undo Segment Integrity Check','WDXGWDIHQPYHGROYYXOA',null,null); end;
    begin dbms_hm.run_check('Dictionary Integrity Check','HTCZJEIBMNTZYBEECTNX',null,null); end;
    can i execute this one by one??
    I see first one is executed but not the second one or next one...? is there any other way of executing this one time..when all else fails, Read The Fine Manual
    http://docs.oracle.com/cd/E11882_01/appdev.112/e25788/d_hm.htm#CHDGBEBD
    "SELECT name FROM V$HM_CHECK WHERE INTERNAL_CHECK = 'N'
    Above retrieves the list of checks that can be run manually by users."

  • We are not able to execute below procedure, plz help me ASAP.

    Dear All
    I am created one procedure with 4 parameter 1 is Ref Cusrsor rest of 3 are Varchar,But we are not able to execute below procedure, plz help me ASAP.
    CREATE OR REPLACE PROCEDURE GETCHART(RPT_CURSOR OUT RPT_PACKAGE.RPT_RESULTS,
    V_VITALCHARTING VARCHAR2,
    V_DOCIDPATIENTS VARCHAR2,
    v_fromdate varchar2,
    v_todate varchar2) AS
    D1 VARCHAR2(500);
    D2 VARCHAR2(500);
    G1 VARCHAR2(500);
    R1 VARCHAR2(500);
    R2 VARCHAR2(500);
    R3 VARCHAR2(500);
    R4 VARCHAR2(500);
    R5 VARCHAR2(500);
    H1 VARCHAR2(500);
    H2 VARCHAR2(500);
    V_COUNT NUMBER;
    RC VARCHAR2(100);
    RMI VARCHAR2(100);
    RMAX VARCHAR2(100);
    R12 VARCHAR2(500);
    REQ NUMBER;
    V_MAX number;
    v_idcount number;
    RSEQ NUMBER;
    RCH VARCHAR2(500);
    BEGIN
    INSERT INTO TEMPDATA
    SELECT ROWNUM G, TIME1
    FROM (SELECT distinct TO_CHAR(H.RECORDEDDNT, 'mm/dd/yy hh24:mi:ss') TIME1
    FROM VIEW_PATIENTCHART V,
    chartingtxheader H,
    chartingtxdetails D
    WHERE h.docid = d.docidchartingtxheader
    and v.VITALCHARTING_PK = h.docidvitalcharting
    and v.VITALPARAMETER_PK = d.docidvitalparameter
    and v.VITALCHARTING_PK = V_VITALCHARTING --General Vital Signs
    and H.DOCIDPATIENTS = V_DOCIDPATIENTS
    and TO_DATE(to_char(h.recordeddnt, 'DD/MM/YYYY'),
    'DD/MM/YYYY') BETWEEN
    TO_DATE(v_fromdate, 'DD/MM/YYYY') AND
    TO_DATE(V_TODATE, 'DD/MM/YYYY'));
    SELECT MAX(ID) INTO V_MAX FROM TEMPDATA;
    V_IDCOUNT := 0;
    WHILE V_IDCOUNT < V_MAX loop
    FOR J IN (SELECT id, ROWNUM G, vdate time1
    FROM (SELECT id, ROWNUM, VDATE
    FROM TEMPDATA
    WHERE ID BETWEEN V_IDCOUNT + 1 AND V_IDCOUNT + 8)) LOOP
    D1 := D1 || 'COL' || J.G || ',';
    D2 := D2 || '''' || J.TIME1 || '''' || ',';
    END LOOP;
    D1 := SUBSTR(D1, 1, LENGTH(D1) - 1);
    D2 := SUBSTR(D2, 1, LENGTH(D2) - 1);
    DBMS_OUTPUT.PUT_LINE(d1);
    SELECT SEQ_GETCHART.NEXTVAL INTO RSEQ FROM DUAL;
    G1 := 'INSERT INTO GETDATA2 (IDSLNO,idcount,' || D1 || ') VALUES(' || RSEQ || ',' ||
    V_IDCOUNT || ',' || D2 || ')';
    --EXECUTE IMMEDIATE G1;
    DBMS_OUTPUT.PUT_LINE(d1);
    DBMS_OUTPUT.PUT_LINE(SUBSTR(D2, 1, LENGTH(D2) - 1));
    DBMS_OUTPUT.PUT_LINE(G1);
    EXECUTE IMMEDIATE G1;
    FOR K IN (SELECT id, ROWNUM G, vdate time2
    FROM (SELECT id, ROWNUM, VDATE
    FROM TEMPDATA
    WHERE ID BETWEEN V_IDCOUNT + 1 AND V_IDCOUNT + 8)) LOOP
    FOR I IN (select s.*, rownum hslno
    from (SELECT v.CHARTNAME,
    v.PARAMETERNAME_CS,
    ' ' || v.PARAMETERNAME PARAMETERNAME,
    TO_CHAR(H.recordeddnt, 'mm/dd/yy hh24:mi:ss') TIME1,
    CASE
    WHEN IDSLNO_GN5029 IN (1040, 1041) THEN
    CASE
    WHEN TO_NUMBER(d.recordedvalue) <
    TO_NUMBER(D.MINVALUE) THEN
    decode(d.recordedvalue,
    null,
    d.recordedvalue,
    d.recordedvalue || ' ' || 'L')
    ELSE
    CASE
    WHEN TO_NUMBER(d.recordedvalue) >
    TO_NUMBER(D.MaxVALUE) THEN
    decode(d.recordedvalue,
    null,
    d.recordedvalue,
    d.recordedvalue || ' ' || 'H')
    ELSE
    decode(d.recordedvalue,
    null,
    d.recordedvalue,
    d.recordedvalue || ' ' || 'N')
    END END ELSE d.recordedvalue END IMAGECHAR,
    d.minvalue,
    d.maxvalue,
    D.UOMCODE
    FROM VIEW_PATIENTCHART V,
    chartingtxheader H,
    chartingtxdetails D
    WHERE h.docid = d.docidchartingtxheader
    and v.VITALCHARTING_PK = h.docidvitalcharting
    and v.VITALPARAMETER_PK = d.docidvitalparameter
    and v.VITALCHARTING_PK = V_VITALCHARTING --General Vital Signs
    and H.DOCIDPATIENTS = V_DOCIDPATIENTS
    ORDER BY V.DISPLAYORDER_CS, V.DISPLAYORDER
    -- v.PARAMETERNAME_CS,v.PARAMETERNAME
    ) s
    where s.time1 = k.time2) LOOP
    select count(1)
    into v_count
    from GETDATA2 d
    where d.PARAMETERNAME_CS = i.PARAMETERNAME_CS
    and PARAMETERNAME = i.PARAMETERNAME
    and idcount = v_idcount;
    IF V_COUNT = 0 THEN
    RCH := I.CHARTNAME;
    R1 := 'COL' || K.G;
    R2 := '''' || I.PARAMETERNAME_CS || '''' || ',';
    R3 := '''' || I.PARAMETERNAME || '''' || ',';
    R4 := '''' || I.IMAGECHAR || '''';
    RC := '''' || I.CHARTNAME || '''' || ',';
    RMI := '''' || I.minvalue || '''' || ',';
    RMAX := '''' || I.maxvalue || '''' || ',';
    R12 := '''' || I.UOMCODE || '''' || ',';
    SELECT SEQ_GETCHART.NEXTVAL INTO RSEQ FROM DUAL;
    H1 := 'INSERT INTO GETDATA2 (IDSLNO,UMCODE,idcount,CHARTNAME,minvalue,maxvalue,PARAMETERNAME_CS,PARAMETERNAME,' || R1 || ')' ||
    ' values(' || RSEQ || ',' || R12 || v_idcount || ',' || RC || RMI || RMAX || R2 || R3 || R4 || ')';
    EXECUTE IMMEDIATE H1;
    ELSE
    R5 := 'COL' || K.G;
    R4 := '''' || I.IMAGECHAR || '''';
    H2 := 'UPDATE GETDATA2 SET ' || R5 || '=' || R4 ||
    'WHERE PARAMETERNAME_CS=' || '''' || I.PARAMETERNAME_CS || '''' ||
    ' AND ' || 'PARAMETERNAME=' || '''' || I.PARAMETERNAME || '''';
    EXECUTE IMMEDIATE H2;
    END IF;
    END LOOP;
    end loop;
    UPDATE getdata2 s
    set s.parametername = s.parametername || ' -' || ' (' || minvalue ||
    ' -- ' || maxvalue || ') ' || UMCODE
    where s.parametername is not null
    and idcount = v_idcount
    and minvalue != 0
    and maxvalue != 0;
    UPDATE getdata2 s
    set s.parametername = s.parametername || ' -' || UMCODE
    where s.parametername is not null
    and idcount = v_idcount
    and minvalue = 0
    and maxvalue = 0;
    UPDATE GETDATA2 S
    SET S.PARAMETERNAME_CS = NULL
    WHERE ROWID NOT IN (SELECT MIN(ROWID)
    FROM GETDATA2
    WHERE idcount = v_idcount
    GROUP BY PARAMETERNAME_CS)
    and idcount = v_idcount;
    UPDATE GETDATA2 S
    SET CHARTNAME = NULL
    WHERE ROWID NOT IN (SELECT MIN(ROWID)
    FROM GETDATA2
    WHERE idcount = v_idcount
    GROUP BY CHARTNAME)
    and idcount = v_idcount;
    UPDATE getdata2 s
    set s.parametername = ' PARAMETER'
    where s.parametername is null
    AND S.PARAMETERNAME_CS IS NULL;
    v_idcount := v_idcount + 8;
    D1 := null;
    d2 := null;
    end loop;
    for i in (SELECT G.PARAMETERNAME_CS, G.IDSLNO
    FROM GETDATA2 G
    WHERE G.PARAMETERNAME_CS IS NOT NULL) LOOP
    INSERT INTO GETDATA2
    (IDSLNO, PARAMETERNAME)
    VALUES
    (I.IDSLNO - 1 + 0.5, I.PARAMETERNAME_CS);
    END LOOP;
    update GETDATA2 h set h.PARAMETERNAME_CS = null;
    update GETDATA2 h set h.chartname = rcH;
    INSERT INTO GETDATA1
    SELECT CHARTNAME,
    PARAMETERNAME_CS,
    PARAMETERNAME,
    COL1,
    COL2,
    COL3,
    COL4,
    COL5,
    COL6,
    COL7,
    COL8,
    COL9,
    COL10,
    MINVALUE,
    MAXVALUE,
    UMCODE
    FROM GETDATA2
    ORDER BY IDSLNO;
    OPEN RPT_CURSOR FOR
    SELECT * FROM GETDATA1;
    END;
    CREATE OR REPLACE PACKAGE "RPT_PACKAGE"
    as
    type RPT_RESULTS is REF CURSOR;
    type RPT_VARRAY is VARRAY(2000) of VARCHAR2(2000);
    END RPT_PACKAGE;
    Execute
    declare
    type my_newcursor IS REF CURSOR;
    begin
    GETCHART(my_newcursor,'General Vital Sign','1145561',sysdate-1,sysdate);
    end;

    Parwez wrote:
    Dear All
    I am created one procedure with 4 parameter 1 is Ref Cusrsor rest of 3 are Varchar,But we are not able to execute below procedure, plz help me ASAP.
    see a picture of my car.
    my car won't go.
    tell me how to make my car go.
    How do I ask a question on the forums?
    SQL and PL/SQL FAQ

  • Help required in executing the stored procedure and capturing the responce

    Hi,
    I have to execute a stored procedure in oracle database and if it successful then have to create a status IDOC.
    The stored procedure may throw an exception(it is not an out parameter), in such cases i should capture the exception as part of the response message and send this information while creating the status IDOC.
    i would like if the below is possible.
    As the stored procedure is not returning( this means if you execute the procedure manually it will display the result), will it be possible to capture the result which has the exception details?
    any direction to this will be highly appreciated.
    Many thanks.
    Regards,
    Rahul

    @Bhaskar,
    i need to execute the procedure by sending the input data from a file and capture the result after executing the procedure to create a status idoc
    im not sure how the provided links helps me here.
    i m not looking for any look ups. i would like to know is there any way that we can capture the result after executing the database procedure?
    Edited by: Rahul_10416 on Dec 5, 2011 10:07 PM

  • Unable to execute a remote proc

    Hi I am unable to execute a remote procedure from forms6i, and that procedure runs coolly form sql plus console. I just dont get any exception or error. Thats really pathetic for me now.
    I need help.
    thanx Rajeev

    Hi ,
    Remote procedure means the procedure in database. My database is in solaris, d2k on win2k and other database on win2k. I am executing a remote procedure on solaris Oracle db to poll data from win2k db using forms, i.e. on button click. The form user and the solaris db users are same. I am using dblink here.
    Hope this helps in clarifying my query further.
    thanx

  • PL/SQL: Executing a procedure from within another procedure

    Hello, I'm a newbie and I need help on how to execute procedures from within another procedure. The procedure that I call from within the procedure have return values that I want to check.
    I tried: EXECUTE(user_get_forum_info(p_forumid, var_forum_exists, var_forum_access, var_forumname));
    but I get the error message:
    PLS-00103: Encountered the symbol "USER_GET_FORUM_INFO" when expecting one of the following::= . ( @ % ; immediate
    The symbol ":=" was substituted for "USER_GET_FORUM_INFO" to continue.
    And when I tried: EXECUTE(user_get_forum_info(p_forumid, var_forum_exists, var_forum_access, var_forumname));
    I get the error message:
    PLS-00222: no function with name 'USER_GET_FORUM_INFO' exists in this scope
    PL/SQL: Statement ignored
    The procedure USER_GET_FORUM_INFO exists. (don't understand why it says "no FUNCTION with name", it's a procedure I'm executing)
    I'm stuck so thanks for any help...
    Below is all the code. I'm using Oracle 9i on RedHat Linux 7.3.
    ================================================================================
    CREATE OR REPLACE PROCEDURE user_forum_requestsaccess (
    p_forumid IN NUMBER,
    p_requestmessage IN VARCHAR2
    AS
    var_forumid NUMBER;
    var_forum_exists NUMBER;
    var_forum_access NUMBER;
    request_exists NUMBER;
    var_forumname VARCHAR2(30);
    FORUM_DOESNT_EXIST EXCEPTION;
    FORUM_USER_HAS_ACCESS EXCEPTION;
    FORUM_REQUEST_EXIST EXCEPTION;
    BEGIN
    SELECT SIGN(NVL((SELECT request_id FROM forum.vw_all_forum_requests WHERE forum_id = p_forumid AND db_user = user),0)) INTO request_exists FROM DUAL;
    EXECUTE(user_get_forum_info(p_forumid, var_forum_exists, var_forum_access, var_forumname));
    IF var_forum_exists = 0 THEN
    RAISE FORUM_DOESNT_EXIST;
    ELSIF var_forum_access = 1 THEN
    RAISE FORUM_USER_HAS_ACCESS;
    ELSIF request_exists = 1 THEN
    RAISE FORUM_REQUEST_EXIST;
    ELSE
    INSERT INTO tbl_forum_requests VALUES (SEQ_TBL_FORUM_REQ_REQ_ID.NEXTVAL, SYSDATE, p_requestmessage, p_forumid, user);
    INSERT INTO tbl_forum_eventlog VALUES (SEQ_TBL_FORUM_EVNTLOG_EVNT_ID.NEXTVAL,SYSDATE,1,'User ' || user || ' requested access to forum ' || var_forumname || '.', p_forumid,user);
    COMMIT;
    END IF;
    EXCEPTION
    WHEN
    FORUM_DOESNT_EXIST
    THEN RAISE_APPLICATION_ERROR(-20003,'Forum doesnt exist.');
    WHEN
    FORUM_USER_HAS_ACCESS
    THEN RAISE_APPLICATION_ERROR(-20004,'User already have access to this forum.');
    WHEN
    FORUM_REQUEST_EXIST
    THEN RAISE_APPLICATION_ERROR(-20005,'A request to this forum already exist.');
    END;
    GRANT EXECUTE ON user_forum_requestsaccess TO forum_user;
    ================================================================================
    Regards Goran

    you don't have to use execute when you want to execute a procedure (only on sql*plus, you would use it)
    just give the name of the funtion
    create or replace procedure test
    as
    begin
        dbms_output.put_line('this is the procedure test');
    end test;
    create or replace procedure call_test
    as
    begin
        dbms_output.put_line('this is the procedure call_test going to execute the procedure test');
        test;
    end call_test;
    begin
        dbms_output.put_line('this is an anonymous block calling the procedure call_test');
        call_test;
    end;
    /

  • Help me in debugging this procedure

    PROCEDURE p_main_dpn (
    m_post IN OUT VARCHAR2,
    m_company VARCHAR2,
    m_user_group VARCHAR2,
    m_user_id VARCHAR2,
    m_choice VARCHAR2,
    m_year VARCHAR2,
    m_period VARCHAR2,
    m_tot_count NUMBER,
    g_asset_code VARCHAR2
    IS
    CURSOR c1 (m_last_day_of_period DATE)
    IS
    SELECT company, asset_code, asset_dept, capital_cost, current_wdv,
    dpn_type, status, residual_val, dpn_prd, dpn_year, nl_intf,
    asset_life, updated_wdv, dpn_date, comm_date
    FROM fa_asset_reg
    WHERE status = 'C'
    AND company = m_company
    AND asset_code =
    NVL (g_asset_code, asset_code)
    -- dpn before sale
    AND updated_wdv > residual_val
    AND TO_NUMBER (TO_CHAR (NVL (dpn_date, comm_date), 'yyyymmdd')) <
    TO_NUMBER (TO_CHAR (m_last_day_of_period, 'yyyymmdd'))
    ORDER BY asset_dept;
    rc1 c1%ROWTYPE;
    sl_value NUMBER (15, 2);
    -- Used in Sraight Line Method Calculation
    sl_dpn NUMBER (15, 2); -- Straight Line depreciation amount
    rb_value NUMBER (15, 2);
    -- Used in Reducing Balance Method Calculation
    rb_dpn NUMBER (15, 2);
    -- Reducing Balance depreciation amount
    m_doc_ref VARCHAR2 (16); -- For generating new Doc-Ref
    m_updated_wdv NUMBER (15, 2); -- Latest book value of the Asset
    m_tot_dpn NUMBER (15, 2); -- Department-wise total depreciation
    m_loop_count NUMBER; -- To check for First Loop
    m_prev_dept VARCHAR2 (12);
    m_next_dept VARCHAR2 (12);
    period_last_day DATE; --*
    m_period_days NUMBER; --*
    m_dpn_days NUMBER; --* used for datewise DPN calculation
    dpn_for_a_day NUMBER; --*
    m_last_day DATE; --*
    m_start_day DATE; --*
    m_from_day DATE; --*
         Chk Number;
    BEGIN
    /* First Delete any Trial Depreciations Calculated */
    DELETE FROM fa_temp_dpn
    WHERE company = m_company;
    Chk :=1;
    BEGIN
    /* This check is done to calculate dpn before sale for a particular asset*/
    IF g_asset_code IS NULL
    THEN
    SELECT LAST_DAY (fdp), LAST_DAY (fdp) - fdp + 1, fdp
    INTO m_last_day, m_period_days, m_start_day
    FROM sm_calendar
    WHERE company = m_company AND YEAR = m_year AND prd = m_period;
                   DBMS_OUTPUT.PUT_LINE('m_last_day, m_period_days, m_start_day'||m_last_day||','|| m_period_days||','|| m_start_day);
    ELSE
    SELECT SYSDATE, LAST_DAY (fdp) - fdp + 1,
    TRUNC (SYSDATE - fdp) + 1, fdp
    INTO m_last_day, m_period_days,
    m_dpn_days, m_start_day
    FROM sm_calendar
    WHERE company = m_company AND YEAR = m_year AND prd = m_period;
    END IF;
    EXCEPTION
    WHEN NO_DATA_FOUND
    THEN
    m_post := 'System calendar not defined properly';
    END;
    --OPEN c1 (m_last_day);
    FOR RC1 IN C1(m_last_day)
    LOOP
         cHK := 0;
    /*FETCH c1
    INTO rc1;*/
              cHK := 0.1;
    dbms_OUTPUT.PUT_LINE('ENtered the loop'||c1%rowcount||m_last_day);
    EXIT WHEN c1%NOTFOUND or c1%rOWCOUNT = 0;ADDED BY ALOK
              cHK := 0.2;
    m_loop_count := NVL (m_loop_count, 0) + 1;
              cHK := 0.3;
              DBMS_OUTPUT.PUT_LINE('m_loop_count '||m_loop_count );
    -- No more depreciation for the Asset which has depreciated
    -- upto the Residual Value!!
    rb_dpn := NULL;
    sl_dpn := NULL;
    -- SLL or SL% METHOD
    IF rc1.dpn_type = 'S' OR rc1.dpn_type = 'P'
    THEN
    -- Provision is given for adding already depreciated assets into the register.****
    sl_value := NVL (rc1.current_wdv, NVL (rc1.capital_cost, 0));
    DBMS_OUTPUT.put_line ('SL Value ' || sl_value);
    IF rc1.dpn_type = 'S'
    THEN -- SLL METHOD
    sl_dpn := (sl_value - rc1.residual_val) / rc1.asset_life;
    DBMS_OUTPUT.put_line
    ( 'sl_dpn := (SL_VALUE - rc1.residual_val)/rc1.asset_life'
    || sl_dpn
    ELSIF rc1.dpn_type = 'P'
    THEN -- SL% METHOD
    sl_dpn :=
    ((sl_value - rc1.residual_val) * rc1.asset_life) / 100;
    DBMS_OUTPUT.put_line
    ( 'sl_dpn := ((SL_VALUE - rc1.residual_val)*rc1.asset_life)/100'
    || sl_dpn
    END IF;
    -- Dpn Calculation for no. of days in the period.
    dpn_for_a_day := sl_dpn / m_period_days;
                   DBMS_OUTPUT.put_line('dpn_for_a_day '||dpn_for_a_day );
    IF g_asset_code IS NULL
    THEN
    -- Get the no. of days from rc1.dpn_date to last_day of current period.
    IF rc1.dpn_date = rc1.comm_date
    THEN
    -- Dpn calculation for the first time.
    m_start_day := rc1.dpn_date;
                        DBMS_OUTPUT.put_line('m_start_day '||m_start_day);
    END IF;
    ELSE
    IF TO_CHAR (m_start_day, 'MMYYYY') =
    TO_CHAR (rc1.comm_date, 'MMYYYY')
                   THEN
    m_start_day := rc1.comm_date;
                        DBMS_OUTPUT.put_line('TO_CHAR (m_start_day, ''MMYYYY'')'||TO_CHAR (m_start_day, 'MMYYYY'));
    ELSE
    m_start_day := rc1.dpn_date + 1;
    END IF;
    END IF;
    m_dpn_days := TRUNC (m_last_day - m_start_day) + 1;
    DBMS_OUTPUT.put_line('m_dpn_days '||m_dpn_days);
    -- Compare the days for which depreciation has to be calculated with the
    -- no. of days in the period.
    IF m_dpn_days > m_period_days
    THEN
    m_post :=
    'Depreciation has not been done for a previous period.';
    EXIT;
    ELSE
    -- Restore the DPN into same variable
    sl_dpn := dpn_for_a_day * m_dpn_days;
                   DBMS_OUTPUT.put_line('sl_dpn '||sl_dpn);
    END IF;
    Chk := 2;
    -- Update the Current Value of this Asset(SL)
    m_updated_wdv := rc1.updated_wdv - sl_dpn;
    -- RBL OR RB% METHOD
    ELSIF rc1.dpn_type = 'R' OR rc1.dpn_type = 'Q'
    THEN
    rb_value :=
    NVL (rc1.updated_wdv,
    NVL (rc1.current_wdv, NVL (rc1.capital_cost, 0))
    Chk :=3;
    IF rc1.dpn_type = 'R'
    THEN
    rb_dpn := (rb_value - rc1.residual_val) / rc1.asset_life;
    ELSIF rc1.dpn_type = 'Q'
    THEN
    rb_dpn :=
    ((rb_value - rc1.residual_val) * rc1.asset_life) / 100;
    END IF;
    -- Dpn Calculation for no. of days in the period.
    dpn_for_a_day := rb_dpn / m_period_days;
    IF g_asset_code IS NULL
    THEN
    -- Get the no. of days from rc1.dpn_date to last_day of current period.
    IF rc1.dpn_date = rc1.comm_date
    THEN
    -- Dpn calculation for the first time.
    m_start_day := rc1.dpn_date;
    END IF;
    ELSE
    IF TO_CHAR (m_start_day, 'MMYYYY') =
    TO_CHAR (rc1.comm_date, 'MMYYYY')
    THEN
    m_start_day := rc1.comm_date;
    ELSE
    m_start_day := rc1.dpn_date + 1;
    END IF;
    END IF;
    m_dpn_days := TRUNC (m_last_day - m_start_day) + 1;
    -- Compare the days for which depreciation has to be calculated with the
    -- no. of days in the period.
    IF m_dpn_days > m_period_days
    THEN
    m_post :=
    'Depreciation has not been done for previous a period.';
    EXIT;
    ELSE
    -- Restore the DPN into same variable
    rb_dpn := dpn_for_a_day * m_dpn_days;
    END IF;
    Chk := 4;
    -- Update the Current Value of this Asset(RB)
    m_updated_wdv :=
    NVL (rc1.updated_wdv,
    NVL (rc1.current_wdv, NVL (rc1.capital_cost, 0))
    - rb_dpn;
    END IF;
    -- Check if the depreciation reduces the current book value
    -- to make it lesser than Residual Value
    IF m_updated_wdv < rc1.residual_val
    THEN
    IF rc1.dpn_type = 'S' OR rc1.dpn_type = 'P'
    THEN
    sl_dpn := sl_dpn - (rc1.residual_val - m_updated_wdv);
    ELSIF rc1.dpn_type = 'R' OR rc1.dpn_type = 'Q'
    THEN
    rb_dpn := rb_dpn - (rc1.residual_val - m_updated_wdv);
    END IF;
    m_updated_wdv := rc1.residual_val;
    END IF;
    m_from_day := m_start_day;
    Chk := 5;
    -- Check whether Department-wise AJ consolidation required.
    IF m_choice = 'Y'
    THEN /* Department-wise AJ required */
    INSERT INTO fa_stats
    (company, asset_code, closing_wdv, YEAR,
    prd, dpn_per_day, no_of_days, from_date,
    TO_DATE, asset_dpn, usr_id, TIMESTAMP
    VALUES (rc1.company, rc1.asset_code, m_updated_wdv, m_year,
    m_period, dpn_for_a_day, m_dpn_days, m_from_day,
    m_last_day, NVL (rb_dpn, sl_dpn), m_user_id, SYSDATE
                   DBMS_OUTPUT.PUT_LINE('Inserted the value into Fa_Stats');
    UPDATE fa_asset_reg
    SET dpn_year = m_year,
    dpn_prd = m_period,
    dpn_date = m_last_day,
    updated_wdv = m_updated_wdv
    WHERE company = m_company AND asset_code = rc1.asset_code;
                             DBMS_OUTPUT.PUT_LINE(SQL%ROWCOUNT||'Rows Updated the value into Fa_Asset_Reg');
    m_next_dept := rc1.asset_dept;
    IF m_next_dept = NVL (m_prev_dept, m_next_dept)
    THEN /* same department */
    m_tot_dpn := NVL (m_tot_dpn, 0)
    + NVL (NVL (sl_dpn, rb_dpn), 0);
    m_prev_dept := m_next_dept;
    IF m_loop_count = m_tot_count
    THEN /* last record */
    p_create_dpn_jv (m_company,
    m_user_group,
    m_user_id,
    m_post,
    m_period,
    m_year,
    m_last_day,
    'XXXXXX',
    m_next_dept,
    m_choice,
    m_tot_dpn,
    m_updated_wdv,
    rc1.nl_intf,
    NULL,
    NULL,
    NULL,
    NULL
    --m_updated_wdv & m_last_day not applicable if CHOICE = 'Y'
    EXIT;
    END IF;
    END IF;
    IF m_next_dept <> m_prev_dept
    THEN
    p_create_dpn_jv (m_company,
    m_user_group,
    m_user_id,
    m_post,
    m_period,
    m_year,
    m_last_day,
    'XXXXXX',
    m_prev_dept,
    m_choice,
    m_tot_dpn,
    m_updated_wdv,
    rc1.nl_intf,
    NULL,
    NULL,
    NULL,
    NULL
    --m_updated_wdv & m_last_day not applicable if CHOICE = 'Y'
    m_tot_dpn := NVL (NVL (sl_dpn, rb_dpn), 0);
    m_prev_dept := m_next_dept;
    IF m_loop_count = m_tot_count
    THEN /* last record */
    p_create_dpn_jv (m_company,
    m_user_group,
    m_user_id,
    m_post,
    m_period,
    m_year,
    m_last_day,
    'XXXXXX',
    m_next_dept,
    m_choice,
    m_tot_dpn,
    m_updated_wdv,
    rc1.nl_intf,
    NULL,
    NULL,
    NULL,
    NULL
    --m_updated_wdv & m_last_day not applicable if CHOICE = 'Y'
    EXIT;
    END IF;
    END IF;
    ELSE
              Chk := 5.1; /* choice is N */
    p_create_dpn_jv (rc1.company,
    m_user_group,
    m_user_id,
    m_post,
    m_period,
    m_year,
    m_last_day,
    rc1.asset_code,
    rc1.asset_dept,
    m_choice,
    NVL (sl_dpn, rb_dpn),
    m_updated_wdv,
    rc1.nl_intf,
    dpn_for_a_day,
    m_dpn_days,
    m_from_day,
    m_last_day
                                       Chk := 5.2;
    END IF;
    END LOOP;
    -- CLOSE c1;
         cHK := 7;
    EXCEPTION
    WHEN NO_DATA_FOUND
    THEN
    m_post := 'Processing failed !! No data found ';
    WHEN DUP_VAL_ON_INDEX
    THEN
    m_post :=
    'Posting failed . Duplicate value exists for ' || rc1.asset_code;
    ROLLBACK;
              wHEN otHERS THEN
              m_post := 'ERROR oCCURED'||SQLERRM||chk||' '||m_loop_count;
              rOLLBACK;
    END;
    Here when i'm executing this procedure, I'm getting a error ORA-01002- Fetch Out of Sequence.
    Plz help me.
    Thanks in advance.
    Regards,ALok

    Earlier it was having the simple loop.But i changed
    it to the FOr loop cursor,
    Cos, For loop is more efficient in fetching the
    data.Only from 10g on and when you don't use BULK fetch
    in your cursor loop.
    As for your other question: I meant of course the ROLLBACK
    in the procedure p_create_dpn_jv.
    Again, if you can't remove that ROLLBACK there, you could
    bulk fetch all the records of your main cursor and process them
    afterwards in a FOR/FORALL loop, if the result fits into the available
    memory of course.
    C.

  • Unable to Execute a Report to send PAN XML messages out of SNC

    Hi All,
    We are unable to Execute a Report /SCA/DM_TIMESERIES_OUT to send Product Activity Notifications in the form of XML messages out of SNC. We have manitained some Planned Reciepts data in SNC and would like to transfer it out to ECC.
    Could anyone help in understanding if we have to maintain mandatory settings before executing this report.
    Thanks & Regards,
    Sadiq

    Hi Pravin,
    As per the documentation(http://help.sap.com/saphelp_snc70/helpdata/EN/48/6bdb4767a431cbe10000000a42189d/frameset.htm), we have tried both the manual and automatic features to configure the output from SNC in the form of XML messages.
    The manual method gave a message "Time series data for selection is empty" and the Automated method could trigger the XML messages on every incoming message from ECC but we are unable to see the Planned Receipts in that XML messages.
    Was just wondering if we can see the Planned Receipt info by changing the settings of this report or by using any other simillar report as the PR info is very important for our development.
    Thanks & Regards,
    Sadiq

  • How to execute a procedure depending on the result of a query?

    Hello, I'm new in ODI.
    I want to execute a procedure depending on the result of a query Oracle table.
    We have a Oracle Table whit a column that contains two possibles values.
    I want read the table, row by row, and depending on this value, execute a Procedure or execute another.
    How can i do?

    what you need to do is
    1. create a variable which "new_var2" which has the count of the number of rows you want to process. must be data type numeric.
    2. copy "new_var2" to the package screen.
    3. duplicate the "new_var2" on the package screen and evaluate the variable and test for "> 0" zero, call it "new_var2_E"
    3. create a new odi variable "new_var1" with a refresh of "select field1 fom (select field1,rownum as rownumber from tablex) where rownumber = #new_var2" in the relevant schema and technology.
    4. copy "new_var1" into your package (some where in the flow)
    5. right click the "new_var1" variable in you package screen and you should get the option duplicate step (click on that)
    6. select the the duplicate "new_var1" on the package screen and correct the the name to something meaning full to you "new_var1_E", also change the "type" to "evaluate variable" then you should see a "value" box. enter one of the values you want to test in the box (remember do not put in quotes ' )
    7. now back on the package screen join the "new_var1" to the "new_var1_E" with an OK line
    8 you now join "new_var2" to "new_var2_E" with OK
    9 you join "new_var2_E" to "new_var1"
    10. you then join the "new_var1_E" with an OK or a KO line to the relevant procedure.
    12. you need to duplicate "new_var2" in the package screen one more time this time and call it "new_var2_D" set the type to evaluate and then select the increment of -1
    13. the relevant procedure to "new_var2_D" with an OK
    14. join the "new_var2_D" to the "new_var2_E" with an OK
    15. this should close off the loop now the exit point is "new_var2_E" with a KO line to the next part of your process....
    Basically you should end up with a loop on new_var2 decementing, and it is used to get a specific next record row from your table.
    Hope this helps, sorry it is a little long winded..
    Edited by: DavidGD on Feb 8, 2009 3:29 PM

  • Executing a procedure in package

    Hi,
    How to execute a procedure in a package? Below is the package
    CREATE OR REPLACE PACKAGE BODY POPULATE_GLTD_TABLES
    IS
    -- LOCAL VARIABLES
    val1 VARCHAR2(10);
    -- Create some job objects:
    v_job1_str VARCHAR2(4000) ;
    v_job1 XXMCK.XXMCK_JOB_OT;
    PROCEDURE populate_gltd_tabs1
    IS
    BEGIN
    dbms_output.put_line('Get_status=> v_job1: ');
    val1:= F_CHECK_GLTD_RECORD_EXISTS('MCK_GLTD_1');
    IF val1 != 'S' THEN
    -- Include message details value - TRUE if yes and FALSE if no
    xxmck.mck_write_log_msg.set_msg_tail(TRUE);
    xxmck.mck_write_log_msg.purge('GLTD-TASK1');
    -- set context will define the source as well as inserts data into cont exit table
    xxmck.mck_write_log_msg.set_context(v_parent_program,v_prog_desc,'GLTD-TASK1');
    xxmck.mck_write_log_msg.log(v_parent_program,'Entering in LOAD_GLTD_TABLES.populate_gltd_tabs1 ','prg','GLTD-TASK1',1);
    xxmck.mck_write_log_msg.log_tail(v_parent_program,'Entering in LOAD_GLTD_TABLES.populate_gltd_tabs1 ','prg','GLTD-TASK1');
    v_job1_str := 'XXCOGNOS.LOAD_GLTD_TABLES.populate_gltd_tabs1;';
    v_job1 := NEW XXMCK.XXMCK_JOB_OT('GLTD-TASK1', v_job1_str, 'Background job test: LOAD_GLTD_TABLES.populate_gltd_tabs1', INTERVAL '60' SECOND);
    v_job1.PRINT(); -- Display basic info about the job
    v_job1.SUBMIT(); -- Submit in background
    v_job1.WAIT();
    v_job1.PRINT();
    v_job1.get_status(v_code, v_message);
    dbms_output.put_line('Get_status=> v_job1: ' || v_code || ':' || v_message);
    -- SELECT DECODE(cont_exit, 'cont', 'cont', 'err', 'err', 'cont') INTO v_result from MCK_LOG_CONT_EXIT_CHK WHERE source = 'GLTD-TASK1';
    --IF v_result = 'err' THEN
    -- raise_application_error(-20000,'Program Aborted');
    --END IF;
    END IF;
    EXCEPTION
    WHEN OTHERS THEN NULL;
    END populate_gltd_tabs1;
    PROCEDURE mainproc
    IS
    BEGIN
    populate_gltd_tabs1; -- CALL TO POPULATE mck_gltd_1 TABLE
    -- Mailing
    xxmck.mck_write_log_msg.send_mail( p_source_prg => v_parent_program
    ,p_source => 'GLTD-TASK1'
    ,p_msg_type => 'prg'
    ,p_from => '[email protected]'
    ,p_to => '[email protected]'
    ,p_server => 'mailhub.mckinsey.com'
    EXCEPTION
    WHEN OTHERS THEN NULL;
    END mainproc;
    END POPULATE_GLTD_TABLES;
    And below is my anonymous block to execute above package
    BEGIN
    POPULATE_MCK_GLTDFILE.mainproc;
    EXCEPTION -- exception handler begin
    WHEN OTHERS THEN NULL;
    END;
    I am trying to run above code in toad. But i am getting error as: identifier 'POPULATE_MCK_GLTDFILE.mainproc' must be declared.
    There are no parameters to be passed.
    The package is compiled successfully.
    I think this must be simplest question any one can I ask, but I cant figure out the solution.
    Please help,
    Aditya

    First remove the horrible exception handler(s) which are hiding all errors;
    ie the
    when others
    then
    null;
    end;Then remember the main syntax is
    begin
    packagename.procedurename;
    end;
    /But also remember that procedure name must be declared in the package header if you want to call it. (This is called a public procedure). A private procedure does not have to be declared in the package header and can only be called from within the same package body.
    I always use sqlplus for verification as that is delivered with oracle. You know if it works with sqlplus it will work with any othere client and if it does not, it's usually a client issue.
    from what you have posted, There is nothing obvious as to why it won't work.

  • Getting ORA-06512/ORA-00972 ERROR WHILE EXECUTING THE PROCEDURE????

    Hi ,
    while executing this procedure , I am getting follwoing errors:
    Create or Replace procedure ADD_CUSTOM_INDEX is
    INDX_NOT_EXIST Number;
    CREATE_SQL_STATMENT VARCHAR2(1500);
    ALTER_SQL_STATMENT VARCHAR2(150);
    CURSOR C1 IS select INDEX_NAME,CREATE_DDL FROM W_CUSTOM_TEST, WC_COMPANY_G WHERE W_CUSTOM_TEST.SYS_TENANT_ID = WC_COMPANY_G.BU_ID;
    BEGIN
    for V_ROW in C1 loop
         SELECT COUNT(USER_INDEXES.INDEX_NAME) INTO INDX_NOT_EXIST FROM USER_INDEXES WHERE USER_INDEXES.INDEX_NAME = V_ROW.index_name;
         IF INDX_NOT_EXIST = 0 THEN
         CREATE_SQL_STATMENT := ''|| '"'|| V_ROW.CREATE_DDL ||'"' ||'PARALLEL NOLOGGING';
         EXECUTE IMMEDIATE CREATE_SQL_STATMENT;
         ALTER_SQL_STATMENT := 'ALTER INDEX ' ||'"'|| V_ROW.INDEX_NAME ||'"'|| ' NOPARALLEL LOGGING';
         EXECUTE IMMEDIATE ALTER_SQL_STATMENT;
         END IF;
    END LOOP;
    END ADD_CUSTOM_INDEX;
    ERROR at line 1:
    ORA-00972: identifier is too long
    ORA-06512: at "LOLAP.ADD_CUSTOM_INDEX", line 13
    ORA-06512: at line 1.
    sturtuce of W_custom_test table is as below:
    CREATE TABLE "LOLAP"."W_CUSTOM_TEST"
    ("INDEX_NAME" VARCHAR2(30) NOT NULL ENABLE,
         "SYS_TENANT_ID" VARCHAR2(15) NOT NULL ENABLE,
    "CREATE_DDL" VARCHAR2(1200),
    "COMMENTS" VARCHAR2(200),
         "STAT_CD" VARCHAR2(30) DEFAULT 'Active' NOT NULL ENABLE,
         "CREATED" DATE DEFAULT SYSDATE NOT NULL ENABLE,
         "LAST_UPD" DATE DEFAULT SYSDATE NOT NULL ENABLE
    Any Pointer??????

    Hi
    Instead of giving as below, go for the not null constraints.
    "STAT_CD" VARCHAR2(30) DEFAULT 'Active' NOT NULL ENABLE,
    "CREATED" DATE DEFAULT SYSDATE NOT NULL ENABLE,
    "LAST_UPD" DATE DEFAULT SYSDATE NOT NULL ENABLE
    That should help
    Regards
    Sudheer

  • How to execute a procedure if out parameter is table type

    Hi,
    I need to execute a procedure, output parameter of the procedure is table type.
    Oracle version I am using is 9.2.0.8 . I am using SQL*Plus
    Procedure declaration
    PROCEDURE current_open_cycle (p_ban IN repl_cust2.billing_account.ban%TYPE,
    v_bill_seq_rec OUT bill_seq_table) ;
    Table type declaration
    TYPE bill_seq_table IS
    TABLE OF bill_seq_rectype INDEX BY BINARY_INTEGER ;
    TYPE bill_seq_rectype IS RECORD (v_cycle_run_year repl_cust2.bill.cycle_run_year%TYPE,
    v_cycle_run_month repl_cust2.bill.cycle_run_month%TYPE,
    v_cycle_code repl_cust2.bill.cycle_code%TYPE,
    v_open_cycle BOOLEAN, -- An open cycle
    v_billed_cycle BOOLEAN, --
    v_invoice_number VARCHAR2(13),
    v_start_date DATE,
    v_end_date DATE,
    v_root_ban repl_cust2.bill.root_ban%TYPE) ;
    I tried executing using this script, but it failed. When I execute this oracle lost connection to data base.
    declare
    r_bill_seq_rec ss_invoice_utilities.bill_seq_table;
    begin
    ss_invoice_utilities.current_open_cycle(934018003,r_bill_seq_rec);
    end;
    Please help me how I should write declare block to execute this procedure and also print output of the procedure.
    Regards
    Raghu

    I don't see anything wrong with the anonymous block, assuming ss_invoice_utilities is the correct package name. Perhaps a simplified test case would show up what's not working there.
    As for printing the contents of an associative array, you'll have to write some code to loop through it and construct a string per row to output via dbms_output, assuming the text will fit within dbms_output's size restrictions in 9i. dbms_output is a debugging tool though - is that the requirement?
    btw "pls_integer" is less to type than "binary_integer" ;)
    Edited by: William Robertson on Apr 16, 2009 8:35 AM

  • Unable to execute rules twice after applying Planning 9.3.1.1.11

    Hi All,
    Just wondering whether someone has come across this issue.
    We have just applied Planning 9.3.1.1.11 on a Windows platform.
    As a result, we are unable to execute the same rule twice from within the AAS console on any client machine and get the following error:
    "You must be connected to database to execute a rule."
    Once we get this error we cannot exeucte any other business tules and need to log back in to the AAS console to fix the problem.
    If we open up the AAS console on the AAS server, we can rule the rules as many times as we like. The error only comes up when executing a same rule from a client machine.
    In Planning web we can execute any business rules multiple times. However, if a user gets the above error in the AAS console, he/she is then unable to execute rules in Planning web unless he/she logs out and logs back in.
    We are using Planning 9.3.1.1.11, AAS 9.3.1.3.07 and HBR 9.3.1.1.11 on the server.
    However the AAS version on the client side is 9.3.1.1.9 and I think this may be what s causing the issue.
    The HBR patch for 9.3.1.1.11 is a server patch and cannot be installed on client machines. I am therefore unable to upgrade the AAS console on client machines to 9.3.1.1.11.
    Has anyone come across this?
    Thanks for your help.
    Seb

    Hi John,
    I worked it out last night... The readme for 9.3.1.1.11 is not very clear and I dont think it mentions patching each client.
    Below are the steps:
    1 - Close down the AAS console
    2 - Copy the newly deployed easclientplugin.jar, cmdlnlauncher.jar and identitymigration.jar from the AAS server and paste them under Hyperion\AnalyticAdministrationServices\console\lib on your client machine. Overwrite existing files if necessary.
    3 - Copy the new MigrateIdentities.bat from the AAS server and paste it under Hyperion\AnalyticAdministrationServices\console\bin on your client machine. Overwrite existing files if necessary.
    4 - Log on to the AAS console and go to Help - About and ensure that the HBR version is now 9.3.1.1.11
    5 - From the AAS console try and execute the same HBR twice.
    Thanks for your help.
    Seb

  • How to execute the procedure in sap b1

    Hai to all,
                 I done a procedure in sql server .but i don't know how to execute that  procedure in sap b1?
    can anyone help me immediately.
    Regards,
    Ramya.S

    Dear Ramya.S,
    You could execute the store procedure by using Recordset object in SDK DI code. It is like:
    Dim myRecordSet As SAPbobsCOM.Recordset
    myRecordSet =                                   
    SBO_Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecord
    set)
    myRecordSet.Command.Name = "TestStoredProcedure"
    myRecordSet.Command.Parameters.Item("@ItemLike").Value = "IT%"
    myRecordSet.Command.Parameters.Item(2).Value = "C0001"
    myRecordSet.Command.Execute()

Maybe you are looking for