30EA2 dbms_output.put_line not working

Hi All,
I've testing new release SQL Developer and
the code bellow is not put any data to output? Is it an issue new version ?
BEGIN
dbms_output.put_line('[text]');
END;
SQL Developer
Version 3.0.02
Build MAIN-02.83
Thank you in advance
Edvard

Hi Edvard,
Yes, dbms_output is borked on 3.0EA2, but you can make it work if you put 'SET SERVEROUTPUT ON' in front of your statement:
SET SERVEROUTPUT ON
BEGIN
dbms_output.put_line('[text]');
END;
And run it as a script (F5 on Windows, I think)
See EA2: Dbms Output broken? for more.

Similar Messages

  • DBMS_OUTPUT.PUT_LINE not working in Stored Functions

    Hi All,
    I have one doubt, why is dbms_output.put_line not supported in Stored Functions?
    create or replace function func_in_sql(var number) return varchar2
    is
    begin
    If var is not null then
    return to_char(dbms_output.put_line(var));
    else
    return to_char(dbms_output.put_line('null'));
    end if;
    end;
    Returns error -
    LINE/COL ERROR
    5/3 PL/SQL: Statement ignored
    5/18 PLS-00222: no function with name 'PUT_LINE' exists in this scope
    7/3 PL/SQL: Statement ignored
    7/18 PLS-00222: no function with name 'PUT_LINE' exists in this scope
    Any idea why this is happening?
    I know that to print value one can just use return statement and value will be printed in SQL Prompt.
    But what makes me think is why error for PUT_LINE method?
    If error is not thrown at DBMS_OTUPUT then doesnt that mean all methods of DBMS_OUTPUT should be accessible in a function.
    Thanks in advance!
    Av.

    Hi,
    For cant call proc inside func, or in-line thing you mentioned, just tried following -
    Here is our previous Func -
    create or replace function func_in_sql(var number) return varchar2
    is
    begin
    /*If var is not null then
    return to_char(dbms_output.put_line(var));
    else
    return to_char(dbms_output.put_line('null'));
    end if;
    exception_test;
    return 'a';
    end;
    and here is our proc -
    procedure exception_test
    as
    v_count1 number;
    v_count2 number;
    begin
    select count(test_id)
    INTO V_COUNT1
    from TEST_TABLE;
    If SQL%NOTFOUND Then
    dbms_output.put_line('notfound');
    End If;
    dbms_output.put_line(v_count1);
    exception
    when no_data_found then
    If SQL%NOTFOUND Then
    dbms_output.put_line('notfound');
    End If;
    dbms_output.put_line('no_data');
    WHEN TOO_MANY_ROWS THEN
    dbms_output.put_line('too many rows');
    when others then
    dbms_output.put_line('others');
    end;
    and here is the call to func -
    SQL> select func_in_sql(x) from t1;
    FUNC_IN_SQL(X)
    a
    a
    a
    a
    4 rows selected.
    So this shows it works.
    Is this what you said? or Am I getting you wrong?
    Thanks!
    Av.

  • Oracle 10.1.0.4.2 SQL Plus dbms_output.put_line not working

    I am using Oracle 10.1.0.4.2 SQL Plus, and dbms_output.put_line is not working. It returns the dbms_output ONLY from outside the procedure. I have dbms_output INSIDE my procedure, and none of it gets returned. Please help!
    Here is what I enter:
    set serveroutput on size 1000000;
    DECLARE
         x number:=0;
    begin
    DBMS_OUTPUT.ENABLE;
    c2reports.c2proc(x,'TEST');
    DBMS_OUTPUT.PUT_LINE('testX');
    END;
    testX
    There should be more besides the 'testX' that gets returned. The first line in my procedure has output code to print testY. Thanks in advance!

    This is the forum for the Oracle's SQL Developer (Not for general SQL/PLSQL questions). You should ask question like this in the PL/SQL forum

  • Dbms_output.put_line not working

    Hi, i am trying to use dbms_output.put_line to execute a sql in a bat script on windows...i get no errors , but the "alter tablespace" just prints but does not execute.
    What exactly am i missing? Part of the script shown below..
    thanks
    set HFILE=%SCRIPT_HOME%\remove_bkupmode.sql
    echo connect sys/%INTPWD% as sysdba >>%HFILE%
    echo set termout off heading off feedback off >>%HFILE%
    echo set linesize 300 pagesize 0 >>%HFILE%
    echo set serveroutput on size 1000000 >>%HFILE%
    echo spool %SCRIPT_HOME%\cleanup.sql >>%HFILE%
    echo Declare >>%HFILE%
    echo cursor c1 is SELECT t.name FROM V$DATAFILE d, V$TABLESPACE t, V$BACKUP b WHERE d.TS#=t.TS# AND b.FILE#=d.FILE# AND b.STATUS='ACTIVE'; >>%HFILE%
    echo Begin >>%HFILE%
    echo for tbs in c1 loop >>%HFILE%
    echo   dbms_output.put_line(' alter tablespace '^|^|tbs.name ^|^|' end backup;');  >>%HFILE%
    echo end loop; >>%HFILE%
    echo dbms_output.put_line('exit;'); >>%HFILE%
    echo End; >>%HFILE%
    echo / >>%HFILE%
    echo spool off >>%HFILE%
    echo exit; >>%HFILE%
    START /wait SQLPLUS /NOLOG @%HFILE%

    thanks guys...did i bring back memories?
    yeah its an old script. part of an old hot backup script i inherited, for a 24/7 live 9.2.0.1 database that can't be upgraded due to customizations lol
    i setup rman, but since i'n still new to rman, i wanted to continue with the user- managed hot backups
    this script will run afer the backup, just in case, to ensure that no tablespaces are left in backup mode.
    J

  • Dbms_output.put_line not printing in inner for loop using a parameter

    I cannot get the inner loop to print output. I can run both loops independent (hardcoding a value for the inner loop) Any help is apprecicated... Listed is the code
    set serveroutput on
    DECLARE
    cursor ACCNO_CUR is
    select accession_number from didb_studies where insert_time > to_date('02-JUN-12');
    cursor PATH_CUR (p1_accno VARCHAR2) is
    select distinct l.FILE_SYSTEM || '/' ||
    substr(LPAD(s.PATIENT_DB_UID, 12, '0'),1,3) || '/' ||
    substr(LPAD(s.PATIENT_DB_UID, 12, '0'),4,3) || '/' ||
    substr(LPAD(s.PATIENT_DB_UID, 12, '0'),7,3) || '/' ||
    substr(LPAD(s.PATIENT_DB_UID, 12, '0'),10,3) || '/' ||
    s.STUDY_DB_UID || '/' || i.SERIES_DB_UID || '/'||
    i.RAW_IMAGE_DB_UID || '.img' as FULLY_QUALIFIED_IMAGE_NAME
    , l.image_size
    , i.image_need_backup
    , i.sop_class_uid
    from medistore.didb_studies s
    , medistore.didb_raw_images_table i
    , medistore.didb_image_locations l
    where s.accession_number = 'p1_accno'
    and s.study_db_uid = i.study_db_uid
    and i.raw_image_db_uid = l.raw_image_db_uid
    and l.file_system is not null and INSTR(l.file_system, '.img') = 0
    UNION
    select distinct(l.FILE_SYSTEM) as FULLY_QUALIFIED_IMAGE_NAME
    , l.image_size
    , i.image_need_backup
    , i.sop_class_uid
    from medistore.didb_studies s, medistore.didb_raw_images_table i,
    medistore.didb_image_locations l
    where s.accession_number = 'p1_accno'
    and s.study_db_uid = i.study_db_uid
    and i.raw_image_db_uid = l.raw_image_db_uid
    and l.file_system is not null and INSTR(l.file_system, '.img') > 0
    order by 1;
    BEGIN
    FOR accno_rec in accno_cur LOOP
    DBMS_OUTPUT.put_line('ACCESSION_NUMBER is: '|| accno_rec.accession_number);
    FOR path_rec in path_cur(accno_rec.accession_number) LOOP
    DBMS_OUTPUT.put_line('Inner loop accession_number is :'||accno_rec.accession_number);
    DBMS_OUTPUT.put_line('Full path is : ' || path_rec.FULLY_QUALIFIED_IMAGE_NAME);
    END LOOP;
    END LOOP;
    END;

    Maybe
    DECLARE
      cursor ACCNO_CUR is
        select accession_number
          from didb_studies
         where insert_time > to_date('02-JUN-12');
      cursor PATH_CUR (p1_accno VARCHAR2) is
        select distinct
               l.FILE_SYSTEM || '/' ||
               substr(LPAD(s.PATIENT_DB_UID, 12, '0'),1,3) || '/' ||
               substr(LPAD(s.PATIENT_DB_UID, 12, '0'),4,3) || '/' ||
               substr(LPAD(s.PATIENT_DB_UID, 12, '0'),7,3) || '/' ||
               substr(LPAD(s.PATIENT_DB_UID, 12, '0'),10,3) || '/' ||
               s.STUDY_DB_UID || '/' || i.SERIES_DB_UID || '/'||
               i.RAW_IMAGE_DB_UID || '.img' as FULLY_QUALIFIED_IMAGE_NAME,
               l.image_size,
               i.image_need_backup,
               i.sop_class_uid
          from medistore.didb_studies s,
               medistore.didb_raw_images_table i,
               medistore.didb_image_locations l
         where s.accession_number = to_number(p1_accno) /* to_char(s.accession_number) = p1_accno */
           and s.study_db_uid = i.study_db_uid
           and i.raw_image_db_uid = l.raw_image_db_uid
           and l.file_system is not null
           and INSTR(l.file_system, '.img') = 0
        UNION
        select distinct
               l.FILE_SYSTEM as FULLY_QUALIFIED_IMAGE_NAME,
               l.image_size,
               i.image_need_backup,
               i.sop_class_uid
          from medistore.didb_studies s,
               medistore.didb_raw_images_table i,
               medistore.didb_image_locations l
         where s.accession_number = to_number(p1_accno) /* to_char(s.accession_number) = p1_accno */
           and s.study_db_uid = i.study_db_uid
           and i.raw_image_db_uid = l.raw_image_db_uid
           and l.file_system is not null and INSTR(l.file_system, '.img') > 0
         order by 1;
    BEGIN
      FOR accno_rec in accno_cur
      LOOP
        DBMS_OUTPUT.put_line('ACCESSION_NUMBER is: '|| accno_rec.accession_number);
        FOR path_rec in path_cur(accno_rec.accession_number)
        LOOP
          DBMS_OUTPUT.put_line('Inner loop accession_number is :'||accno_rec.accession_number);
          DBMS_OUTPUT.put_line('Full path is : ' || path_rec.FULLY_QUALIFIED_IMAGE_NAME);
        END LOOP;
      END LOOP;
    END;Regards
    Etbin

  • Dbms_output.put_line not displaying anything

    I am running the below code (ssn_run.sql) using sqlplus 10.2.0.1.0 on my windows XP professional client PC.
    The database is a Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit running on Solaris
    I cracked my head for about one hour but couldn't figure out this :
    accept input_ssn prompt 'Enter SSN :'
    set feedback on
    set serveroutput on
    set echo on
    set term on
    set heading on
    set pagesize 0
    set linesize 10000
    set verify on
    undefne sdate input_ssn
    col sdate new_value sdate
    col input_ssn new_value input_ssn
    select to_char(sysdate,'YYYYMMDD') sdate from dual;
    spool C:\PERSON_DATA_&&sdate._&&input_ssn..TXT
    select 'REPORT GENERATED ON : '||SYSDATE FROM DUAL;
    begin
    select personid into v_personid from person where SIN = '&&input_ssn';
    INSERT INTO PERSON_OLD
    (PERSONID, TITLE, FNAME, MNAME, LNAME, ACFM, SIN, UNAME, AKANAME, DCFM,
    IROWID, SUFFIX, PTYPE, OLD_SSN)
    SELECT PERSONID, TITLE, FNAME, MNAME, LNAME, ACFM, SIN, UNAME,
    AKANAME, SIN FROM PERSON WHERE SIN = '&&input_ssn';
    INSERT INTO MEMBER_OLD
    (CLNT, MKEY, PERSONID, MEMNO, OLD_MEMNO)
    SELECT CLNT, MKEY, PERSONID, MEMNO,MEMNO
    FROM MEMBER WHERE PERSONID IN(SELECT PERSONID FROM PERSON WHERE SIN = '&&input_ssn');
    UPDATE PERSON SET FNAME = TRANSLATE(SIN,'0123456789','ACEGIKMOQS'),
    LNAME = TRANSLATE(SIN,'0123456789','SQOMKIGECA'),
    UNAME = TRANSLATE(SIN,'0123456789','ACEGIKMOQS')||' '||TRANSLATE(SIN,'0123456789','SQOMKIGECA'),
    AKANAME=NULL WHERE SIN = '&&input_ssn';
    UPDATE MEMBER SET MEMNO = MKEY WHERE PERSONID IN(SELECT PERSONID FROM PERSON WHERE SIN = '&&input_ssn');
    for i in(select personid person_other from person_relation where relpersonid in(select personid from
    person where PERSONID = v_personid))
    loop
    dbms_output.put_line('i.person_other is : '||i.person_other);
    UPDATE MEMBER SET MEMNO = MKEY WHERE PERSONID = i.person_other;
    end loop;
    EXCEPTION
    WHEN OTHERS THEN
         ecode := SQLCODE;
         emesg := SQLERRM;
         dbms_output.put_line('Error while data scrubbing: Error code is : ' || ' - ' || ecode);
         dbms_output.put_line('Error message is :' || ' - ' || emesg);
    end;
    spool off;
    set term on
    set feedback on
    set HEADING on
    set verify on
    --End of code
    The SELECT statement that comes in the for loop should return data as v_personid has a value. (I tested this by a select statement)
    However, I am just not able to display the line which comes in the inner loop :
    dbms_output.put_line('i.person_other is : '||i.person_other);
    The result of this dbms output put_line neither shows up on the screen, nor it gets written to the spool file...I am stumped with this...
    The other dbms_output put_lines that display error displays okay, but not the one in the inner loop.... Can someone help me out if you see any obvious issues here........
    Also my UPDATE MEMBER statement inside the for loop doesn't do anything whereas it was supposed to update a row !!
    Thanks

    You could display the number the query return by adding;
    v_count number;After you assign v_personid;
    dbms_output.put_line('v_personid  is : '||v_personid );
    (select count(*)
    into v_count
    from person_relation
    where relpersonid in(
       select personid
       from person
       where PERSONID = v_personid)).
    dbms_output.put_line('v_count  is : '||v_count );

  • DBMS_OUTPUT.PUTLINE Not Working

    I am new to Application express.I am unable to display anything on the screen (under the Results tab) in SQL Commands. I have the following program:
    set serveroutput on;
    Declare
    vfirstname varchar2(35);
    vlastname varchar2(35);
    ccounter CONSTANT NUMBER:=0;
    begin
    select first_name, last_name into vfirstname, vlastname
    from student_sby
    where student_id=123;
    dbms_OUTPUT.PUT_LINE ('student name: ' || ' ' || vlastname);
    end;
    When I run the program, it does not produce any error and any out put.
    If I just have the select statement I get the results displayed.
    select first_name, last_name
    from student_sby
    where student_id=123;
    Any help will be appreciated. I am using Oracle Application Express version 4.x.

    If you want to see debug information perhaps it's best if you use APEX_DEBUG_MESSAGE http://docs.oracle.com/cd/E17556_01/doc/apirefs.40/e15519/apex_debug.htm
    For a quick output, use htp.p in a PL/SQL Region.
    Like this
    Declare
    vfirstname varchar2(35);
    vlastname varchar2(35);
    ccounter CONSTANT NUMBER:=0;
    begin
    select first_name, last_name into vfirstname, vlastname
    from student_sby
    where student_id=123;
    htp.p ('student name: ' || ' ' || vlastname);
    end;
    That will output the message to the page.
    Thanks
    -Jorge

  • Sale Order Api Is not working

    Hi experts ,
    I am trying to load the data via api , Its not getting load , can u help me pls ,
    DECLARE
    l_line_id NUMBER;
    l_item_id NUMBER;
    l_order_qty NUMBER;
    l_msg_index number;
    L_data VARCHAR2 (2000);
    l_debug_file VARCHAR2 (200);
    resultout VARCHAR2 (100);
    l_order_uom VARCHAR2 (10);
    l_reship_order NUMBER;
    itemkey number := 215600;
    l_negative_prorate NUMBER;
    l_prorate_qty NUMBER;
    l_sch_ship_date DATE;
    l_debug_level NUMBER := 3;
    l_ship_to_org_id NUMBER;
    l_attribute1 VARCHAR2 (150);
    l_attribute2 VARCHAR2 (150);
    l_line_num NUMBER;
    l_agreement_id NUMBER;
    l_organization_id NUMBER;
    l_segment VARCHAR2 (120);
    l_child_onhand NUMBER := 0;
    l_qty_temp NUMBER := 0;
    l_excl_temp NUMBER := 0;
    l_prorate_percent NUMBER;
    l_onhand NUMBER;
    l_error VARCHAR2 (240);
    l_error_message VARCHAR2 (240);
    l_line_tbl oe_order_pub.line_tbl_type;
    l_line_tbl_count NUMBER := 0;
    l_temp_count NUMBER := 0;
    p_line_tbl_rec oe_order_pub.line_tbl_type;
    p_line_id NUMBER;
    p_error_flag VARCHAR2 (1000);
    p_error_message VARCHAR2 (1000);
    l_api_version_number NUMBER := 1;
    l_return_status VARCHAR2 (2000);
    l_return_status1 VARCHAR2 (2000);
    l_msg_count NUMBER;
    l_msg_data VARCHAR2 (2000);
    -- l_msg_index VARCHAR2 (1000);
    l_line_out_tbl oe_order_pub.line_tbl_type;
    p_parent_item VARCHAR2 (100) := 'PROPANE';
    p_organization_id NUMBER := 321;
    l_header_id NUMBER := 152066;
    --- Child Cursor Without Exclusion of Soldado
    CURSOR c_child_items (
    p_parent_item VARCHAR2,
    p_organization_id NUMBER
    IS
    CURSOR c_positive_items (
    p_parent_item VARCHAR2,
    p_organization_id NUMBER
    IS
    SELECT inventory_item_id,
    segment1,
    organization_id,
    SUM (onhand - order_qty) onhand,
    COUNT ( * ) OVER () total_rows
    FROM ( SELECT msi.inventory_item_id,
    msi.segment1,
    msi.organization_id,
    NVL (
    SUM(inv_convert.inv_um_convert_new (
    moq.inventory_item_id,
    5,
    moq.transaction_quantity,
    moq.transaction_uom_code,
    l_order_uom,
    NULL,
    NULL,
    'U'
    0
    onhand,
    (SELECT NVL (SUM (ordered_quantity), 0)
    FROM oe_order_lines_all
    WHERE header_id = l_header_id
    AND flow_status_code NOT IN
    ('CLOSED', 'SHIPPED')
    AND inventory_item_id =
    msi.inventory_item_id)
    order_qty
    FROM mtl_system_items_b msi,
    oe_lookups ol,
    mtl_onhand_quantities_detail moq
    WHERE msi.segment1 = ol.meaning
    AND TRIM (SYSDATE) BETWEEN ol.start_date_active
    AND NVL (ol.end_date_active,
    TRIM (SYSDATE))
    AND ol.enabled_flag = 'Y'
    AND ol.lookup_type = p_parent_item
    AND msi.organization_id = p_organization_id
    AND msi.inventory_item_id = moq.inventory_item_id(+)
    AND msi.organization_id = moq.organization_id(+)
    AND (msi.segment1 LIKE '%SOLDADO%'
    OR msi.segment1 LIKE '%T4%')
    GROUP BY msi.inventory_item_id,
    msi.segment1,
    msi.organization_id)
    GROUP BY inventory_item_id, segment1, organization_id
    HAVING SUM (onhand - order_qty) > 0
    ORDER BY segment1;
    --- Child Cursor With only Positive Buckets
    CURSOR c_positive_onhand (
    p_parent_item IN VARCHAR2,
    p_organization_id IN NUMBER
    IS
    BEGIN
    IF (l_debug_level > 0)
    THEN
    l_debug_file := oe_debug_pub.set_debug_mode ('FILE');
    oe_debug_pub.initialize;
    oe_debug_pub.setdebuglevel (l_debug_level);
    oe_msg_pub.initialize;
    END IF;
    --- Initialization Block
    DBMS_OUTPUT.put_line ('Initialization Block');
    fnd_global.apps_initialize (fnd_global.user_id,
    fnd_global.resp_id,
    fnd_global.resp_appl_id);
    -- BEGIN
    -- MO_GLOBAL.SET_POLICY_CONTEXT ('S', 321);
    -- END;
    -- fnd_global.apps_initialize (-1, 21623, 660);
    --- Get Line ID from workflow
    l_line_id := TO_NUMBER (itemkey);
    --- To get the line details
    BEGIN
    SELECT header_id,
    ordered_item,
    inventory_item_id,
    line_number,
    order_quantity_uom,
    ordered_quantity,
    ship_from_org_id,
    ship_to_org_id,
    schedule_ship_date,
    attribute1,
    attribute2,
    agreement_id
    INTO l_header_id,
    l_segment,
    l_item_id,
    l_line_num,
    l_order_uom,
    l_order_qty,
    l_organization_id,
    l_ship_to_org_id,
    l_sch_ship_date,
    l_attribute1,
    l_attribute2,
    l_agreement_id
    FROM oe_order_lines_all
    WHERE line_id = l_line_id;
    DBMS_OUTPUT.put_line ('To get the line details');
    EXCEPTION
    WHEN OTHERS
    THEN
    l_header_id := NULL;
    l_segment := NULL;
    l_item_id := NULL;
    l_order_qty := NULL;
    l_organization_id := NULL;
    DBMS_OUTPUT.put_line ('Not Avilable for To get the line details');
    END;
    -- To get the Original sales order Number
    BEGIN
    SELECT attribute10
    INTO l_reship_order
    FROM oe_order_headers_all
    WHERE header_id = l_header_id;
    EXCEPTION
    WHEN OTHERS
    THEN
    l_reship_order := NULL;
    END;
    --- Check for the Top Level Item Name
    IF l_segment IN ('PROPANE', 'BUTANE', 'ISO BUTANE', 'GASOLINE')
    THEN
    --- To get the total positive onhand quantity for all the child items
    BEGIN
    SELECT NVL (SUM (trx_qty), 0)
    INTO l_onhand
    FROM ( SELECT moq.inventory_item_id,
    NVL (
    SUM(NVL (
    inv_convert.inv_um_convert_new (
    msi.inventory_item_id,
    5,
    moq.transaction_quantity,
    moq.transaction_uom_code,
    l_order_uom,
    NULL,
    NULL,
    'U'
    0
    - (SELECT NVL (SUM (ordered_quantity), 0)
    FROM oe_order_lines_all
    WHERE header_id = l_header_id
    AND flow_status_code NOT IN
    ('CLOSED', 'SHIPPED')
    AND inventory_item_id =
    msi.inventory_item_id),
    0
    trx_qty
    FROM mtl_onhand_quantities_detail moq,
    mtl_system_items msi,
    oe_lookups ol
    WHERE msi.segment1 = ol.meaning
    AND TRIM (SYSDATE) BETWEEN ol.start_date_active
    AND NVL (
    ol.end_date_active,
    TRIM (SYSDATE)
    AND ol.enabled_flag = 'Y'
    AND ol.lookup_type = l_segment
    AND msi.organization_id = l_organization_id
    AND moq.inventory_item_id = msi.inventory_item_id
    AND moq.organization_id = msi.organization_id
    AND (msi.segment1 NOT LIKE '%SOLDADO%'
    AND msi.segment1 NOT LIKE '%T4%')
    GROUP BY msi.inventory_item_id, moq.inventory_item_id)
    WHERE trx_qty > 0;
    DBMS_OUTPUT.put_line ('l_onhand' || l_onhand);
    EXCEPTION
    WHEN OTHERS
    THEN
    l_onhand := 0;
    DBMS_OUTPUT.put_line ('Not Avilable for on hand');
    END;
    -- To check whether this order is a reshipment order
    DBMS_OUTPUT.put_line (
    'To check whether this order is a reshipment order'
    IF l_reship_order IS NOT NULL
    THEN
    DBMS_OUTPUT.put_line ('1st Else Case reship');
    ELSE
    DBMS_OUTPUT.put_line ('1st Else Case no reship');
    FOR l_positive_items
    IN c_positive_items (l_segment, l_organization_id)
    LOOP
    DBMS_OUTPUT.put_line( 'l_positive_items.onhand'
    || l_positive_items.onhand
    || 'l_excl_temp'
    || l_excl_temp
    || ' l_order_qty'
    || l_order_qty);
    IF l_positive_items.onhand > 0 AND l_excl_temp < l_order_qty
    THEN
    l_line_tbl_count := l_line_tbl_count + 1;
    IF (l_order_qty - l_excl_temp) < l_positive_items.onhand
    THEN
    l_prorate_qty := l_order_qty - l_excl_temp;
    ELSE
    l_prorate_qty := l_positive_items.onhand;
    END IF;
    -- Initializing the Sales order Lines Record type
    DBMS_OUTPUT.put_line (
    'Initializing the Sales order Lines Record type'
    l_line_tbl (l_line_tbl_count) := oe_order_pub.g_miss_line_rec;
    l_line_tbl (l_line_tbl_count).operation :=
    oe_globals.g_opr_create;
    l_line_tbl (l_line_tbl_count).header_id := l_header_id;
    l_line_tbl (l_line_tbl_count).inventory_item_id :=
    l_positive_items.inventory_item_id;
    l_line_tbl (l_line_tbl_count).ship_to_org_id :=
    l_ship_to_org_id;
    l_line_tbl (l_line_tbl_count).ordered_quantity := l_prorate_qty;
    l_line_tbl (l_line_tbl_count).schedule_ship_date :=
    l_sch_ship_date;
    l_line_tbl (l_line_tbl_count).attribute1 := l_attribute1;
    l_line_tbl (l_line_tbl_count).attribute2 := l_attribute2;
    l_line_tbl (l_line_tbl_count).attribute9 := l_line_id;
    l_line_tbl (l_line_tbl_count).attribute10 :=
    ROUND (l_prorate_qty / l_order_qty * 100, 5);
    l_line_tbl (l_line_tbl_count).agreement_id := l_agreement_id;
    l_line_tbl (l_line_tbl_count).calculate_price_flag := 'Y';
    l_excl_temp := l_excl_temp + l_prorate_qty;
    END IF;
    END LOOP;
    -- To check if the total onhand is greater than zero
    DBMS_OUTPUT.put_line (
    'To check if the total onhand is greater than zero'
    IF l_onhand > 0
    THEN
    IF l_order_qty > l_excl_temp
    THEN
    -- To check whether the onhand is lesser than order qty
    DBMS_OUTPUT.put_line (
    'To check whether the onhand is lesser than order qty'
    IF (l_onhand < (l_order_qty - l_excl_temp))
    THEN
    -- Loop the cursor with exclusion of soldado logic
    DBMS_OUTPUT.put_line (
    'Loop the cursor with exclusion of soldado logic'
    FOR l_child_item
    IN c_child_items (l_segment, l_organization_id)
    LOOP
    l_prorate_percent := NULL;
    l_negative_prorate := 0;
    l_temp_count := 0;
    l_prorate_qty := 0;
    -- Initializing the Sales order Lines Record type
    DBMS_OUTPUT.put_line (
    'Initializing the Sales order Lines Record type2'
    l_line_tbl (l_line_tbl_count) :=
    oe_order_pub.g_miss_line_rec;
    l_line_tbl (l_line_tbl_count).operation :=
    oe_globals.g_opr_create;
    l_line_tbl (l_line_tbl_count).header_id := l_header_id;
    l_line_tbl (l_line_tbl_count).inventory_item_id :=
    l_child_item.inventory_item_id;
    l_line_tbl (l_line_tbl_count).ship_to_org_id :=
    l_ship_to_org_id;
    l_line_tbl (l_line_tbl_count).ordered_quantity :=
    l_prorate_qty;
    l_line_tbl (l_line_tbl_count).schedule_ship_date :=
    l_sch_ship_date;
    l_line_tbl (l_line_tbl_count).attribute1 := l_attribute1;
    l_line_tbl (l_line_tbl_count).attribute2 := l_attribute2;
    l_line_tbl (l_line_tbl_count).attribute9 := l_line_id;
    l_line_tbl (l_line_tbl_count).attribute10 :=
    ROUND (l_prorate_qty / l_order_qty * 100, 5);
    l_line_tbl (l_line_tbl_count).agreement_id :=
    l_agreement_id;
    l_line_tbl (l_line_tbl_count).calculate_price_flag := 'Y';
    END LOOP;
    ELSE
    -- Loop the cursor of all the positive buckets
    FOR l_child_items
    IN c_positive_onhand (l_segment, l_organization_id)
    LOOP
    l_prorate_percent := NULL;
    l_child_onhand := 0;
    l_prorate_qty := 0;
    -- To get the split percentage of the child items
    l_prorate_percent :=
    ROUND ( (l_child_items.trx_qty / l_onhand) * 100, 5);
    -- To check whether the prorate percentage exits
    IF l_prorate_percent IS NOT NULL
    AND l_prorate_percent > 0
    THEN
    -- To calculate the prorate quantity
    l_line_tbl_count := l_line_tbl_count + 1;
    l_prorate_qty :=
    ROUND (
    (l_order_qty - l_excl_temp)
    * (l_prorate_percent / 100),
    5
    l_qty_temp := l_qty_temp + l_prorate_qty;
    -- To calculate the prorate quantity for the last line
    IF c_positive_onhand%ROWCOUNT =
    l_child_items.total_rows
    THEN
    l_prorate_qty :=
    l_prorate_qty
    + (l_order_qty - (l_qty_temp + l_excl_temp));
    END IF;
    -- Initializing the line record type to process
    DBMS_OUTPUT.put_line (
    'Initializing the Sales order Lines Record type3'
    l_line_tbl (l_line_tbl_count) :=
    oe_order_pub.g_miss_line_rec;
    l_line_tbl (l_line_tbl_count).operation :=
    oe_globals.g_opr_create;
    l_line_tbl (l_line_tbl_count).header_id := l_header_id;
    l_line_tbl (l_line_tbl_count).inventory_item_id :=
    l_child_items.inventory_item_id;
    l_line_tbl (l_line_tbl_count).ship_to_org_id :=
    l_ship_to_org_id;
    l_line_tbl (l_line_tbl_count).ordered_quantity :=
    l_prorate_qty;
    l_line_tbl (l_line_tbl_count).schedule_ship_date :=
    l_sch_ship_date;
    l_line_tbl (l_line_tbl_count).attribute1 :=
    l_attribute1;
    l_line_tbl (l_line_tbl_count).attribute2 :=
    l_attribute2;
    l_line_tbl (l_line_tbl_count).attribute9 := l_line_id;
    l_line_tbl (l_line_tbl_count).attribute10 :=
    ROUND (l_prorate_qty / l_order_qty * 100, 5);
    l_line_tbl (l_line_tbl_count).agreement_id :=
    l_agreement_id;
    l_line_tbl (l_line_tbl_count).calculate_price_flag :=
    'Y';
    DBMS_OUTPUT.put_line( '3rd insert'
    || 'l_prorate_qty'
    || l_prorate_qty
    || 'l_ship_to_org_id'
    || l_ship_to_org_id
    || 'l_sch_ship_date'
    || l_sch_ship_date
    || 'l_child_items.inventory_item_id'
    || l_child_items.inventory_item_id
    || 'l_agreement_id'
    || l_agreement_id);
    END IF;
    COMMIT;
    END LOOP;
    END IF;
    END IF;
    ELSIF l_order_qty > l_excl_temp
    THEN
    -- Loop the cursor with exclusion of soldado logic
    FOR l_child_item IN c_child_items (l_segment, l_organization_id)
    LOOP
    l_prorate_percent := 0;
    l_prorate_qty := 0;
    l_prorate_percent := ROUND (100 / l_child_item.total_rows, 5);
    l_prorate_qty :=
    ROUND (
    ( (l_order_qty - l_excl_temp) / l_child_item.total_rows),
    5
    l_line_tbl_count := l_line_tbl_count + 1;
    l_qty_temp := l_qty_temp + l_prorate_qty;
    -- To calculate the prorate quantity for the last line
    IF c_child_items%ROWCOUNT = l_child_item.total_rows
    THEN
    l_prorate_qty :=
    l_prorate_qty
    + (l_order_qty - (l_qty_temp + l_excl_temp));
    END IF;
    -- Initializing the line record type to process
    DBMS_OUTPUT.put_line (
    'Initializing the Sales order Lines Record type4'
    l_line_tbl (l_line_tbl_count) := oe_order_pub.g_miss_line_rec;
    l_line_tbl (l_line_tbl_count).operation :=
    oe_globals.g_opr_create;
    l_line_tbl (l_line_tbl_count).header_id := l_header_id;
    l_line_tbl (l_line_tbl_count).inventory_item_id :=
    l_child_item.inventory_item_id;
    l_line_tbl (l_line_tbl_count).ship_to_org_id :=
    l_ship_to_org_id;
    l_line_tbl (l_line_tbl_count).ordered_quantity := l_prorate_qty;
    l_line_tbl (l_line_tbl_count).schedule_ship_date :=
    l_sch_ship_date;
    l_line_tbl (l_line_tbl_count).attribute1 := l_attribute1;
    l_line_tbl (l_line_tbl_count).attribute2 := l_attribute2;
    l_line_tbl (l_line_tbl_count).attribute9 := l_line_id;
    l_line_tbl (l_line_tbl_count).attribute10 :=
    ROUND (l_prorate_qty / l_order_qty * 100, 5);
    l_line_tbl (l_line_tbl_count).agreement_id := l_agreement_id;
    l_line_tbl (l_line_tbl_count).calculate_price_flag := 'Y';
    END LOOP;
    END IF;
    END IF; -- to check whether any records are initialized
    IF l_line_tbl_count > 0
    THEN
    -- Cancel the Parent Item
    DBMS_OUTPUT.put_line ('Cancel the Parent Item');
    l_line_tbl (l_line_tbl_count + 1) := oe_order_pub.g_miss_line_rec;
    l_line_tbl (l_line_tbl_count + 1).operation :=
    oe_globals.g_opr_update;
    l_line_tbl (l_line_tbl_count + 1).header_id := l_header_id;
    l_line_tbl (l_line_tbl_count + 1).line_id := l_line_id;
    l_line_tbl (l_line_tbl_count + 1).ordered_quantity := 0;
    l_line_tbl (l_line_tbl_count + 1).attribute10 := l_order_qty;
    l_line_tbl (l_line_tbl_count + 1).cancelled_flag := 'Y';
    l_line_tbl (l_line_tbl_count + 1).change_reason := 'Not Provided';
    DBMS_OUTPUT.put_line( 'Cancellation Process fileds'
    || 'HDR_ID'
    || l_header_id
    || 'LINE'
    || l_line_id
    || 'l_order_qty'
    || l_order_qty);
    -- Call the procedure to process the sales order lines
    -- process_order_line_api (p_line_tbl_rec => l_line_tbl,
    -- p_line_id => l_line_id,
    -- p_error_flag => l_error,
    -- p_error_message => l_error_message);
    IF l_error = 'Y'
    THEN
    resultout := 'COMPLETE:Y';
    ELSE
    resultout := 'COMPLETE:N';
    END IF;
    ELSE
    resultout := 'COMPLETE:N';
    END IF;
    END IF;
    BEGIN
    fnd_global.apps_initialize (fnd_global.user_id,
    fnd_global.resp_id,
    fnd_global.resp_appl_id);
    -- BEGIN
    -- MO_GLOBAL.SET_POLICY_CONTEXT ('S', 321);
    -- END;
    -- fnd_global.apps_initialize (-1, 21623, 660);
    -- Call Process Line API to process sales order lines
    DBMS_OUTPUT.put_line ('fianl line to be processd');
    BEGIN
    oe_order_pub.process_line (p_line_tbl => p_line_tbl_rec,
    x_line_out_tbl => l_line_out_tbl,
    x_return_status => l_return_status,
    x_msg_count => l_msg_count,
    x_msg_data => l_msg_data);
    COMMIT;
    DBMS_OUTPUT.put_line ('API Processed' || l_msg_data);
    fnd_file.put_line (fnd_file.LOG, 'Processed - ' || l_msg_data);
    EXCEPTION
    WHEN OTHERS
    THEN
    DBMS_OUTPUT.put_line ('Failed With1' || SQLERRM);
    END;
    -- display error msgs
    IF (l_debug_level > 0)
    THEN
    FOR i IN 1 .. l_msg_count
    LOOP
    oe_msg_pub.get (p_msg_index => i,
    p_encoded => fnd_api.g_false,
    p_data => l_data,
    p_msg_index_out => l_msg_index);
    fnd_file.put_line (fnd_file.LOG, 'message is:' || l_data);
    fnd_file.put_line (fnd_file.LOG,
    'message index is:' || l_msg_index);
    DBMS_OUTPUT.put_line (
    'l_data' || l_data || 'l_debug_level' || l_debug_level
    END LOOP;
    END IF;
    IF p_error_flag = 'N'
    THEN
    FOR i IN 1 .. l_msg_count
    LOOP
    oe_msg_pub.get (p_msg_index => i,
    p_encoded => fnd_api.g_false,
    p_data => p_error_message,
    p_msg_index_out => l_msg_index);
    END LOOP;
    ELSE
    DBMS_OUTPUT.put_line ('Out Of loop Exit');
    END IF;
    fnd_file.put_line (fnd_file.LOG, 'p_error_message - ' || SQLERRM);
    DBMS_OUTPUT.put_line ('p_error_message' || p_error_message || SQLERRM);
    EXCEPTION
    WHEN OTHERS
    THEN
    DBMS_OUTPUT.put_line ('Failed With' || SQLERRM);
    fnd_file.put_line (fnd_file.LOG,
    'Unexpected Errors Found4 - ' || SQLERRM);
    END;
    END;
    Thanks
    Shagul

    Hi experts ,
    I am trying to load the data via api , Its not getting load , can u help me pls ,
    DECLARE
    l_line_id NUMBER;
    l_item_id NUMBER;
    l_order_qty NUMBER;
    l_msg_index number;
    L_data VARCHAR2 (2000);
    l_debug_file VARCHAR2 (200);
    resultout VARCHAR2 (100);
    l_order_uom VARCHAR2 (10);
    l_reship_order NUMBER;
    itemkey number := 215600;
    l_negative_prorate NUMBER;
    l_prorate_qty NUMBER;
    l_sch_ship_date DATE;
    l_debug_level NUMBER := 3;
    l_ship_to_org_id NUMBER;
    l_attribute1 VARCHAR2 (150);
    l_attribute2 VARCHAR2 (150);
    l_line_num NUMBER;
    l_agreement_id NUMBER;
    l_organization_id NUMBER;
    l_segment VARCHAR2 (120);
    l_child_onhand NUMBER := 0;
    l_qty_temp NUMBER := 0;
    l_excl_temp NUMBER := 0;
    l_prorate_percent NUMBER;
    l_onhand NUMBER;
    l_error VARCHAR2 (240);
    l_error_message VARCHAR2 (240);
    l_line_tbl oe_order_pub.line_tbl_type;
    l_line_tbl_count NUMBER := 0;
    l_temp_count NUMBER := 0;
    p_line_tbl_rec oe_order_pub.line_tbl_type;
    p_line_id NUMBER;
    p_error_flag VARCHAR2 (1000);
    p_error_message VARCHAR2 (1000);
    l_api_version_number NUMBER := 1;
    l_return_status VARCHAR2 (2000);
    l_return_status1 VARCHAR2 (2000);
    l_msg_count NUMBER;
    l_msg_data VARCHAR2 (2000);
    -- l_msg_index VARCHAR2 (1000);
    l_line_out_tbl oe_order_pub.line_tbl_type;
    p_parent_item VARCHAR2 (100) := 'PROPANE';
    p_organization_id NUMBER := 321;
    l_header_id NUMBER := 152066;
    --- Child Cursor Without Exclusion of Soldado
    CURSOR c_child_items (
    p_parent_item VARCHAR2,
    p_organization_id NUMBER
    IS
    CURSOR c_positive_items (
    p_parent_item VARCHAR2,
    p_organization_id NUMBER
    IS
    SELECT inventory_item_id,
    segment1,
    organization_id,
    SUM (onhand - order_qty) onhand,
    COUNT ( * ) OVER () total_rows
    FROM ( SELECT msi.inventory_item_id,
    msi.segment1,
    msi.organization_id,
    NVL (
    SUM(inv_convert.inv_um_convert_new (
    moq.inventory_item_id,
    5,
    moq.transaction_quantity,
    moq.transaction_uom_code,
    l_order_uom,
    NULL,
    NULL,
    'U'
    0
    onhand,
    (SELECT NVL (SUM (ordered_quantity), 0)
    FROM oe_order_lines_all
    WHERE header_id = l_header_id
    AND flow_status_code NOT IN
    ('CLOSED', 'SHIPPED')
    AND inventory_item_id =
    msi.inventory_item_id)
    order_qty
    FROM mtl_system_items_b msi,
    oe_lookups ol,
    mtl_onhand_quantities_detail moq
    WHERE msi.segment1 = ol.meaning
    AND TRIM (SYSDATE) BETWEEN ol.start_date_active
    AND NVL (ol.end_date_active,
    TRIM (SYSDATE))
    AND ol.enabled_flag = 'Y'
    AND ol.lookup_type = p_parent_item
    AND msi.organization_id = p_organization_id
    AND msi.inventory_item_id = moq.inventory_item_id(+)
    AND msi.organization_id = moq.organization_id(+)
    AND (msi.segment1 LIKE '%SOLDADO%'
    OR msi.segment1 LIKE '%T4%')
    GROUP BY msi.inventory_item_id,
    msi.segment1,
    msi.organization_id)
    GROUP BY inventory_item_id, segment1, organization_id
    HAVING SUM (onhand - order_qty) > 0
    ORDER BY segment1;
    --- Child Cursor With only Positive Buckets
    CURSOR c_positive_onhand (
    p_parent_item IN VARCHAR2,
    p_organization_id IN NUMBER
    IS
    BEGIN
    IF (l_debug_level > 0)
    THEN
    l_debug_file := oe_debug_pub.set_debug_mode ('FILE');
    oe_debug_pub.initialize;
    oe_debug_pub.setdebuglevel (l_debug_level);
    oe_msg_pub.initialize;
    END IF;
    --- Initialization Block
    DBMS_OUTPUT.put_line ('Initialization Block');
    fnd_global.apps_initialize (fnd_global.user_id,
    fnd_global.resp_id,
    fnd_global.resp_appl_id);
    -- BEGIN
    -- MO_GLOBAL.SET_POLICY_CONTEXT ('S', 321);
    -- END;
    -- fnd_global.apps_initialize (-1, 21623, 660);
    --- Get Line ID from workflow
    l_line_id := TO_NUMBER (itemkey);
    --- To get the line details
    BEGIN
    SELECT header_id,
    ordered_item,
    inventory_item_id,
    line_number,
    order_quantity_uom,
    ordered_quantity,
    ship_from_org_id,
    ship_to_org_id,
    schedule_ship_date,
    attribute1,
    attribute2,
    agreement_id
    INTO l_header_id,
    l_segment,
    l_item_id,
    l_line_num,
    l_order_uom,
    l_order_qty,
    l_organization_id,
    l_ship_to_org_id,
    l_sch_ship_date,
    l_attribute1,
    l_attribute2,
    l_agreement_id
    FROM oe_order_lines_all
    WHERE line_id = l_line_id;
    DBMS_OUTPUT.put_line ('To get the line details');
    EXCEPTION
    WHEN OTHERS
    THEN
    l_header_id := NULL;
    l_segment := NULL;
    l_item_id := NULL;
    l_order_qty := NULL;
    l_organization_id := NULL;
    DBMS_OUTPUT.put_line ('Not Avilable for To get the line details');
    END;
    -- To get the Original sales order Number
    BEGIN
    SELECT attribute10
    INTO l_reship_order
    FROM oe_order_headers_all
    WHERE header_id = l_header_id;
    EXCEPTION
    WHEN OTHERS
    THEN
    l_reship_order := NULL;
    END;
    --- Check for the Top Level Item Name
    IF l_segment IN ('PROPANE', 'BUTANE', 'ISO BUTANE', 'GASOLINE')
    THEN
    --- To get the total positive onhand quantity for all the child items
    BEGIN
    SELECT NVL (SUM (trx_qty), 0)
    INTO l_onhand
    FROM ( SELECT moq.inventory_item_id,
    NVL (
    SUM(NVL (
    inv_convert.inv_um_convert_new (
    msi.inventory_item_id,
    5,
    moq.transaction_quantity,
    moq.transaction_uom_code,
    l_order_uom,
    NULL,
    NULL,
    'U'
    0
    - (SELECT NVL (SUM (ordered_quantity), 0)
    FROM oe_order_lines_all
    WHERE header_id = l_header_id
    AND flow_status_code NOT IN
    ('CLOSED', 'SHIPPED')
    AND inventory_item_id =
    msi.inventory_item_id),
    0
    trx_qty
    FROM mtl_onhand_quantities_detail moq,
    mtl_system_items msi,
    oe_lookups ol
    WHERE msi.segment1 = ol.meaning
    AND TRIM (SYSDATE) BETWEEN ol.start_date_active
    AND NVL (
    ol.end_date_active,
    TRIM (SYSDATE)
    AND ol.enabled_flag = 'Y'
    AND ol.lookup_type = l_segment
    AND msi.organization_id = l_organization_id
    AND moq.inventory_item_id = msi.inventory_item_id
    AND moq.organization_id = msi.organization_id
    AND (msi.segment1 NOT LIKE '%SOLDADO%'
    AND msi.segment1 NOT LIKE '%T4%')
    GROUP BY msi.inventory_item_id, moq.inventory_item_id)
    WHERE trx_qty > 0;
    DBMS_OUTPUT.put_line ('l_onhand' || l_onhand);
    EXCEPTION
    WHEN OTHERS
    THEN
    l_onhand := 0;
    DBMS_OUTPUT.put_line ('Not Avilable for on hand');
    END;
    -- To check whether this order is a reshipment order
    DBMS_OUTPUT.put_line (
    'To check whether this order is a reshipment order'
    IF l_reship_order IS NOT NULL
    THEN
    DBMS_OUTPUT.put_line ('1st Else Case reship');
    ELSE
    DBMS_OUTPUT.put_line ('1st Else Case no reship');
    FOR l_positive_items
    IN c_positive_items (l_segment, l_organization_id)
    LOOP
    DBMS_OUTPUT.put_line( 'l_positive_items.onhand'
    || l_positive_items.onhand
    || 'l_excl_temp'
    || l_excl_temp
    || ' l_order_qty'
    || l_order_qty);
    IF l_positive_items.onhand > 0 AND l_excl_temp < l_order_qty
    THEN
    l_line_tbl_count := l_line_tbl_count + 1;
    IF (l_order_qty - l_excl_temp) < l_positive_items.onhand
    THEN
    l_prorate_qty := l_order_qty - l_excl_temp;
    ELSE
    l_prorate_qty := l_positive_items.onhand;
    END IF;
    -- Initializing the Sales order Lines Record type
    DBMS_OUTPUT.put_line (
    'Initializing the Sales order Lines Record type'
    l_line_tbl (l_line_tbl_count) := oe_order_pub.g_miss_line_rec;
    l_line_tbl (l_line_tbl_count).operation :=
    oe_globals.g_opr_create;
    l_line_tbl (l_line_tbl_count).header_id := l_header_id;
    l_line_tbl (l_line_tbl_count).inventory_item_id :=
    l_positive_items.inventory_item_id;
    l_line_tbl (l_line_tbl_count).ship_to_org_id :=
    l_ship_to_org_id;
    l_line_tbl (l_line_tbl_count).ordered_quantity := l_prorate_qty;
    l_line_tbl (l_line_tbl_count).schedule_ship_date :=
    l_sch_ship_date;
    l_line_tbl (l_line_tbl_count).attribute1 := l_attribute1;
    l_line_tbl (l_line_tbl_count).attribute2 := l_attribute2;
    l_line_tbl (l_line_tbl_count).attribute9 := l_line_id;
    l_line_tbl (l_line_tbl_count).attribute10 :=
    ROUND (l_prorate_qty / l_order_qty * 100, 5);
    l_line_tbl (l_line_tbl_count).agreement_id := l_agreement_id;
    l_line_tbl (l_line_tbl_count).calculate_price_flag := 'Y';
    l_excl_temp := l_excl_temp + l_prorate_qty;
    END IF;
    END LOOP;
    -- To check if the total onhand is greater than zero
    DBMS_OUTPUT.put_line (
    'To check if the total onhand is greater than zero'
    IF l_onhand > 0
    THEN
    IF l_order_qty > l_excl_temp
    THEN
    -- To check whether the onhand is lesser than order qty
    DBMS_OUTPUT.put_line (
    'To check whether the onhand is lesser than order qty'
    IF (l_onhand < (l_order_qty - l_excl_temp))
    THEN
    -- Loop the cursor with exclusion of soldado logic
    DBMS_OUTPUT.put_line (
    'Loop the cursor with exclusion of soldado logic'
    FOR l_child_item
    IN c_child_items (l_segment, l_organization_id)
    LOOP
    l_prorate_percent := NULL;
    l_negative_prorate := 0;
    l_temp_count := 0;
    l_prorate_qty := 0;
    -- Initializing the Sales order Lines Record type
    DBMS_OUTPUT.put_line (
    'Initializing the Sales order Lines Record type2'
    l_line_tbl (l_line_tbl_count) :=
    oe_order_pub.g_miss_line_rec;
    l_line_tbl (l_line_tbl_count).operation :=
    oe_globals.g_opr_create;
    l_line_tbl (l_line_tbl_count).header_id := l_header_id;
    l_line_tbl (l_line_tbl_count).inventory_item_id :=
    l_child_item.inventory_item_id;
    l_line_tbl (l_line_tbl_count).ship_to_org_id :=
    l_ship_to_org_id;
    l_line_tbl (l_line_tbl_count).ordered_quantity :=
    l_prorate_qty;
    l_line_tbl (l_line_tbl_count).schedule_ship_date :=
    l_sch_ship_date;
    l_line_tbl (l_line_tbl_count).attribute1 := l_attribute1;
    l_line_tbl (l_line_tbl_count).attribute2 := l_attribute2;
    l_line_tbl (l_line_tbl_count).attribute9 := l_line_id;
    l_line_tbl (l_line_tbl_count).attribute10 :=
    ROUND (l_prorate_qty / l_order_qty * 100, 5);
    l_line_tbl (l_line_tbl_count).agreement_id :=
    l_agreement_id;
    l_line_tbl (l_line_tbl_count).calculate_price_flag := 'Y';
    END LOOP;
    ELSE
    -- Loop the cursor of all the positive buckets
    FOR l_child_items
    IN c_positive_onhand (l_segment, l_organization_id)
    LOOP
    l_prorate_percent := NULL;
    l_child_onhand := 0;
    l_prorate_qty := 0;
    -- To get the split percentage of the child items
    l_prorate_percent :=
    ROUND ( (l_child_items.trx_qty / l_onhand) * 100, 5);
    -- To check whether the prorate percentage exits
    IF l_prorate_percent IS NOT NULL
    AND l_prorate_percent > 0
    THEN
    -- To calculate the prorate quantity
    l_line_tbl_count := l_line_tbl_count + 1;
    l_prorate_qty :=
    ROUND (
    (l_order_qty - l_excl_temp)
    * (l_prorate_percent / 100),
    5
    l_qty_temp := l_qty_temp + l_prorate_qty;
    -- To calculate the prorate quantity for the last line
    IF c_positive_onhand%ROWCOUNT =
    l_child_items.total_rows
    THEN
    l_prorate_qty :=
    l_prorate_qty
    + (l_order_qty - (l_qty_temp + l_excl_temp));
    END IF;
    -- Initializing the line record type to process
    DBMS_OUTPUT.put_line (
    'Initializing the Sales order Lines Record type3'
    l_line_tbl (l_line_tbl_count) :=
    oe_order_pub.g_miss_line_rec;
    l_line_tbl (l_line_tbl_count).operation :=
    oe_globals.g_opr_create;
    l_line_tbl (l_line_tbl_count).header_id := l_header_id;
    l_line_tbl (l_line_tbl_count).inventory_item_id :=
    l_child_items.inventory_item_id;
    l_line_tbl (l_line_tbl_count).ship_to_org_id :=
    l_ship_to_org_id;
    l_line_tbl (l_line_tbl_count).ordered_quantity :=
    l_prorate_qty;
    l_line_tbl (l_line_tbl_count).schedule_ship_date :=
    l_sch_ship_date;
    l_line_tbl (l_line_tbl_count).attribute1 :=
    l_attribute1;
    l_line_tbl (l_line_tbl_count).attribute2 :=
    l_attribute2;
    l_line_tbl (l_line_tbl_count).attribute9 := l_line_id;
    l_line_tbl (l_line_tbl_count).attribute10 :=
    ROUND (l_prorate_qty / l_order_qty * 100, 5);
    l_line_tbl (l_line_tbl_count).agreement_id :=
    l_agreement_id;
    l_line_tbl (l_line_tbl_count).calculate_price_flag :=
    'Y';
    DBMS_OUTPUT.put_line( '3rd insert'
    || 'l_prorate_qty'
    || l_prorate_qty
    || 'l_ship_to_org_id'
    || l_ship_to_org_id
    || 'l_sch_ship_date'
    || l_sch_ship_date
    || 'l_child_items.inventory_item_id'
    || l_child_items.inventory_item_id
    || 'l_agreement_id'
    || l_agreement_id);
    END IF;
    COMMIT;
    END LOOP;
    END IF;
    END IF;
    ELSIF l_order_qty > l_excl_temp
    THEN
    -- Loop the cursor with exclusion of soldado logic
    FOR l_child_item IN c_child_items (l_segment, l_organization_id)
    LOOP
    l_prorate_percent := 0;
    l_prorate_qty := 0;
    l_prorate_percent := ROUND (100 / l_child_item.total_rows, 5);
    l_prorate_qty :=
    ROUND (
    ( (l_order_qty - l_excl_temp) / l_child_item.total_rows),
    5
    l_line_tbl_count := l_line_tbl_count + 1;
    l_qty_temp := l_qty_temp + l_prorate_qty;
    -- To calculate the prorate quantity for the last line
    IF c_child_items%ROWCOUNT = l_child_item.total_rows
    THEN
    l_prorate_qty :=
    l_prorate_qty
    + (l_order_qty - (l_qty_temp + l_excl_temp));
    END IF;
    -- Initializing the line record type to process
    DBMS_OUTPUT.put_line (
    'Initializing the Sales order Lines Record type4'
    l_line_tbl (l_line_tbl_count) := oe_order_pub.g_miss_line_rec;
    l_line_tbl (l_line_tbl_count).operation :=
    oe_globals.g_opr_create;
    l_line_tbl (l_line_tbl_count).header_id := l_header_id;
    l_line_tbl (l_line_tbl_count).inventory_item_id :=
    l_child_item.inventory_item_id;
    l_line_tbl (l_line_tbl_count).ship_to_org_id :=
    l_ship_to_org_id;
    l_line_tbl (l_line_tbl_count).ordered_quantity := l_prorate_qty;
    l_line_tbl (l_line_tbl_count).schedule_ship_date :=
    l_sch_ship_date;
    l_line_tbl (l_line_tbl_count).attribute1 := l_attribute1;
    l_line_tbl (l_line_tbl_count).attribute2 := l_attribute2;
    l_line_tbl (l_line_tbl_count).attribute9 := l_line_id;
    l_line_tbl (l_line_tbl_count).attribute10 :=
    ROUND (l_prorate_qty / l_order_qty * 100, 5);
    l_line_tbl (l_line_tbl_count).agreement_id := l_agreement_id;
    l_line_tbl (l_line_tbl_count).calculate_price_flag := 'Y';
    END LOOP;
    END IF;
    END IF; -- to check whether any records are initialized
    IF l_line_tbl_count > 0
    THEN
    -- Cancel the Parent Item
    DBMS_OUTPUT.put_line ('Cancel the Parent Item');
    l_line_tbl (l_line_tbl_count + 1) := oe_order_pub.g_miss_line_rec;
    l_line_tbl (l_line_tbl_count + 1).operation :=
    oe_globals.g_opr_update;
    l_line_tbl (l_line_tbl_count + 1).header_id := l_header_id;
    l_line_tbl (l_line_tbl_count + 1).line_id := l_line_id;
    l_line_tbl (l_line_tbl_count + 1).ordered_quantity := 0;
    l_line_tbl (l_line_tbl_count + 1).attribute10 := l_order_qty;
    l_line_tbl (l_line_tbl_count + 1).cancelled_flag := 'Y';
    l_line_tbl (l_line_tbl_count + 1).change_reason := 'Not Provided';
    DBMS_OUTPUT.put_line( 'Cancellation Process fileds'
    || 'HDR_ID'
    || l_header_id
    || 'LINE'
    || l_line_id
    || 'l_order_qty'
    || l_order_qty);
    -- Call the procedure to process the sales order lines
    -- process_order_line_api (p_line_tbl_rec => l_line_tbl,
    -- p_line_id => l_line_id,
    -- p_error_flag => l_error,
    -- p_error_message => l_error_message);
    IF l_error = 'Y'
    THEN
    resultout := 'COMPLETE:Y';
    ELSE
    resultout := 'COMPLETE:N';
    END IF;
    ELSE
    resultout := 'COMPLETE:N';
    END IF;
    END IF;
    BEGIN
    fnd_global.apps_initialize (fnd_global.user_id,
    fnd_global.resp_id,
    fnd_global.resp_appl_id);
    -- BEGIN
    -- MO_GLOBAL.SET_POLICY_CONTEXT ('S', 321);
    -- END;
    -- fnd_global.apps_initialize (-1, 21623, 660);
    -- Call Process Line API to process sales order lines
    DBMS_OUTPUT.put_line ('fianl line to be processd');
    BEGIN
    oe_order_pub.process_line (p_line_tbl => p_line_tbl_rec,
    x_line_out_tbl => l_line_out_tbl,
    x_return_status => l_return_status,
    x_msg_count => l_msg_count,
    x_msg_data => l_msg_data);
    COMMIT;
    DBMS_OUTPUT.put_line ('API Processed' || l_msg_data);
    fnd_file.put_line (fnd_file.LOG, 'Processed - ' || l_msg_data);
    EXCEPTION
    WHEN OTHERS
    THEN
    DBMS_OUTPUT.put_line ('Failed With1' || SQLERRM);
    END;
    -- display error msgs
    IF (l_debug_level > 0)
    THEN
    FOR i IN 1 .. l_msg_count
    LOOP
    oe_msg_pub.get (p_msg_index => i,
    p_encoded => fnd_api.g_false,
    p_data => l_data,
    p_msg_index_out => l_msg_index);
    fnd_file.put_line (fnd_file.LOG, 'message is:' || l_data);
    fnd_file.put_line (fnd_file.LOG,
    'message index is:' || l_msg_index);
    DBMS_OUTPUT.put_line (
    'l_data' || l_data || 'l_debug_level' || l_debug_level
    END LOOP;
    END IF;
    IF p_error_flag = 'N'
    THEN
    FOR i IN 1 .. l_msg_count
    LOOP
    oe_msg_pub.get (p_msg_index => i,
    p_encoded => fnd_api.g_false,
    p_data => p_error_message,
    p_msg_index_out => l_msg_index);
    END LOOP;
    ELSE
    DBMS_OUTPUT.put_line ('Out Of loop Exit');
    END IF;
    fnd_file.put_line (fnd_file.LOG, 'p_error_message - ' || SQLERRM);
    DBMS_OUTPUT.put_line ('p_error_message' || p_error_message || SQLERRM);
    EXCEPTION
    WHEN OTHERS
    THEN
    DBMS_OUTPUT.put_line ('Failed With' || SQLERRM);
    fnd_file.put_line (fnd_file.LOG,
    'Unexpected Errors Found4 - ' || SQLERRM);
    END;
    END;
    Thanks
    Shagul

  • Please help, simple query not working

    Have the following script that I would like to run at multiple sites and create table columns if necessary:
    DECLARE
    table_name VARCHAR2 (30) := 'SITE_STATISTICS';
    column_name VARCHAR2 (30) := 'SITE_MONTH';
    column_data_type VARCHAR2 (30) := 'DATE';
    column_count INTEGER;
    dynamic_sql VARCHAR2 (4000);
    BEGIN
    SELECT COUNT (1)
    INTO column_count
    FROM SYS.USER_TAB_COLUMNS utc
    WHERE utc.table_name = table_name AND utc.column_name = column_name AND utc.data_type = column_data_type;
    SYS.DBMS_OUTPUT.ENABLE (4000);
    IF column_count = 0 THEN
    dynamic_sql :=
    ALTER TABLE SITE_STATISTICS ADD (SITE_MONTH DATE);
    EXECUTE IMMEDIATE dynamic_sql;
    ELSE
    DBMS_OUTPUT.put_line ('Not running Dynamic Sql, found ' || column_count || ' corresponding rows in sys.user_tab_columns');
    END IF;
    END;
    EXIT;
    At a given site I do not have the given column, and running the select from sys.user_tab_columns manually returns 0 rows. However, when I run this script it outputs the following:
    Not running Dynamic Sql, found 128 corresponding rows in sys.user_tab_columns
    What's going on!?

    Connected to:
    Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production
    With the Partitioning, OLAP and Data Mining options
    SQL> create table abc (c1 number(10));
    Table created.
    SQL> DECLARE
      2     table_name1                   VARCHAR2 ( 30 ) := 'ABC';
      3     column_name1                  VARCHAR2 ( 30 ) := 'SITE_MONTH';
      4     column_data_type1             VARCHAR2 ( 30 ) := 'DATE';
      5     column_count                  INTEGER;
      6     dynamic_sql                   VARCHAR2 ( 4000 );
      7  BEGIN
      8     SELECT COUNT ( 1 )
      9       INTO column_count
    10       FROM SYS.user_tab_columns utc
    11      WHERE utc.table_name = table_name1
    12        AND utc.column_name = column_name1
    13        AND utc.data_type = column_data_type1;
    14  
    15     SYS.DBMS_OUTPUT.ENABLE ( 4000 );
    16  
    17     IF column_count = 0 THEN
    18  
    19        dynamic_sql :='ALTER TABLE ABC ADD (SITE_MONTH DATE,SHIP_CONTANK INTEGER,SHIP_CONRAIL INTEGER)';
    20  
    21        EXECUTE IMMEDIATE dynamic_sql;
    22     ELSE
    23        DBMS_OUTPUT.put_line (    'Not running Dynamic Sql, found '
    24                               || column_count
    25                               || ' corresponding rows in sys.user_tab_columns'
    26                             );
    27     END IF;
    28  END;
    29  /
    PL/SQL procedure successfully completed.
    SQL> desc abc
    Name                                      Null?    Type
    C1                                                 NUMBER(10)
    SITE_MONTH                                         DATE
    SHIP_CONTANK                                       NUMBER(38)
    SHIP_CONRAIL                                       NUMBER(38)

  • DBMS_OUTPUT.PUT_LINE doesn't work in Reports

    Version 1.1.2.25 Build Main 25.97
    I've tried to create a Report using the PL/SQL-DBMS_OUTPUT option and it just sends out a sinle line of text without any line throws. Copy the block of code and run it as a script and it works fine.
    Anybody else come across this problem?

    Here's the PL/SQL code for the Report....
    declare
    vowner VARCHAR2(30);
    vindex VARCHAR2(30);
    vtable VARCHAR2(30);
    CURSOR cIndex
    IS
    select OWNER, INDEX_NAME, TABLE_NAME
    from dba_indexes;
    begin
    dbms_output.enable(1000000);
    open cIndex;
    LOOP
    FETCH cIndex INTO vowner, vindex, vtable;
    EXIT WHEN cIndex%NOTFOUND;
    if (vowner = :OWNER) and (vTable like :TABLENAME)
    then
    dbms_output.put_line('alter index ' || vowner || '.' || vindex || ' nomonitoring usage;');
    end if;
    end loop;
    close cIndex;
    end;
    I've tested by setting the bind variables :OWNER to a schema and :TABLENAME to '%' to return all indexes owner by the schema.
    As you can see, I don't use \n.
    This works fine when run as a script in SQL Developer (each put_line coming out on a separate line) but not as a report.

  • Dbms_output.put_line does not write to stdout

    I expect the following code to fail and to write 'ERRORE' to stdout:
    ------------------- mm.sql
    set serveroutput on
    BEGIN
    select 1/0 from dual;
    exception
    when others then
    dbms_output.put_line('ERRORE');
    END;
    I execute this from the command line
    sqlplus rmsas_test/rmsas_test < mm.sql > mm.log 2>&1
    It produces
    ---------------------------- mm.log
    SQL*Plus: Release 9.2.0.6.0 - Production on Gio Lug 13 16:42:27 2006
    Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
    Connected to:
    Oracle9i Enterprise Edition Release 9.2.0.6.0 - 64bit Production
    JServer Release 9.2.0.6.0 - Production
    SQL> SQL> 2 3 4 5 6 7 Disconnected from Oracle9i Enterprise Edition Release 9.2.0.6.0 - 64bit Production
    JServer Release 9.2.0.6.0 - Production
    But no 'ERRORE' has been written to stdout????
    Why?
    Thanks
    Mauro

    Just a comment. There are no STDOUT or STDERR devices when dealing with PL/SQL programs.
    The code runs inside an Oracle server process. That process itself is detached from any display device, any input device (e.g. mouse or keyboard) and any peripheral device (e.g. printer).
    DBMS_OUTPUT is simply a persistant PL/SQL buffer that can be created in an Oracle session. The contents of this buffer can be displayed by a client (using the DBMS_OUTPUT API to read and clear the buffer). Do not confuse it with a proper STDOUT/STDERR device.

  • Dbms_output not working in procedure

    Here is my procedure:
    create or replace
    PROCEDURE TD_TEST1 AS
    begin
    dbms_output.enable;
    dbms_output.put_line('Hello oracle!');
    exception
    when others then
    null;
    END TD_TEST1;
    It outputs the following when I run the procedure using the "play" button in SQL Developer.
    Connecting to the database...
    Hello oracle!
    Process exited.
    Disconnecting from the database...
    But when I run the following code from another sql worksheet connected to the same db here what happens:
    BEGIN
    TD_TEST1();
    END;
    anonymous block completed
    Why no Hello oracle! ?
    SQL Plus does it!

    In Oracle SQL Developer (v3.0.04) you may go to
    View--> dbms Output
    once that opens up, click on the Green + and select your connection.then your output for that connection will show up there as well (but NOT in your Script output -- that's where "set serverout on" will appear)

  • DBMS_OUTPUT.PUT_LINE multi records from PL/SQL procedure to Java web page.

    Hello
    I will explain the scenario:
    In our java web page, we are using three text boxes to enter "Part number,Description and Aircraft type". Every time the user no need to enter all these data. The person can enter any combination of data or only one text box. Actually the output data corresponding to this input entries is from five Oracle table. If we are using a single query to take data from all the five tables, the database will hang. So I written a procedure "SEARCH1",this will accept any combination of values (for empty values we need to pass NULL to this procedure) and output data from all the five tables. When I executing this procedure in SQL editor, the execution is very fast and giving exact result. I used "dbms_output.put_line" clause for outputing multiple records in my procedure. The output variables are "Serial No, part Number, Description, Aircraft type,Part No1,Part No2,Part No3,Part No4". I want to use the same procedure "SEARCH1" for outputing data in java web page.The passing argument I can take from the text box provided in java web page. I am using jdbc thin driver to connect our java web page to Oracle 9i database.
    Note1 : If any combination of search item not available, in procedure itself I am outputing a message like "Part Number not found". Here I am using four words ("Part" is the first word,"Number" is the second,"Not" s the third, and "found" is the fourth) for outputing this message.Is it necessary to equalise number of words I am using here to the record outputing eight variable?
    Our current development work is stopped because of this issue. So any one familier in this field,plese help me to solve our issue by giving the sample code for the same scenario.
    My Email-id is : [email protected]
    I will expect yor early mail.
    With thanks
    Pramod kumar.

    Hello Avi,
    I am trying to solve this issue by using objects. But the following part of code also throwing some warning like "PLS-00302: component must be declared". Plese cross check my code and help me to solve this issue.
    drop type rectab;
    create or replace type rectype as object(PartNo varchar2(30),Description varchar2(150),AIrcraft_type varchar2(15),status_IPC varchar2(30),status_ELOG varchar2(30),status_SUPCAT varchar2(30),status_AIRODWH varchar2(30));
    create or replace type rectab as table of rectype;
    create or replace package ioStructArray as
    procedure testsch2(pno in varchar2,pdes in varchar2,air in varchar2,orec in out rectab);
    end ioStructArray;
    create or replace package body ioStructArray as
    procedure testsch2(pno in varchar2,pdes in varchar2,air in varchar2,orec in out rectab) is
    mdescription varchar2(150);
    mpartnum varchar2(30);
    mpno varchar2(30);
    mdes varchar2(150);
    mair varchar2(15);
    mstat varchar2(1);
    cursor c1 is select partnum,description,aircraft_type from master_catalog where partnum=mpno and aircraft_type=mair and description like ltrim(rtrim(mdes))||'%';
    cursor c2 is select partnum from ipc_master where partnum=mpartnum;
    cursor c3 is select partnum from fedlog_data where partnum=mpartnum;
    cursor c4 is select partnum from superparts where partnum=mpartnum;
    cursor c5 is select part_no from supplier_catalog where part_no=mpartnum;
    mpno1 varchar2(30);
    mpno2 varchar2(30);
    mpno3 varchar2(30);
    mpno4 varchar2(30);
    mpno5 varchar2(30);
    maircraft_type varchar2(15);
    mstat1 varchar2(30);
    mstat2 varchar2(30);
    mstat3 varchar2(30);
    mstat4 varchar2(30);
    begin
    mstat:='N';
    mpno:=pno;
    mdes:=pdes;
    mair:=air;
    if mpno is not null and mdes is not null and mair is not null then
    begin
    mstat:='N';
    mpno:=pno;
    mdes:=pdes;
    mair:=air;
    for i in c1 loop
    mstat:='N';
    mstat1:='N';
    mstat2:='N';
    mstat3:='N';
    mstat4:='N';
    mpno1:=i.partnum;
    mpartnum:=i.partnum;
    mdescription:=i.description;
    maircraft_type:=i.aircraft_type;
    for j in c2 loop
    mpno2:=j.partnum;
    end loop;
    for k in c3 loop
    mpno3:=k.partnum;
    end loop;
    for l in c4 loop
    mpno4:=l.partnum;
    end loop;
    for m in c5 loop
    mpno5:=m.part_no;
    end loop;
    if mpno2=mpartnum then
    mstat1:=mpno2;
    end if;
    if mpno3=mpartnum then
    mstat2:=mpno3;
    end if;
    if mpno4=mpartnum then
    mstat3:=mpno4;
    end if;
    if mpno5=mpartnum then
    mstat4:=mpno5;
    end if;
    if mpno1=mpartnum then
    mstat:='Y';
    orec.PartNo:=mpno1;
    orec.Description:=mdescription;
    orec.AIrcraft_type:=maircraft_type;
    orec.status_IPC:=mstat1;
    orec.status_ELOG:=mstat2;
    orec.status_SUPCAT:=mstat3;
    orec.STATUS_AIRODWH:=status_AIRODWH;
    end if;
    end loop;
    end;
    end if;
    end testsch2;
    end ioStructArray;
    Expecting your early reply.
    With thanks
    Pramod kumar.

  • PL/SQL program not working when connect database via SqlNet

    Hi,
    This is a segment of a PL/SQL program before opening a cursor using input descriptor. It is working fine ( to get the value of unOutputCount ) without connect to a database via SqlNet, can anyone tell me why it is not working ( unOutputCount return 0)while connecting to a database via SqlNet and how to make it work without opening a cursor before DESCRIBE OUTPUT ...?
    EXEC SQL ALLOCATE DESCRIPTOR GLOBAL 'input_111'
    WITH MAX 100;
    EXEC SQL ALLOCATE DESCRIPTOR GLOBAL 'output_111'
    WITH MAX 100;
    EXEC SQL PREPARE STMT1 FROM :psSqlStatement;
    EXEC SQL DECLARE CURSOR1 CURSOR FOR STMT1;
    EXEC SQL DESCRIBE INPUT STMT1
    USING DESCRIPTOR GLOBAL 'input_111';
    /* Get count of input parameters in statement */
    EXEC SQL GET DESCRIPTOR GLOBAL 'input_111' :unInputCount = COUNT;
    EXEC SQL DESCRIBE OUTPUT STMT1
    USING DESCRIPTOR GLOBAL 'output_111';
    /* Get count of output parameters in statement */
    EXEC SQL GET DESCRIPTOR GLOBAL 'output_111'
    :unOutputCount = COUNT;

    Hi,
    Welcome to Oracle OTN Forums!
    I changed your code a little. I think this help you
    CREATE OR REPLACE
    PROCEDURE xx_test
    IS
      v_pid VARCHAR2(100);
      v_cn  VARCHAR2(100);
      v_id  VARCHAR2(1000);
      v_val VARCHAR2(1000);
      CURSOR C1
      IS
        (SELECT product_id, 'PRODUCT_ID'  cn
            FROM product1 );
      BEGIN
        FOR V1 IN C1
        LOOP
          FETCH C1 INTO v_pid, v_cn;
          dbms_output.put_line('==== '||v_pid||'==== '||v_cn);
          EXECUTE IMMEDIATE
          'SELECT product_id, DECODE(COUNT (product_id),1,MAX (product_id))||'''||V_CN||''' as val
            FROM product1
           WHERE product_id =:a
           GROUP BY product_id)' INTO v_id, v_val USING v_pid;
          dbms_output.put_line('==== '||v_id||'==== '||v_val);
          EXECUTE IMMEDIATE 'UPDATE product2 SET '||v_cn||' = ' ||''''|| v_val ||''''|| ' WHERE product_id = :b' USING v_pid;
          dbms_output.put_line('++++ '||v_cn||'++++ '||v_val||'++++ '||v_pid);
        END LOOP;
      END xx_test;

  • Linux script call from PL/SQL does not work?

    We are trying to run a simple Linux command using this PL/SQL 10.2 procedure:
    PROCEDURE run_linux_script_from_oracle IS
        BEGIN
          dbms_scheduler.create_job
              job_name=>'runtop',
              job_type=>'executable',
              job_action=>'/vol0/FileLoadDir/Bank/DATA_FILES/spell_check.sh',
              enabled=>true,
              auto_drop=>true
          DBMS_OUTPUT.PUT_LINE('Successful');
        EXCEPTION
          WHEN OTHERS THEN
            DBMS_OUTPUT.PUT_LINE('Error: ' || SQLERRM);
        END;The .sh file has this command which works fine when we run in Linux.
    spell /vol0/FileLoadDir/Bank/DATA_FILES/ebill2.fmt_form_strings_.txt > /vol0/FileLoadDir/Bank/DATA_FILES/abcd.txtI get a Successful when I run this command in my SQL*Navigator and a PLS-00225: subprogram or cursor 'ABS' reference is out of scope when I run it in the SQL*Nav in another machine???
    Any help would be greatly appreciated.

    Channa wrote:
    We are trying to run a simple Linux command using this PL/SQL 10.2 procedure:NO, posted procedure below RUNS nothing,
    post code simply CREATE JOB, but does NOT invoke it!
    >
    PROCEDURE run_linux_script_from_oracle IS
    BEGIN
    dbms_scheduler.create_job
    job_name=>'runtop',
    job_type=>'executable',
    job_action=>'/vol0/FileLoadDir/Bank/DATA_FILES/spell_check.sh',
    enabled=>true,
    auto_drop=>true
    DBMS_OUTPUT.PUT_LINE('Successful');
    EXCEPTION
    WHEN OTHERS THEN
    DBMS_OUTPUT.PUT_LINE('Error: ' || SQLERRM);
    END;EXCEPTION handler is BUG & should be removed, discarded & 100% eliminated.
    >
    The .sh file has this command which works fine when we run in Linux.
    spell /vol0/FileLoadDir/Bank/DATA_FILES/ebill2.fmt_form_strings_.txt > /vol0/FileLoadDir/Bank/DATA_FILES/abcd.txtI get a Successful when I run this command in my SQL*Navigator and a PLS-00225: subprogram or cursor 'ABS' reference is out of scope when I run it in the SQL*Nav in another machine???What is "ABS" & why/how does it exist in error message?

Maybe you are looking for

  • How to create effects like this ...

    Dear webmates : I'd like to know how to create rollover menus like this : http://perfeccionate.urp.edu.pe/server/rumbo/index.php/comunidad/programa-tv As you can see it shows you more than one option and big rollover menus... what tools ca I use to a

  • IPod Touch Cannot Sync with iTunes

    I just got back my iPod touch from an apple store, after i had a previous problem with it restoring but they fixed that problem. Now, when i try to sync my iPod with my itunes library i get tons of different error messages and it doesn't work. Someti

  • Read image metadata

    Hi All, Question: Can we read image meta data from CS extension code by any way ? I tried it with xmp core library and passed a jpeg file to xmpMeta object which expect a String, a XML or Byte Array as argument: private function getImageMetadata(jpeg

  • Iphone doesn't appear in «devices» category when I try to synch it

    When I connect my device (iPhone 4S) to my computer (which one is under Windows XP), my computer recognize my iphone as a camera. When I open iTunes, a speech box appears and says: «Iphone can't be used because Apple Mobile Device isn't launch.». I r

  • No thumbnails on Bridge anymore

    I have bridge CS4 and CS5.  CS4 used to show thumbnails of raw photos.  But no more.  CS5 never did.  Then I installed Snow Leopard.  Now CS4 doesnt show them either and the 2 spots where choices are given for raw are greyed out.  I hope someone can