Hoe to execute this procedure

hi
create or replace procedure spSelgl(brcode varchar2, p_return_cur OUT SYS_REFCURSOR ) is
begin
open p_return_cur for select * from mytable
where col1=brcode;
end spSelgl;
how can I execute this query in sql plus ?
Regards
Josh

Hi,
Try this to execute your procedure :-
declare
     v_brcode varchar2(20);
     v_p_return_cur SYS_REFCURSOR;
begin
spSelgl(
     brcode => v_brcode,
     p_return_cur =>v_p_return_cur
end;
Thanks
Pavan Kumar N

Similar Messages

  • How to execute this procedure(having out parameters)

    PROCEDURE emp_cursor (
    v_deptno IN VARCHAR2,
    v_doj OUT DATE,
    v_empno OUT NUMBER,
    v_sal OUT NUMBER
    );

    Hi,
    812809 wrote:
    PROCEDURE emp_cursor (
    v_deptno IN VARCHAR2,
    v_doj OUT DATE,
    v_empno OUT NUMBER,
    v_sal OUT NUMBER
    emp_cursor ( expr_1
               , var_2
               , var_3
               , var_4
               );Where var_2, var_3 and var_4 are variables with the appropriate data types. You must pass variables for the OUT parameters.
    Expr_1 can can a variable, a literal, or any other kind of expression that evaluates to a VARCHAR2.
    I hope this answers your question.
    If not, post a little a simple test script (with as much of the coding as you know how to do) so that people can re-create the problem and test their ideas. Post the results you want from that code. Explain how you get those results.
    Always say which version of Oracle you're using.

  • How to execute this Procedure and get the output?

    I have created a Procedure the source code of the same is furnished below.
    create or replace procedure vin_test( p_deptno IN number
    , p_cursor OUT SYS_REFCURSOR)
    as
    v_res Emp%rowtype;
    begin
    open p_cursor FOR
    select *
    from emp
    where deptno = p_deptno;
    end vin_test;
    Now, if i want to see the out put of this Proc
    i will first set the Serveroutput on and then..
    Exec vin_test(10);
    I am getting an error saying wrong number of arguments,so can anybody tell me what parameter value should i pass on so that i can get desired output.
    Thanks in Advance
    OraCrazy

    In sqlplus you can do like this.
    SQL> create or replace procedure vin_test( p_deptno IN number, p_cursor OUT SYS_REFCURSOR)
      2  as
      3     v_res Emp%rowtype;
      4  begin
      5     open p_cursor for
      6     select *
      7       from emp
      8      where deptno = p_deptno;
      9  end;
    10  /
    Procedure created.
    SQL> var lcur refcursor
    SQL> exec vin_test(30,:lcur)
    PL/SQL procedure successfully completed.
    SQL> print lcur
         EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO        DIV
          7499 ALLEN      SALESMAN        7698 20-FEB-81       1600        300         30         10
          7521 WARD       SALESMAN        7698 22-FEB-81       1250        500         30         10
          7654 MARTIN     SALESMAN        7698 28-SEP-81       1250       1400         30         10
          7698 BLAKE      MANAGER         7839 01-MAY-81       2850                    30         10
          7844 TURNER     SALESMAN        7698 08-SEP-81       1500          0         30         10
          7900 JAMES      CLERK           7698 03-DEC-81        950                    30         10
    6 rows selected.Thanks,
    Karthick.

  • How can I execute this procedure in sql developer, cursortype is refcursor

    PROCEDURE GET_CNTRY(CNTRY_NME_IN IN VARCHAR2 DEFAULT NULL,
    QRY_RSLT_OUT OUT CURSORTYPE) AS
    BEGIN
    OPEN QRY_RSLT_OUT FOR
    select
    CNTRY_NME,
    FRGN_CNTRY_CDE,
    INV_VEH_CNTRY_CDE,
    FRGN_CNCY_CDE,
    WTHH_PCT_COLA_CDE
    FROM
    CNTRY
    WHERE
    CNTRY_NME = NVL(CNTRY_NME_IN,CNTRY_NME);
    END GET_CNTRY;

    In SQL Developer run the following code as script (You need to hit F5 to run it as script).
    var rc refcursor
    exec get_cntry (<give your cntry_nme_in>, :rc)
    print :rc

  • When connecting to iTunes advised that the IPOD is corrupted and needs to be restored to factory settings.  I executed this procedure, but after reconnecting it again identifies that it is corrupted and needs to be restored.  Repeating did not resolve.

    When connecting to iTunes, the system responds that the Ipod id corrupted and needs to have the factory settings restored.  Factory settings are successfully installed, but response still identifies that the Ipod is corruped.  Several repeats stil give the same result.  Any other suggestions ?

    Hello CoulntThinkOfAUser,
    If you purchased the songs from the itunes store you wouldn't really loose anything. This is how to recover all of your previous purchases.
    How to download past purchases.
    Hope this helps.
    ~Julian

  • Error While executing a procedure

    Hello FOlks,
    When i try to execute this procedure below i get the error saying "Compiled with errors"
    ORA--00942-Table or View does not exist
    SQL Statement ignored at Line 17.
    I tried querying the table and it returns no data. How do i debug this error.
    create or replace procedure Load_FADM_Staging_Area_test(p_data_load_date date) is
    v_start_date                date;
    v_end_date                  date;
    begin
    if  p_data_load_date is null then
        select (sysdate - 7), (sysdate - 1) into v_start_date, v_end_date from dual;
      elsif p_data_load_date is not null then
       select (p_data_load_date - 7), (p_data_load_date - 1) into v_start_date, v_end_date from dual;
      else
        raise_application_error('-20042', 'Data control - GetDataControlAuditData : Date parameter must be a date of this or a previous week.');
      end if;
    insert into STAGE_FADM_HRI_STAGE_BILL
    (select
    a.batch_id 
    ,a.beginning_service_date 
    ,a.bill_id 
    ,a.bill_method 
    ,a.bill_number 
    ,a.bill_received_date 
    ,a.bill_status 
    ,a.bill_type 
    ,a.change_oltp_by 
    ,a.change_oltp_date 
    ,a.client_datafeed_code 
    ,a.client_id 
    ,a.created_date 
    ,a.date_of_incident 
    ,a.date_paid 
    ,a.deleted_oltp_by 
    ,a.deleted_oltp_date 
    ,a.duplicate_bill 
    ,a.ending_service_date 
    ,a.event_case_id 
    ,a.event_id 
    ,a.from_oltp_by 
    ,a.oltp_bill_status 
    ,a.review_status 
    ,'HRI' schema_name
    , sysdate Load_date
    ,'ETLPROCESS001' Load_user
    ,sysdate
    from stage_bill@hri1_read_only_remote a
    where
    --created_date >= to_date('20101031 235959', 'YYYYMMDD HH24MISS')
    created_date >= v_start_date
    and
    --created_date <= to_date('20101111 235959', 'YYYYMMDD HH24MISS')
      created_date <= v_end_date
    and not exists
    (select
    b.batch_id 
    ,b.beginning_service_date 
    ,b.bill_id 
    ,b.bill_method 
    ,b.bill_number 
    ,b.bill_received_date 
    ,b.bill_status 
    ,b.bill_type 
    ,b.change_oltp_by 
    ,b.change_oltp_date 
    ,b.client_datafeed_code 
    ,b.client_id 
    ,b.created_date 
    ,b.date_of_incident 
    ,b.date_paid 
    ,b.deleted_oltp_by 
    ,b.deleted_oltp_date 
    ,b.duplicate_bill 
    ,b.ending_service_date 
    ,b.event_case_id 
    ,b.event_id 
    ,b.from_oltp_by 
    ,b.oltp_bill_status 
    ,b.review_status
    ,b.Row_Effective_Date
    from STAGE_FADM_HRI_STAGE_BILL b))
    select
    e.action_plan  e_action_plan
    ,e.action_plan_status e_action_plan_status
    ,e.batch_id e_batch_id
    ,e.client_cause_code e_client_cause_code
    ,e.client_id e_client_id
    ,e.client_datafeed_code e_client_datafeed_code
    ,e.client_policy_identifier e_client_policy_identifier
    ,e.close_date e_close_date
    ,e.created_date e_created_date
    ,e.date_of_incident e_date_of_incident
    ,e.date_typed e_date_typed
    ,e.discovery_source e_discovery_source
    ,e.employer_group_id e_employer_group_id
    ,e.event_id e_event_id
    ,e.event_status_code  e_event_status_code
    ,e.event_type_code e_event_type_code
    ,e.exclude_from_invoice e_exclude_from_invoice
    ,e.from_ncoa_date e_from_ncoa_date
    ,e.group_contract_funding_type e_group_contract_funding_type
    ,e.hmo_ppo_indemnity_type e_hmo_ppo_indemnity_type
    ,e.insurance_product_name e_insurance_product_name
    ,e.insured_termination_date e_insured_termination_date
    ,e.invoice_date e_invoice_date
    ,e.letter_status e_letter_status
    ,e.letter_status_date e_letter_status_date
    ,e.liability_analysis e_liability_analysis
    ,e.loss_city e_loss_city
    ,e.loss_description e_loss_description
    ,e.loss_state_code e_loss_state_code
    ,e.manually_moved e_manually_moved
    ,e.moved_by_user_id e_moved_by_user_id
    ,e.ncoa_code e_ncoa_code
    ,e.next_steps e_next_steps
    ,e.open_date e_open_date
    ,e.policy_holder_address1 e_policy_holder_address1
    ,e.policy_holder_address2 e_policy_holder_address2
    ,ec.action_plan
    ,ec.action_plan_status
    ,ec.batch_id
    ,ec.case_status_code
    ,ec.client_datafeed_code
    ,ec.client_id
    ,ec.client_party_identifier
    ,ec.close_date
    ,ec.created_date
    ,ec.damaged_party_address1
    ,ec.damaged_party_address2
    ,ec.damaged_party_city
    ,ec.damaged_party_dob
    ,ec.damaged_party_first_name
    ,ec.damaged_party_gender
    ,ec.damaged_party_last_name
    ,ec.damaged_party_ssn
    ,ec.damaged_party_state_code
    ,ec.damaged_party_zip
    ,ec.deductible
    ,ec.deductible_applied
    ,ec.deductible_recovered
    ,ec.deductible_recovered_full
    ,ec.event_case_id
    ,ec.event_id
    ,ec.fee_schedule_code
    ,ec.internal_coverage_code
    ,ec.litigation_flag
    ,ec.loss_injury_description
    ,ec.next_steps
    ,ec.open_date
    ,ec.payment_coverage_code
    ,ec.pursuit_level_code
    ,ec.reject_code
    ,ec.reject_comments
    ,ec.reject_date
    ,ec.reject_date
    ,ec.reject_user_id
    ,ec.setup_type
    ,ec.tot_paid_at_close
    ,eccf.Client_field_data  eccf_client_fleld_data
    ,eccf.Client_field_name eccf_client_field_name
    ,eccf.Client_id eccf_client_id
    ,eccf.Event_case_id eccf_event_case_id
    ,ecf.client_field_data  ecf_client_field_data
    ,ecf.client_field_name ecf_client_field_name
    ,ecf.client_id ecf_client_id
    ,ecf.event_id  ecf_event_id
    from
    event@hri1_read_only_remote e,
    event_case@hri1_read_only_remote ec,
    event_case_client_field@hri1_read_only_remote eccf,
    event_client_field@hri1_read_only_remote ecf,
    stg_fadm_hri_stage_bill sb
    where
    e.event_id = ec.event_id and
    e.event_id = ecf.event_id  and
    ec.event_case_id = eccf.event_case_id and
    e.event_id = ecf.event_id and
    e.client_id = ecf.client_id and
    e.client_id = ec.client_id and
    ec.client_id = ecf.client_id and
    e.event_id = sb.event_id  and
    ec.event_case_id = sb.event_case_id and
    eccf.event_case_id = sb.event_case_id and
    ecf.event_id = sb.event_id;
    end Load_FADM_Staging_Area_TEST;

    Just noticed
    I tried querying the table and it returns no data.Could be your NOT EXISTS clause, you are missing something? - "Something" exists, unless the table is empty.
    Should probably be something like:
    AND NOT EXISTS (SELECT NULL -- You are actually not selecting anything, just probing for existence
                      WHERE  <<Correlation to table "a">>Furthermore, you'll never manage to compile the procedure since your second select does not select INTO anything.
    (A more apprpriate subject would be "Error while compiling a procedure".)
    Finally, When would the ELSE be reached here?
    if p_data_load_date IS NULL then
        select (sysdate - 7), (sysdate - 1) into v_start_date, v_end_date from dual;
    elsif p_data_load_date IS NOT NULL then
        select (p_data_load_date - 7), (p_data_load_date - 1) into v_start_date, v_end_date from dual;
    ELSE
        raise_application_error('-20042', 'Data control - GetDataControlAuditData : Date parameter must be a date of this or a previous week.');
    end if;Regards
    Peter

  • 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.

  • Error while executing PlSQL Procedure

    Hi Chris,
    Procedure SPR_VISAMAST_SWITCHCATEGORIZE is created in the TimesTen interchange user. and all object used by this procedure also cached in the TimesTen.
    While executing it is giving error.
    I traced out where execution is failing, i found that update query on cached table it is giving error.
    Command> DECLARE
    > SOUTPUT VARCHAR2(4000);
    > BEGIN
    > INTERCHANGE.SPR_VISAMAST_SWITCHCATEGORIZE('123456', 'SWTCH.030709', 'v2.01', 'fl.01' , 'v2.02' , '1' , SOUTPUT);
    > END;
    > /
    5213: Bad Oracle login error in OCISessionBegin(): ORA-01017: invalid username/password; logon denied rc = -1
    5131: Cannot connect to backend database: OracleNetServiceName = "geni11g", uid = "INTERCHANGE", pwd is hidden, TNS_ADMIN = "/u01/app/oracle/product/11.1.0/db_1/network/admin", ORACLE_HOME= "/u01/app/oracle/product/11.1.0/db_1"
    8507: ORA-06512: at "INTERCHANGE.SPR_VISAMAST_SWITCHCATEGORIZE", line 39
    8507: ORA-06512: at line 4
    The command failed.
    Please tell me how to solve this issue.

    So when you execute this procedure it is actually executing as user INTERCHANGE. Any objects that the procedure references whcih do not include an explicit owner will assume the object is owned by user INTERCHANGE and this may mean that an object cannot be found.
    Here is an example...
    Let's say you have a cached table in TimesTen and the table is owned by the user 'CACHEUSER' - CACHEUSER.MyCachedtable.
    If you create a PL/SQL procedure owned by the user INTERCHANGE - INTERCHANGE.Someprocedure and within thie procedure include a statement like SELECT * FROM MyCachedtable then when the procedure is executed it will by default always look for the table INTERCHANGE.MyCachedTable even if the user executing the procedure is 'CACHEUSER'. As a result, it would not find the table MyCachedTable in TimesTen and, depending on the setting for PassThrough it might try and go to Oracle for this table.
    Another possibility is that the PL/SQL procedure is performing some cache operation that requires interaction with the Oracle DB and you did not include 'OraclePWD=xxx' to provide the password for Oracle when you connected. Remember that the procedure will be executing, by default, as the user INTERCHANGE not as the user 'CACHEUSER'.
    Chris

  • 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

  • Not able to execute a procedure from Process

    Hi
    I have created a Tabular Form type region.
    And I have created a Database procedure to insert records into some other table.
    Inorder to execute this procedure I was trying to create a PL/SQL Page process.
    When I am trying to enter the procedure details it is giving below error.
    1 error has occurred
    ORA-06550: line 3, column 1: PLS-00201: identifier 'XXSURCHARGE_PKG.INSERT_INTO_MAIN' must be declared ORA-06550: line 3, column 1: PL/SQL: Statement ignored
    But I am able to create a page process with same procedure in another application.
    Is there any restrictions on Tabular Form type regions.
    Regards
    Kiran Akkiraju

    Hi
    I am able to find out the problem. Application was created on a particular Schema and procedure was created another schema. So, there was a permission issue.
    Regards
    Kiran Akkiraju

  • Can you tell me how to execute the procedure?

    create or replace get_dob
    (ss_number varchar2,dob out date)
    as
    begin
    select birth_dae
    into dob
    from person
    where soc_sec_num=ss_num;
    exception when no_data_found
    error_notify(ss_num);
    end;
    the question is that when i want to execute this procedure,how can I use the command?
    I try to use the "execute get_dob('wang');"in the sql/plus,but the system give me wrong information.

    Errors:
    1. You left out the word PROCEDURE after CREATE OR REPLACE.
    2. You used ss_number in one place and ss_num in two others. These must be the same name.
    3. You left out the word THEN after WHEN NO_DATA_FOUND.
    Possible errors:
    1. Is birth_dae spelled correctly? Or, should it be birth_date?
    2. Is error_notify a user-defined procedure?
    Additional suggestions:
    1. It is better to use table_name.column_name%TYPE instead of specifying NUMBER, VARCHAR2, DATE, etc. for your parameters. That way if the column data types are changed in the future, you don't have to change your code.
    2. You will need to SET SERVEROUTPUT ON and use DBMS_OUTPUT.PUT_LINE to display the contents of the variable that holds the value of the out parameter.
    3. Please see suggested code for creation of procedure and execution of procedure below. I have included one row of test data so that some output will be displayed. I commented out the exception section, in order to test it, since I don't have your error_notify procedure.
    SQL> -- test data:
    SQL> CREATE TABLE person
      2    (birth_dae   DATE,
      3     soc_sec_num NUMBER)
      4  /
    Table created.
    SQL> INSERT INTO person
      2  VALUES (SYSDATE, '123456789')
      3  /
    1 row created.
    SQL> SELECT * FROM person
      2  /
    BIRTH_DAE SOC_SEC_NUM
    06-DEC-02   123456789
    SQL>
    SQL>
    SQL> -- create procedure:
    SQL> CREATE OR REPLACE PROCEDURE get_dob
      2    (ss_number IN  person.soc_sec_num%TYPE,
      3     dob       OUT person.birth_dae%TYPE)
      4  AS
      5  BEGIN
      6    SELECT birth_dae
      7    INTO      dob
      8    FROM      person
      9    WHERE  soc_sec_num = ss_number;
    10  -- EXCEPTION
    11  --  WHEN NO_DATA_FOUND THEN
    12  --    error_notify (ss_number);
    13  END get_dob;
    14  /
    Procedure created.
    SQL> SHOW ERRORS
    No errors.
    SQL>
    SQL>
    SQL> -- execute procedure:
    SQL> SET SERVEROUTPUT ON
    SQL> DECLARE
      2    v_dob DATE;
      3  BEGIN
      4    get_dob ('123456789', v_dob);
      5    DBMS_OUTPUT.PUT_LINE (v_dob);
      6  END;
      7  /
    06-DEC-02
    PL/SQL procedure successfully completed.

  • How to execute my procedure automatically every second

    dear all
    i made a procedure that simply insert a record in a table . i need to execute this procedure automatiaclly every one second. how can i achive this. please help

    well , i'm going to tell you what exactly is the business.
    we have two distributed databases , 'local_db' and 'remote_db'.
    'local_db' is ours, i mean we desinged and created it . it contains our own views tables. but it contains no data at all.
    we get our data from the remote_db. this remote_db is located on the stock exchange. it is not ours, we did not create it, but we have the privilage to read form its tables.(only select ). in other words , the stock exchange is the our data vendor.
    tha changes that takes palce in the remote_db occures every second.And i urgently need to copy these changes on time to my database(local_db)

  • How to execute a procedure from BODI?

    Hi Pals ,
    I have procedure in my database say EMP_PROC. I want to execute this procedure from the BODI environment.Please do let me know.
    Thanks in advance.
    Regards,
    Diras

    you have to import the stored procedure in the datastore
    and after importing you can call the stored procedure in the mapping
    use import by name option in datastore, and select function in type and enter the name of stored proc that you want to use in DI
    check technical manual for more details on importing functions and stored procedure

  • How execute this stored procedure from SQL PLUS???

    Hello folks....
    Help me please...
    I have this procedure....
    CREATE OR REPLACE PROCEDURE TEST(COD OUT VARCHAR2, NUM OUT
    VARCHAR2, ID OUT VARCHAR2)
    AS
    BEGIN
    END;
    SO, I4D LIKE TO EXECUTE IT FROM SQL PLUS::
    BUT, I DONT KNOW HOW TO DO..PLEASE SEND ME A SAMPLE..
    THANK U

    Thank u man!!!
    look, my error before was :
    SQL> set serveroutput on
    SQL> declare
    SQL> cod varchar2(100);
    SQL> num varchar2(100);
    SQL> id varchar2(100);
    SQL> begin
    SQL> TEST( cod, num, id );
    SQL> EXEC DBMS_OUTPUT.put_line( cod || ' ' || num || ' ' ||
    id );
    SQL> end;
    SQL> /
    i put the EXEC....
    thank u!!!

Maybe you are looking for

  • 2-column elastic layout and size of text/image

    Hello, I'm using the 2-column-elastic template of Dreamweaver CS4 and have got a few questions related to its use. As far as I understand it (I'm new to HTML, CSS, etc.), it is elastic because the dimensions of the divs are defined with the unit "em"

  • Comportement de serveur non affiché dans le panneau des comportements de serveurs

    Bonsoir, Je dispose d'une page développée en PHP - MySql qui contient un formulaire d'ajout de données en base. Lors de la création de la page, le comportement de serveur d'insertion de données était bien affiché dans le panneau des comportements mai

  • How to open the body of nokia N72

    It seems that some moisture has entered my Nokia N72 since last 10 hours the screen appears grey and there is a display problem. Can any one help me by showing me how to open the body of Nokia N72 by step by step description or diagrammatically?

  • Hide/Unhide Button on a Custom Form?

    Hello!  I am looking for some ideas regarding the ability to hide/unhide a button on a custom form.  Ideally, I would like to create an authorization group, if a user is a member of the authorization group, they can see the button, if not, the button

  • Manual Reservations Integration Model

    Hello All, In our project, during Go-live we dint had manual reservation Integration Model Activated due to some business reason.  whenver a process order is created in R/3, Reservations for Components appear in R/3 and APO. Now when the components a