Calling package procedure within another procedure ???

Hello ,
I have package called import_pack, within this i have procedure called import_proc. I have another separate procedure called main_proc.
Now i want to call import_proc in main_proc. how do i do this ???
Any example would be great. Thank you so much.

Hi,
If the import_pack package is in the user_x schema, then the following will always work:
user_x.import_pack.import_proc (...);If main.proc is also in the user_x schema, then the owner name is optional, so this would be acceptable, too:
import_pack.import_proc (...);If main_proc is in the same package, then the package name is optional, so this would also work:
import_proc (...);

Similar Messages

  • Calling packaged procedure from a URL link

    I have created a custom APEX application the will allow us to dynamically build help screens for the pages we create with APEX.
    In doing this I have created a procedure within a package called "comi_help_util.show_help".
    This procedure uses the "htp.p" standard procedure to create a dynamic web page from data stored inside my help tables.
    I want to place a "Help" link in the Navigation Bar which will call the custom procedure, pass the APP_ID and APP_PAGE_ID and popup in a new window.
    I tried doing something like the Help link in APEX.
    javascript:popupURL('comi_help_util.show_help?p_application_id=&APP_ID.&p_page_id=&APP_PAGE_ID.');
    Unfortunately, I get "HTTP 404 - Web page cannot be found" error.
    I know I could probably call a page within my APEX application from my custom Help link which would then call my custom procedure.
    However, this means I would have to put a page within every application I want to use this on.
    I believe the call to the procedure directly would be cleaner and easier to implement, if I can get this working on my first app.
    I have never called a procedure thru a URL link or the javascript:popupURL and, try as I might, cannot search for the right keywords in the APEX forum or the Web.
    Any help would be appreciated.
    THANKS
    Raymond

    Hi Scott,
    >> Time for new glasses ...
    You are probably right, but regardless, I was referring to Raymond’s first post (and I should have made it clear). I noted that I believe your JavaScript statement is correct, I just can’t see the difference between it and the OP first statement, where, as far as I can see, he also used question mark (?) to mark parameters, and ampersand (&) to concatenate them. Still he received a 404 error. What am I missing there?
    Thanks,
    Arie.
    Please remember to mark appropriate posts as correct/helpful. For the long run, it will benefit us all.

  • Call Package Procedure from a Servlet?

    Hi,
    Is it possible to call a package procedure from a servlet?
    Art

    Could you be a bit more specific please? I'm not sure where or what to look for.
    Art
    Wrap it with WebServices interface. There is an example article somewhere on otn.oracle.com

  • Calling packaged procedure from a function

    Hi all,
    I am using Oracle database 10.2.0
    I have a packaged procedure , there are two IN parameters(Varchar, Date) and an OUT parameter(REF CURSOR). The out parameter sends a result set from a query(multiple records of a table). I was asked to create a function which can use this procedure and returns the same resultset. Can u please suggest how to proceed?
    Thanks & Regards,
    Naveen.

    Is it something like this you're after:
    SQL> create or replace function test_f (p_In1 in number, p_In2 in varchar2) return sys_refcursor as
      2    r sys_refcursor;
      3    begin
      4      open r for 'select ' || to_char(p_In1) || ',''' || p_In2 || ''' from dual';
      5      return  r;
      6  end test_f;
      7  /
    Function created.
    SQL> declare
      2    r sys_refcursor;
      3   
      4    l_no number;
      5    l_Greet varchar2(30);
      6  begin
      7    r := test_f(1, 'Hello');
      8   
      9    fetch r into l_no, l_Greet;
    10    if (r%found) then
    11      dbms_output.put_line(l_No || ' ' || l_Greet);
    12    end if;
    13   
    14    close r;
    15   
    16    exception
    17      when others then
    18        dbms_output.put_line('Err ' || sqlerrm);
    19        if (r%isopen) then
    20          close r;
    21        end if;
    22 
    23  end;
    24  /
    1 Hello
    PL/SQL procedure successfully completed.P;
    Edited by: bluefrog on Mar 4, 2010 3:16 PM

  • Problem with calling a midlet within another midlet

    hello friends,
    can a create an instance of a midlet within another midlet.i tried to call , but i have got a Security exception. plz comment on this ..
    regards..

    "For security reasons, it is assumed that MIDlets within a MIDletSuite are packaged
    together for a reason and should be able to interoperate. What's implied here is that the
    MIDlets share a name space; in other words, each MIDlet in the MidletSuite can "see" one
    another. Because they can see one another, they can launch one another (Class.forName
    metaphor).
    In contrast, one MIDletSuite cannot launch another MIDletSuite. That's because they do not
    share name spaces. Since the CLDC+MIDP does not have a security manager (too big and
    complex for small devices), the MIDP expert group felt it more prudent to limit the interaction
    of downloaded applications to those that are packaged together by the provider."extract from Sun
    see http://developers.sun.com/mobility/midp/articles/pushreg/ for infos to launch MIDlets...

  • How to set a checkbox to call javascript for calling package procedure?

    Hi folks,
    I have a report where each row includes a dynamically created checkbox:
    Step 1: define report in APEX based on this test query
    select object_id,
           txt,
           htmldb_item.checkbox
              1,
              data.object_id,
              'onclick=alert('||data.object_id||');'
           ) cb
    from
      select 1 object_id, 'AAAA' txt from dual union
      select 2 object_id, 'BBBB' txt from dual union
      select 3 object_id, 'CCCC' txt from dual
    )  data Step 2: create a log table
    create table tk_test_log
       log_val  varchar2(100)
    );Step 3: Then I have a package stored in db called: tk_test
    create or replace package tk_test is
      procedure add(p_num number);
      procedure remove(p_num number);
    end tk_test;
    create or replace package body tk_test is
      procedure add(p_num number) is
      begin
        insert into tk_test_log values ('TK_TEST.ADD: '||p_num||'   '||to_char(sysdate,'DD/MM/YYYY HH24:MI:SS'));
      end;
      procedure remove(p_num number) is
      begin
        insert into tk_test_log values ('TK_TEST.REMOVE: '||p_num||'   '||to_char(sysdate,'DD/MM/YYYY HH24:MI:SS'));
      end;
    end tk_test;Is it possible to call "tk_test.add" procedure everytime when user checks any of checkboxes and to call "tk_test.remove" when user un-check any checkbox?
    How should I modify a javascript in step 1 (currently = alert('||data.object_id||') ) to obtain similar solution?
    Please help,
    Tomas

    Hi Earl,
    Thanks for your reply.
    Well this is exactly what I'm planning to use within my package :). Above example was just a really into into problem.
    In reallity:
    "add" prcedure will add a record into collection (plsql table - stored as a type)
    and
    "remove" procedure will remove it from it
    But my problemis how to call it from javascript.
    You're probably suggesting to use/maintain this collection within APEX and not within database?
    Here is how I've defined my collection:
    create or replace type ap_choice_temp_object_type is object
        ( person_id number,
          choice_id number,
          added     date
    create or replace type ap_choice_temp_tab_type is table of ap_choice_temp_object_type;       And then in package I have procedures:
      procedure clear_ap_choice_temp_tab is
      begin
         l_choice_temp_tab := ap_choice_temp_tab_type();
      end;
      procedure add_ap_choice_temp_row (p_person_id number,
                                        p_choice_id   number
                                        ) is
      begin
        if l_choice_temp_tab.exists = false then
           clear_ap_choice_temp_tab;
        end if;
        l_choice_temp_tab.extend;
        l_choice_temp_tab(l_choice_temp_tab.last) := ap_choice_temp_object_type(person_id => p_person_id,
                                                                                choice_id => p_choice_id,
                                                                                added => sysdate
      end;
      procedure remove_ap_choice_temp_row (p_person_id number,
                                           p_choice_id   number
                                           ) is
      i integer;
      begin
        -- this should be more optimalised -- this version is just 1-st try !
        print_ap_choice_temp_tab;
        i := l_choice_temp_tab.first;
        loop
           if l_choice_temp_tab(i).person_id = p_person_id and l_choice_temp_tab(i).choice_id = p_choice_id then
             l_choice_temp_tab.delete(i);
           end if; 
           i:= l_choice_temp_tab.next(i);
           exit when i is null;
        end loop;
        print_ap_choice_temp_tab;                                                                              
      end;
      procedure print_ap_choice_temp_tab is
       i integer;
      begin
         dbms_output.put_line('Start');
         i := l_choice_temp_tab.first;
         loop
            dbms_output.put_line(l_choice_temp_tab(i).person_id||' | '||l_choice_temp_tab(i).choice_id||' | '||l_choice_temp_tab(i).added);
            i:= l_choice_temp_tab.next(i);
            exit when i is null;
          end loop;    
         dbms_output.put_line('End');
      end;Testing code
    begin
      tk_test.clear_ap_choice_temp_tab;
      tk_test.add_ap_choice_temp_row(123,321);
      tk_test.add_ap_choice_temp_row(777,555);
      tk_test.add_ap_choice_temp_row(9999,4445);
      tk_test.remove_ap_choice_temp_row(777,555);
      --tk_test.print_ap_choice_temp_tab;
    end;     Do you have any nice example how to use what you're suggesting in APEX? I mean "create some collection at page display time, let the user update the collection (through checkboxes) while they're scrolling through things."
    I think this example would be usefull for many developers :)
    Thanks,
    Tomas

  • How to call swf file within another swf file using xml

    hii,
    I am facing some problem to call a swf file via xml when this xml file loaded it calls another swf file which includes a new xml file. now if i call this nested swf calling without xml it works but in case case of xml it is not showing the result. i m confused. how to nested xml file calling done in as2/as3. i need some logics. thanks in advance

    This is the AS3 forum and your posting involves AS2 code.  You should repost in the AS2 forum...
    http://forums.adobe.com/community/flash/flash_actionscript
    Aside from that, your problem might lie in the following lines...
    _root.createEmptyMovieClip("sub_container1", 1);
    loadMovie(sub_SWFPath[1].attributes.url, "sub_container1");
    You create the new movieclip, sub_container1,  in the _root, but you do not assign the loadMovie to load into that same movieclip (unless you have a _lockroot = true assigned in your sub-swf).  In any case, you should repost in the AS2 forum to pursue resolution.

  • Problem to call stored procedure with several IN pars and single REF Cursor

    Hi,
    Oracle 9.2.0.1
    Ole DB Provider I've got with ODP 9.2.0.4
    First I try to call packaged procedure with single
    REF CURSOR - it works fine(PROCEDURE getDep(dep OUT DEPART.refcur) IS ...).
    When I try to call procedure with additional IN parameter, I get an error ORA-01008: not all variables bound.
    Packaged procedure: PROCEDURE getDep(dep OUT DEPART.refcur, i1 IN number) IS .... and so on.
    Try to call from C#:
    cmd.CommandText = "{call depart.getDep(?)}";
    OleDbParameter par0 = cmd.CreateParameter();
    par0.Value = some value;
    par0.DbType = DbType.Int16;
    par0.OleDbType = OleDbType.Integer;
    par0.Direction = ParameterDirection.Input;
    OleDbDataAdapter da = new OleDbDataAdapter(cmd.CommandText,con);
    DataSet ds = new DataSet();
    da.Fill(ds);
    Connection string:
    "Provider=OraOLEDB.Oracle;User Id=scott;Password=tiger;Data Source=ora92;OLEDB.NET=true;PLSQLRSet=true"
    Please, HELP !
    Thanks in advance,
    Vyacheslav

    Hi,
    Are you using OLEDB.NET driver (System.Data.Oledb) or ODP.NET driver (Oracle.DataAccess)?
    If you are using ODP.NET, remember that you need to bind the refcursor output variable also (besides the numbder)
    Arnold

  • Package / procedure privileges

    In a manual, I found:
    "Database applications explicitly call packaged procedures as necessary. After being granted the privileges for the package, a user can explicitly execute any of the procedures contained in it."
    But this is not working for me. I have a developer that still cannot execute a procedure inside a package, after I granted him execute rights on the package.
    He is still getting an insufficient privileges error. Any ideas ?

    Hi,
    SQL> conn scott/tiger
    Connected.
    SQL> create or replace package test_pack as
    2 procedure proc1(a number);
    3 procedure proc2(b number);
    4 function func1(a number) return number;
    5 end;
    6 /
    Package created.
    SQL> create or replace package body test_pack as
    2 procedure proc1(a number) is
    3 begin
    4 null;
    5 end;
    6 procedure proc2(b number) is
    7 begin
    8 null;
    9 end;
    10 function func1(a number) return number as
    11 begin
    12 return (a +10);
    13 end;
    14 end;
    15 /
    Package body created.
    SQL> select test_pack.func1(4) from dual;
    TEST_PACK.FUNC1(4)
    14
    SQL> exec test_pack.proc1(1);
    PL/SQL procedure successfully completed.
    SQL> grant execute on test_pack to test;
    Grant succeeded.
    Now connect as TEST user and execute the following:
    SQL> conn test/test
    Connected.
    SQL> exec scott.test_pack.proc1(9);
    PL/SQL procedure successfully completed.
    SQL> select scott.test_pack.func1(2) from dual;
    SCOTT.TEST_PACK.FUNC1(2)
    12
    Probably, you are not prefixing the package name with the owner (in my case SCOTT).

  • How do i call a Function from another Function ?

    When i press a button, i want a series of functions to execute one after another (they contain tweens, but its irrelevant), each of them waiting for the previous to be completed. I want to put the series of functions inside one function, so i can call just this function to execute all the others. The animations are working fine, but i dont know how call Functions from within another function. Also it would be necessary each function to wait until the previous has completed, to execute. Here is a clear example of what i need to do:
    boton.onPress = animate ;
    Function animate () {
         animation1 (onComplete: animation2);
         animation2 (onComplete: animation3);
         animation3 ;
    Function animation1 () { Tween 1};
    Function animation2 () { Tween 2};
    Function animation3 () { Tween 3};
    any suggestions ?

    I'd do something like this:
    boton.onPress = animation1 ;
    Function animation1 () {
         var Tween1 = new Tween();
        Tween1.onComplete =  animation2;
    Function animation2 () {
         var Tween2 = new Tween();
         Tween2.onComplete = animation3;
    Function animation3 () {
         var Tween3 = new Tween();

  • Function call in procedure within Package Body

    I am a novice in PL/SQL so that I can't find out where the problem is. I am testing a function call in procedure within a Package Body.
    But the PL/SQL Complier doesn't compile the package body but I don't know what I do wrong. Plz let me know how to call a function in procedure within a Package Body?
    Here are the Packaget test programs..
    CREATE OR REPLACE PACKAGE manage_students
    IS
    PROCEDURE find_sname;
    PROCEDURE find_test;
    PROCEDURE find_test_called;
    FUNCTION GET_LASTMT
    RETURN SEQUENCE_TEST.SEQ_NO%TYPE;
    END manage_students;
    CREATE OR REPLACE PACKAGE BODY manage_students AS
    v_max_nbr SEQUENCE_TEST.SEQ_NO%TYPE;
    PROCEDURE find_sname
    IS
    BEGIN
    BEGIN
    SELECT MAX(SEQ_NO)
    INTO v_max_nbr
    from SEQUENCE_TEST;
    DBMS_OUTPUT.PUT_LINE('MAX NUMBER is : '||v_max_nbr);
    EXCEPTION
    WHEN OTHERS
    THEN DBMS_OUTPUT.PUT_LINE('Error in finding student_id: ');
    RETURN;
    END;
    COMMIT;
    EXCEPTION
    WHEN OTHERS
    THEN DBMS_OUTPUT.PUT_LINE('Error in finding student_id: ');
    END find_sname;
    PROCEDURE find_test
    IS
    BEGIN
    BEGIN
    DBMS_OUTPUT.PUT_LINE('MAX NUMBER Called from another procedure : '||v_max_nbr);
    EXCEPTION
    WHEN OTHERS
    THEN DBMS_OUTPUT.PUT_LINE('Error in finding student_id: ');
    RETURN;
    END;
    COMMIT;
    EXCEPTION
    WHEN OTHERS
    THEN DBMS_OUTPUT.PUT_LINE('Error in finding student_id: ');
    END find_test;
    FUNCTION GET_LASTMT
    RETURN SEQUENCE_TEST.SEQ_NO%TYPE
    IS
    v_max_nbr SEQUENCE_TEST.SEQ_NO%TYPE;
    BEGIN
    SELECT MAX(SEQ_NO)
    INTO v_max_nbr
    from SEQUENCE_TEST;
    RETURN v_max_nbr;
    EXCEPTION
    WHEN OTHERS
    THEN
    DECLARE
    v_sqlerrm VARCHAR2(250) :=
    SUBSTR(SQLERRM,1,250);
    BEGIN
    RAISE_APPLICATION_ERROR(-20003,
    'Error in instructor_id: '||v_sqlerrm);
    END;
    END GET_LASTMT;
    PROCEDURE find_test_called
    IS
    BEGIN
    BEGIN
    V_max := Manage_students.GET_LASTMT;
    DBMS_OUTPUT.PUT_LINE('MAX_NUMBER :'|| V_max);
    EXCEPTION
    WHEN OTHERS
    THEN DBMS_OUTPUT.PUT_LINE('Error in finding student_id: ');
    RETURN NULL;
    END;
    COMMIT;
    EXCEPTION
    WHEN OTHERS
    THEN DBMS_OUTPUT.PUT_LINE('Error in finding student_id: ');
    END find_test_called;
    END manage_students;
    DECLARE
    v_max SEQUENCE_TEST.SEQ_NO%TYPE;
    BEGIN
    manage_students.find_sname;
    DBMS_OUTPUT.PUT_LINE ('Student ID: Execute.');
    manage_students.find_test;
    manage_students.find_test_called;
    END;
    -----------------------------------------------------------------------------------------------

    Hi,
    Welcome to the forum!
    You'll find that there are a lot of people willing to help you.
    Are you willing to help them? Whenever you have a problem, post enough for people to re-create the problem themselves. That includes CREATE TABLE and INSERT statements for all the tables you use.
    Error messages are very helpful. Post the complete error message you're getting, including line number. (It looks like your EXCEPTION sections aren't doing much, except hiding the real errors. That's a bad programming practice, but probably not causing your present problem - just a future one.)
    Never post unformatted code. Indent the code to show the extent of each procedure, and the blocks within each one.
    When posting formatted text on this site, type these 6 characters:
    \(all small letters, inside curly brackets) before and after each section of formatted test, to preserve the spacing.
    For example, the procedure find_test_called would be a lot easier to read like this:PROCEDURE find_test_called
    IS
    BEGIN
         BEGIN
              V_max := Manage_students.GET_LASTMT;
              DBMS_OUTPUT.PUT_LINE ('MAX_NUMBER :' || V_max);
         EXCEPTION
              WHEN OTHERS
              THEN
                   DBMS_OUTPUT.PUT_LINE ('Error in finding student_id: ');
                   RETURN      NULL;
         END;
         COMMIT;
    EXCEPTION
         WHEN OTHERS
         THEN
              DBMS_OUTPUT.PUT_LINE ('Error in finding student_id: ');
    END find_test_called;
    It's much easier to tell from the code above that you're trying to return NULL from a procedure.  Only functions can return anything (counting NULL); procedures can have RETURN statements, but that single word"RETURN;" is the entire statement.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Calling a procedure from a package or another procedure

    Hi all,
    I am trying to call a couple of procedures defined in a package using the 'call' method without any success.
    i tried to create a third procedure and call the other two procedures from there, still without success. Can some one tell me the right method? also i've been trying to research a lot, but havent found any helpful documentation. where would i look for good help material on PL/SQL?
    Purvi.

    All Oracle's documentation is available online at http://tahiti.oracle.com. In particular, the PL/SQL User's Guide would probably be the most helpful to you.
    "call" is something that is generally used on client applications (ODBC and JDBC based). It is not used when calling stored procedures in PL/SQL. If you have procedures proc1 and proc2, you can call them from a third stored procedure proc3 like this
    CREATE OR REPLACE PROCEDURE proc1
    AS
    BEGIN
      dbms_output.put_line( 'proc1' );
    END;
    CREATE OR REPLACE PROCEDURE proc2
    AS
    BEGIN
      dbms_output.put_line( 'proc2' );
    END;
    CREATE OR REPLACE PROCEDURE proc3
    AS
    BEGIN
      proc1();
      proc2();
    END;If both proc1 and proc2 were in a package called myPkg, and proc3 was a standalone procedure, you would need to modify it to reference the package name
    CREATE OR REPLACE PROCEDURE proc3
    AS
    BEGIN
      myPkg.proc1();
      myPkg.proc2();
    END;Justin
    Distributed Database Consulting, Inc.
    http://www.ddbcinc.com/askDDBC

  • How to call a procedure from within another procedure?

    What's the syntax to call a procedure from within a procedure.
    I have a procedure z(user_id IN number, ....)
    then
    procedure a (user_id IN number, ....)
    procedure b (user_id IN number, ....)
    procedure c (user_id IN number, ....)
    I want to call procedure a, b, c from inside procedure z.
    How would I do that?

    Same way :
    SCOTT@db102 SQL> create or replace procedure a (p1 in varchar2) is
      2  begin
      3     dbms_output.put_line (p1);
      4* end;
    SCOTT@db102 SQL> /
    Procedure created.
    SCOTT@db102 SQL> create or replace procedure z (par1 in number) is
      2  begin
      3     if par1 != 0 then
      4             a ('This is proc a');
      5     end if;
      6* end;
    SCOTT@db102 SQL> /
    Procedure created.
    SCOTT@db102 SQL> set serveroutput on
    SCOTT@db102 SQL> exec z (1);
    This is proc a
    PL/SQL procedure successfully completed.
    SCOTT@db102 SQL>                                                    

  • Unable to call a procedure from inside a another procedure

    Dear members
    I am trying to call a procedure from inside an another procedure.Both the procedures are present within the same package.I am trying to call the second procedure just before the end of the first procedure.Both the procedures are compiling fine but the tables are not getting populated inside the second procedure.Also the DBMS_OUTPUT statements present in second procedures are not getting displayed.(I feel the second procedured is not getting called).
    The package specification is as follows:
    CREATE OR REPLACE package ANVESH.conv_api_pkg
    is
        PROCEDURE PROC_CONVERSION_API(FILE_PATH IN VARCHAR2,FILE_NAME IN VARCHAR2) ;
        TYPE cts_order_details IS TABLE OF XXCTS_ORDER_DETAILS_STG%ROWTYPE;
        PROCEDURE proc_conversion_api2(p_orderdetails IN cts_order_details) ;
    end conv_api_pkg;The package body is as follows:
    CREATE OR REPLACE package body ANVESH.conv_api_pkg
    is
    PROCEDURE PROC_CONVERSION_API(FILE_PATH IN VARCHAR2,FILE_NAME IN VARCHAR2)
    IS
        v_file_type utl_file.file_type;
        v_buffer VARCHAR2(1000);
        V_CUSTOMER_NAME VARCHAR2(100);
        V_MANUFACTURER VARCHAR2(100);
        V_PRODUCT_NAME VARCHAR2(100);
        V_QUANTITY NUMBER;
        V_REQ_SHIP_DATE DATE;
        V_REQ_PRICE NUMBER;
        V_LOG_FILE utl_file.file_type;
        V_COUNT_CUST NUMBER;
        V_COUNT_PROD NUMBER;
       L_ORDER_LINES CONV_API_PKG.cts_order_details:=CONV_API_PKG.cts_order_details();
    BEGIN
        DBMS_OUTPUT.PUT_LINE('Inside begin 1');
        v_file_type := UTL_FILE.fopen(FILE_PATH, FILE_NAME, 'r',null);
            DBMS_OUTPUT.PUT_LINE('Inside begin 1.1');
        LOOP
            BEGIN
                        DBMS_OUTPUT.PUT_LINE('Inside begin 2');
                         UTL_FILE.GET_LINE (v_file_type,v_buffer);
                        DBMS_OUTPUT.PUT_LINE('Inside begin 2.1');
                        DBMS_OUTPUT.PUT_LINE('the  buffer is '||v_buffer);
                        DBMS_OUTPUT.PUT_LINE('the length of buffer is '||length(v_buffer));
                         V_CUSTOMER_NAME := trim(substr(v_buffer, 1, 30));
                         DBMS_OUTPUT.PUT_LINE('Customer Name is '||V_CUSTOMER_NAME);
                         V_MANUFACTURER  := trim(substr(v_buffer, 31, 40));
                         DBMS_OUTPUT.PUT_LINE('Manufacturer is '||V_MANUFACTURER);
                         V_PRODUCT_NAME  := trim(substr(v_buffer,  71, 20));
                         DBMS_OUTPUT.PUT_LINE('Product Name is '||V_PRODUCT_NAME);
                         V_QUANTITY      := to_number(trim(substr(v_buffer, 91, 5)));
                         DBMS_OUTPUT.PUT_LINE('Quantity is '||V_QUANTITY);
                         V_REQ_SHIP_DATE     := to_date(trim(substr(v_buffer, 96, 20)), 'DD-MON-YYYY');
                         DBMS_OUTPUT.PUT_LINE('Requested Ship Date is '|| V_REQ_SHIP_DATE);
                        V_REQ_PRICE        :=nvl(substr( trim(v_buffer), 116, length(v_buffer)-116),0);
                        --DBMS_OUTPUT.PUT_LINE('Requested Price is1 '||substr(v_buffer, 116, 5));
                        DBMS_OUTPUT.PUT_LINE('The requested price is  '||V_REQ_PRICE);
                V_LOG_FILE := UTL_FILE.FOPEN(FILE_PATH, 'LOG_FILE.dat', 'A');
                    IF (V_QUANTITY > 0)
                     THEN
                     DBMS_OUTPUT.PUT_LINE('The quantity is '||V_QUANTITY);
                       SELECT COUNT (*)
                       INTO V_COUNT_CUST
                       FROM CONVERSION_CUSTOMERS
                       WHERE CUSTOMER_NAME = V_CUSTOMER_NAME;
                       DBMS_OUTPUT.PUT_LINE('The Customer count is '||V_COUNT_CUST);
                       IF(V_COUNT_CUST > 0)
                       THEN
                           SELECT COUNT(*)
                           INTO V_COUNT_PROD
                           FROM conversion_products
                           WHERE PRODUCT_NAME = V_PRODUCT_NAME;
                           DBMS_OUTPUT.PUT_LINE('The Product count is '||V_COUNT_PROD);
                          IF(V_COUNT_PROD >0)
                           THEN
                                INSERT INTO XXCTS_ORDER_DETAILS_STG VALUES (V_CUSTOMER_NAME, V_PRODUCT_NAME, V_MANUFACTURER, V_QUANTITY, V_REQ_SHIP_DATE, V_REQ_PRICE, 'ACTIVE', 'ORDER TAKEN');  
                           ELSE
                                DBMS_OUTPUT.PUT_LINE('PRODUCT SHOULD BE VALID');
                                UTL_FILE.PUT_LINE(V_LOG_FILE, 'PRODUCT SHOULD BE VALID');                   
                           END IF;
                       ELSE
                          DBMS_OUTPUT.PUT_LINE('CUSTOMER SHOULD BE VALID');
                          UTL_FILE.PUT_LINE(V_LOG_FILE, 'CUSTOMER SHOULD BE VALID');
                       END IF;      
                    ELSE
                        DBMS_OUTPUT.PUT_LINE('QUANTITY SHOULD BE VALID');
                        UTL_FILE.PUT_LINE(V_LOG_FILE, 'QUANTITY SHOULD BE VALID');
                    END IF;
                    EXCEPTION
                    WHEN NO_DATA_FOUND THEN
                        EXIT;
                    END;
        END LOOP;
    SELECT CUSTOMER_NAME, PRODUCT_NAME, MANUFACTURER, QUANTITY, REQUESTED_SHIP_DATE, REQUESTED_PRICE, STATUS,MESSAGE
    BULK COLLECT
    INTO L_ORDER_LINES
    FROM XXCTS_ORDER_DETAILS_STG;
    DBMS_OUTPUT.PUT_LINE('values inserted');
    proc_conversion_api2(p_orderdetails=>L_ORDER_LINES);
    END;
    PROCEDURE proc_conversion_api2(p_orderdetails IN cts_order_details)
      IS
      V_AVL_QUANTITY CONVERSION_PRODUCTS.AVL_QUANTITY%TYPE;
      V_REQ_SHIP_DATE DATE;
      V_LIST_PRICE CONVERSION_PRODUCTS.LIST_PRICE%TYPE;
      V_NET_PRICE CONVERSION_PRODUCTS.LIST_PRICE%TYPE;
      V_NET CONVERSION_PRODUCTS.LIST_PRICE%TYPE;
      V_EXTN_PRICE CONVERSION_PRODUCTS.LIST_PRICE%TYPE;
      V_CUST_DISC CONVERSION_CUSTOMERS.DISCOUNT%TYPE;
      V_CERT_DISC CONVERSION_CERTIFICATION.DISCOUNT%TYPE;
      V_CUST_ID XXCTS_ORDER_DETAILS.CUSTOMER_ID%TYPE;
      V_PROD_ID XXCTS_ORDER_DETAILS.PRODUCT_ID%TYPE;
      V_DISC_PRICE CONVERSION_PRODUCTS.LIST_PRICE%TYPE;
      V_DISC_NAME CONVERSION_CERTIFICATION.CERTIFICATION%TYPE;
      V_TOTAL_DISC_AMT NUMBER;
      V_TOTAL_DISC NUMBER;
      V_LIMIT NUMBER;
    BEGIN
        DBMS_OUTPUT.PUT_LINE('INSIDE API_2 BEGIN 1');
            FOR i IN p_orderdetails.FIRST..p_orderdetails.LAST
            LOOP
                 BEGIN
                DBMS_OUTPUT.PUT_LINE('INSIDE API_2 BEGIN 2');
                SELECT PRODUCT_ID,AVL_QUANTITY,LIST_PRICE
                INTO V_PROD_ID,V_AVL_QUANTITY,V_LIST_PRICE
                FROM CONVERSION_PRODUCTS
                WHERE PRODUCT_NAME=p_orderdetails(i).PRODUCT_NAME;
                DBMS_OUTPUT.PUT_LINE('PRODUCT QUANTITY is '||V_PROD_ID);
                DBMS_OUTPUT.PUT_LINE('AVAILABLE QUANTITY is '||V_AVL_QUANTITY);
                DBMS_OUTPUT.PUT_LINE('LIST PRICE is '||V_LIST_PRICE);
                SELECT CUSTOMER_ID,NVL(DISCOUNT,0)
                INTO V_CUST_ID,V_CUST_DISC
                FROM CONVERSION_CUSTOMERS
                WHERE CUSTOMER_NAME=p_orderdetails(i).CUSTOMER_NAME;
                DBMS_OUTPUT.PUT_LINE('CUSTOMER ID is '||V_CUST_ID);
                DBMS_OUTPUT.PUT_LINE('CUSTOMER DISCOUNT IS '||V_CUST_DISC);
                SELECT A.DISCOUNT,A.CERTIFICATION
                INTO  V_CERT_DISC,V_DISC_NAME
                FROM CONVERSION_CERTIFICATION A,CONVERSION_CUSTOMERS B
                WHERE A.CERTIFICATION=B.CERTIFICATION(+)
                AND B.CUSTOMER_NAME=p_orderdetails(i).CUSTOMER_NAME;
                DBMS_OUTPUT.PUT_LINE('CERTIFICATION DISCOUNT IS '||V_CERT_DISC);
                V_NET:=((V_LIST_PRICE)-(V_LIST_PRICE)*(V_CERT_DISC)/100);
                DBMS_OUTPUT.PUT_LINE('NET PRICE AFTER CERTIFICATION DISCOUNT IS '||V_NET);
                V_NET_PRICE:=((V_NET)-(V_NET)*(V_CUST_DISC)/100);
                DBMS_OUTPUT.PUT_LINE('NET PRICE AFTER COMPLETE DISCOUNT IS '||V_NET_PRICE);
                V_EXTN_PRICE:=(V_NET_PRICE)*(p_orderdetails(i).QUANTITY);
                DBMS_OUTPUT.PUT_LINE('EXTENDED PRICE IS '||V_EXTN_PRICE);
                V_TOTAL_DISC:=((V_CERT_DISC)/100+(V_CUST_DISC)/100);
                DBMS_OUTPUT.PUT_LINE('TOTAL DISCOUNT IS '|| V_TOTAL_DISC);
                V_TOTAL_DISC_AMT:=(V_LIST_PRICE)-(V_NET_PRICE);
                DBMS_OUTPUT.PUT_LINE('TOTAL DISCOUNT PRICE IS '|| V_TOTAL_DISC_AMT);
                SELECT MAX(A.LIMIT)
                INTO V_LIMIT
                FROM CONVERSION_CERTIFICATION A,CONVERSION_CUSTOMERS B
                WHERE A.CERTIFICATION=B.CERTIFICATION(+)
                AND B.CUSTOMER_NAME=p_orderdetails(i).CUSTOMER_NAME;
                IF p_orderdetails(i).QUANTITY<V_AVL_QUANTITY THEN
                INSERT INTO XXCTS_ORDER_DETAILS VALUES(SEQ_HEADER_ID.NEXTVAL,SEQ_LINE_ID.NEXTVAL,V_CUST_ID,V_PROD_ID,p_orderdetails(i).QUANTITY,p_orderdetails(i).REQUESTED_SHIP_DATE,p_orderdetails(i).REQUESTED_PRICE,V_LIST_PRICE,V_TOTAL_DISC,V_NET_PRICE,V_EXTN_PRICE,'QTY HOLD','REQ QNTY LESS THAN AVL QTY',SYSDATE);
                INSERT INTO xxcts_order_discounts VALUES(SEQ_HEADER_ID.NEXTVAL,SEQ_LINE_ID.NEXTVAL,SEQ_DISCOUNT_ID.NEXTVAL,V_DISC_NAME,V_TOTAL_DISC_AMT);
                END IF;
                IF p_orderdetails(i).REQUESTED_SHIP_DATE<SYSDATE THEN
                INSERT INTO XXCTS_ORDER_DETAILS VALUES(SEQ_HEADER_ID.NEXTVAL,SEQ_LINE_ID.NEXTVAL,V_CUST_ID,V_PROD_ID,p_orderdetails(i).QUANTITY,p_orderdetails(i).REQUESTED_SHIP_DATE,p_orderdetails(i).REQUESTED_PRICE,V_LIST_PRICE,V_TOTAL_DISC,V_NET_PRICE,V_EXTN_PRICE,'DATE HOLD','SHIPDATE CANNOT BE LESS THAN CURR DATE',SYSDATE);
                INSERT INTO xxcts_order_discounts VALUES(SEQ_HEADER_ID.NEXTVAL,SEQ_LINE_ID.NEXTVAL,SEQ_DISCOUNT_ID.NEXTVAL,V_DISC_NAME,V_TOTAL_DISC_AMT);
                END IF;
                IF V_NET_PRICE>p_orderdetails(i).REQUESTED_PRICE THEN
                INSERT INTO XXCTS_ORDER_DETAILS VALUES(SEQ_HEADER_ID.NEXTVAL,SEQ_LINE_ID.NEXTVAL,V_CUST_ID,V_PROD_ID,p_orderdetails(i).QUANTITY,p_orderdetails(i).REQUESTED_SHIP_DATE,p_orderdetails(i).REQUESTED_PRICE,V_LIST_PRICE,V_TOTAL_DISC,V_NET_PRICE,V_EXTN_PRICE,'PRICE HOLD','NET PRICE CANNOT BE MORE THAN REQ PRICE',SYSDATE);
                INSERT INTO xxcts_order_discounts VALUES(SEQ_HEADER_ID.NEXTVAL,SEQ_LINE_ID.NEXTVAL,SEQ_DISCOUNT_ID.NEXTVAL,V_DISC_NAME,V_TOTAL_DISC_AMT);
                END IF;
               /* IF V_LIMIT<p_orderdetails(i).REQUESTED_PRICE THEN
                INSERT INTO XXCTS_ORDER_DETAILS VALUES(SEQ_HEADER_ID.NEXTVAL,SEQ_LINE_ID.NEXTVAL,V_CUST_ID,V_PROD_ID,p_orderdetails(i).QUANTITY,p_orderdetails(i).REQUESTED_SHIP_DATE,p_orderdetails(i).REQUESTED_PRICE,V_LIST_PRICE,V_TOTAL_DISC,V_NET_PRICE,V_EXTN_PRICE,'ORDER LIMIT HOLD','PRICE CANNOT EXCEED ORDER LIMIT',SYSDATE);
                INSERT INTO xxcts_order_discounts VALUES(SEQ_HEADER_ID.NEXTVAL,SEQ_LINE_ID.NEXTVAL,SEQ_DISCOUNT_ID.NEXTVAL,V_DISC_NAME,V_TOTAL_DISC_AMT);
                END IF;*/
                EXCEPTION
                WHEN NO_DATA_FOUND THEN
                DBMS_OUTPUT.PUT_LINE(' INSIDE EXCEPTION BLOCK');
                END;
            END LOOP;
    END;
    end conv_api_pkg;
    /the pl/sql block to invoke the the procedure :
    declare
    begin
    PROC_CONVERSION_API('/usr/tmp' ,'Walmart_Orders_062908.dat');
    end;please let me know what is wrong in the program.
    Thanks
    Anvesh

    Hi Walter
    Yes 'Inside begin 1' and 'Inside begin 2' were printed.Please find the the DBMS_OUTPUT statements that were printed.
    Inside begin 1
    Inside begin 1.1
    Inside begin 2
    Inside begin 2.1
    the  buffer is BESTBUY                       SONY ERICSSON                           W580i               25   1-AUG-2008          50
    the length of buffer is 118
    Customer Name is BESTBUY
    Manufacturer is SONY ERICSSON
    Product Name is W580i
    Quantity is 25
    Requested Ship Date is 01-AUG-08
    The requested price is  50
    The quantity is 25
    The Customer count is 1
    The Product count is 0
    PRODUCT SHOULD BE VALID
    Inside begin 2
    Inside begin 2.1
    the  buffer is BESTBUY                       SAMSUNG                                 BLACKJACK           50   15-JUL-2008         150
    the length of buffer is 119
    Customer Name is BESTBUY
    Manufacturer is SAMSUNG
    Product Name is BLACKJACK
    Quantity is 50
    Requested Ship Date is 15-JUL-08
    The requested price is  150
    The quantity is 50
    The Customer count is 1
    The Product count is 1
    Inside begin 2
    Inside begin 2.1
    the  buffer is BESTBUY                       APPLE                                   IPHONE 4GB          50   15-JUL-2008        
    the length of buffer is 116
    Customer Name is BESTBUY
    Manufacturer is APPLE
    Product Name is IPHONE 4GB
    Quantity is 50
    Requested Ship Date is 15-JUL-08
    The requested price is  0
    The quantity is 50
    The Customer count is 1
    The Product count is 1
    Inside begin 2
    Inside begin 2.1
    the  buffer is BESTBUY                       ATT                                     TILT                100  15-JUN-2008        
    the length of buffer is 116
    Customer Name is BESTBUY
    Manufacturer is ATT
    Product Name is TILT
    Quantity is 100
    Requested Ship Date is 15-JUN-08
    The requested price is  0
    The quantity is 100
    The Customer count is 1
    The Product count is 1
    Inside begin 2
    Inside begin 2.1
    the  buffer is BESTBUY                       NOKIA                                   N73                 50   15-JUL-2008         200
    the length of buffer is 118
    Customer Name is BESTBUY
    Manufacturer is NOKIA
    Product Name is N73
    Quantity is 50
    Requested Ship Date is 15-JUL-08
    The requested price is  20
    The quantity is 50
    The Customer count is 1
    The Product count is 0
    PRODUCT SHOULD BE VALID
    Inside begin 2In the first procedure I am trying to read the data from a flat file and store it in a table.Here is the sample data from the flat file.
    BESTBUY                       SONY ERICSSON                           W580i               25   1-AUG-2008          50
    BESTBUY                       SAMSUNG                                 BLACKJACK           50   15-JUL-2008         150
    BESTBUY                       APPLE                                   IPHONE 4GB          50   15-JUL-2008        
    BESTBUY                       ATT                                     TILT                100  15-JUN-2008        
    BESTBUY                       NOKIA                                   N73                 50   15-JUL-2008         200When tried to execute the second procedure independently using the PL/SQL block,the tables in second procedure were populated and the DBMS_Output statements were also displayed.I have made use of the same query in that case
    Thanks
    Anvesh
    Edited by: Anvesh Reddy on Dec 23, 2008 12:40 PM

  • Unable to compile a package calling a package procedure in different schema

    Hello,
    I'm unable to compile a package referencing a package located in another schema. I get the message: PLS-00201: identifier 'pkg1' must be declared
    Facts:
    0. I'm running Oracle DB 10.2.0.4.0 Enterprise Edition
    1. There is one schema ('schema1') containing a package ('pkg1').
    2. This package 'pkg1' has a public synonym ('pkg1' as well).
    3. The EXECUTE grant is given to a role ('role1').
    4. There is another schema 'schema2', which is granted the role 'role1' (and set as default).
    5. This schema 'schema2' contains a package ('pkg2').
    6. This package 'pkg2' calls a procedure of 'pkg1'.
    7. When compiling 'pkg2', I get error message saying 'pkg1' does not exist.
    Of course, if I execute 'GRANT EXECUTE ON pkg1 TO PUBLIC' or 'GRANT EXECUTE ON pkg1 TO schema2', I can compile the package 'pkg2'. But I don't want this.
    And what's weird is that, connected as 'schema2', I can execute the statement 'execute pkg1.proc1' without any trouble. So I guess the role setup is okay.
    What would let me compile 'pkg2' properly?
    Regards,
    Arnaud

    user3347638 wrote:
    Hello,
    I'm unable to compile a package referencing a package located in another schema. I get the message: PLS-00201: identifier 'pkg1' must be declared
    Facts:
    0. I'm running Oracle DB 10.2.0.4.0 Enterprise Edition
    1. There is one schema ('schema1') containing a package ('pkg1').
    2. This package 'pkg1' has a public synonym ('pkg1' as well).
    3. The EXECUTE grant is given to a role ('role1').
    4. There is another schema 'schema2', which is granted the role 'role1' (and set as default).
    5. This schema 'schema2' contains a package ('pkg2').
    6. This package 'pkg2' calls a procedure of 'pkg1'.
    7. When compiling 'pkg2', I get error message saying 'pkg1' does not exist.
    Of course, if I execute 'GRANT EXECUTE ON pkg1 TO PUBLIC' or 'GRANT EXECUTE ON pkg1 TO schema2', I can compile the package 'pkg2'. But I don't want this.
    And what's weird is that, connected as 'schema2', I can execute the statement 'execute pkg1.proc1' without any trouble. So I guess the role setup is okay.
    What would let me compile 'pkg2' properly?
    Regards,
    Arnaudprivileges acquired via ROLE do NOT apply within named PL/SQL procedures.
    above is just a restriction built into PL/SQL.
    accept it & get on with reality

Maybe you are looking for

  • Database movement from Hp 11.00 to AIX 5.3 (db version : 8.1.7.3 )

    Hi. I need to move a database from HP 11.00 machine to IBM AIX 5.3 machine. the database version is 8.1.7.3. and is around 400gb. Will the normal database cloning work? or what the best method to do it. pls help me in doing this activity. Thanks in a

  • Color/tone of photo changes when printing...

    I'm trying to print a photos for an invitation, its a black and white photo with a pink background.  The black and white levels have been adjusted to a very light tone since I have to put vellum paper on top with the invitation wording... When I send

  • Select fields to print in contacts for labels

    Trying to print out mailing labels for Christmas Cards.  Would like to select the fields I want to print on my labels.  I have Mr. & Mrs. in my company field, and wish to use it instead of my name field.  Is there a way to do this?

  • IPhone Configuration Utility ?

    Hi, Does anyone else know how to work with the iPhone Configuration Utility.app ? BR BenNovello

  • Add or change Contact Photos with Maverick

    Add or change contact pictures is not working in Contacts with Maverick! Editing or Changing Contact Photos by double clicking on the photo box opens a menu with the options of: Defaults, iCloud, Faces, and Camera. However if I try and use Faces, the