Calling the package having cursor type and record type variables

Hi ,
I tried the following pacakge ,which is similar to my requriement ,the package got created succesfully, while calling it is giving me the error, Wrong no.of arguments
CREATE OR REPLACE PACKAGE Pkg_test1
IS
  ----- Record Variable ----
  TYPE rec_job IS RECORD
   ( job varchar2(50),
     ename varchar2(50),
     sal number
  TYPE typ_job IS TABLE OF rec_job;
  -- cursor declaration
  cursor emp_cur is select empno from  emp;
  TYPE emp_ttyp IS TABLE OF emp_cur%ROWTYPE INDEX BY PLS_INTEGER;
  ---- Procedure Declaration ----
PROCEDURE proc_job ( p_cur IN   emp_ttyp,
                     o_Rat     OUT  typ_job );
END Pkg_test1;
CREATE OR REPLACE PACKAGE BODY Pkg_test1
IS
PROCEDURE proc_job ( p_cur IN   emp_ttyp, o_Rat     OUT  typ_job )
  IS
    -- Declare collection variable
    l_typ_job typ_job;
BEGIN
   for i  in 1..p_cur.count loop
    select job,ename,sal bulk collect into l_typ_job
      from emp
      where empno=p_cur(i).empno ;
o_Rat:= l_typ_job;
end loop;
--Output
for i in 1..o_rat.count loop
DBMS_OUTPUT.PUT_LINE ( 'Output :'||o_rat(i).job||','||o_rat(i).ename||','||o_rat(i).sal );
  end loop;
EXCEPTION
  WHEN OTHERS THEN
       DBMS_OUTPUT.put_line('Procedure proc_job  - '|| SQLCODE|| '-'|| SQLERRM);
END proc_job;
  end pkg_test1;
/The package is created without errors
But while calling it is giving me the errors
DECLARE
  P_CUR PKG_TEST1.emp_ttyp;
  O_RAT PKG_TEST1.rec_job;
BEGIN
  PKG_TEST1.PROC_JOB ( P_CUR, O_RAT );
  COMMIT;
END; Error is ::
PLS-00306: wrong number or types of arguments in call to 'PROC_JOB'Could you hint me how to overcome this error..
Thank you..
Edited by: Smile on May 9, 2012 7:27 AM

# If p_cur input parameter is uninitialized and NULL then you cannot use any nested table function like count, first, last. Hence call to "p_cur.count " failes with error - "ORA-06531: Reference to uninitialized collection"
# Always check uninitialized collection using "IS NULL or IS NOT NULL" condition
# There is one more logic error:
for i  in 1..p_cur.count loop
    select job,ename,sal bulk collect into l_typ_job
      from emp
      where empno= SELECT column_value FROM (p_cur); (i).empno ;
   o_Rat:= l_typ_job;# You Iterate through all employees inp_cur but the o_Rat will contain only employee details for last employee in the p_cur table. You must use statement like "o_Rat := o_Rat MULTISET UNION l_typ_job;" to append the values into existing collection
Your package should look like:
CREATE OR REPLACE PACKAGE pkg_test1 IS
   ----- Record Variable ----
   TYPE rec_job IS RECORD(
      job   VARCHAR2(50),
      ename VARCHAR2(50),
      sal   NUMBER);
   TYPE typ_job IS TABLE OF rec_job;
   -- cursor declaration
   CURSOR emp_cur IS
      SELECT empno FROM emp;
   TYPE emp_ttyp IS TABLE OF emp_cur%ROWTYPE INDEX BY PLS_INTEGER;
   ---- Procedure Declaration ----
   PROCEDURE proc_job(p_cur IN emp_ttyp, o_rat OUT typ_job);
END pkg_test1;
CREATE OR REPLACE PACKAGE BODY pkg_test1 IS
PROCEDURE proc_job(p_cur IN emp_ttyp, o_rat OUT typ_job) IS
-- Declare collection variable
l_typ_job typ_job;
BEGIN
IF p_cur IS NULL THEN
   dbms_output.put_line('No employees as p_cur is NULL');
END IF;
IF p_cur IS NOT NULL THEN
  FOR i IN 1 .. p_cur.count LOOP
    SELECT job, ename, sal BULK COLLECT INTO l_typ_job
    FROM emp
    WHERE empno = p_cur(i).empno;
    o_rat := o_rat MULTISET UNION l_typ_job;
  END LOOP;
  --Output
  FOR i IN 1 .. o_rat.count LOOP
    dbms_output.put_line('Output :' || o_rat(i).job || ',' || o_rat(i).ename || ',' || o_rat(i).sal);
  END LOOP;
END IF;
EXCEPTION
WHEN OTHERS THEN
   dbms_output.put_line('Procedure proc_job  - ' || SQLCODE || '-' || SQLERRM);
END proc_job;
END pkg_test1;
{code}
Edited by: Himanshu Binjola on May 9, 2012 3:40 AM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

Similar Messages

  • Help in using record type and object type

    Hi Experts,
    I am new to object types and record types.
    I want to return the output of this query using one OUT parameter
    from the procedure using RECORD type or OBJECT type.
    with out using refcursor.
    SELECT empno,ename,sal FROM emp WHERE deptno=30;
    Let us assume the query is returning 50 records.
    I want to send those 50 records to OUT parameter using record type or object type.
    Please provide the for the requirement code using RECORD TYPE and OBJECT TYPE separately.
    Your earliest response is appreciated.
    Thanks in advance.

    Hi All,
    I have tried this.But it ising not work
    CREATE OR REPLACE PACKAGE maultiplevalues_pkg
    IS
    TYPE t_record IS RECORD
    (empno emp.empno%TYPE,
    ename emp.ename%TYPE,
    sal emp.sal%TYPE);
    V_RECORD t_record;
    TYPE t_type IS TABLE OF V_RECORD%TYPE;
    PROCEDURE maultiplevalues_pROC(p_deptno IN emp.deptno%TYPE,
    dept_result OUT t_type);
    END;
    CREATE OR REPLACE PACKAGE body maultiplevalues_pkg
    IS
    PROCEDURE maultiplevalues_pROC(p_deptno IN emp.deptno%TYPE,
    dept_result OUT t_type)
    is
    begin
    dept_result :=t_type();
    for I in(
    select EMPNO,ENAME,SAL from EMP WHERE deptno=p_deptno
    LOOP
    dept_result.extend;
    dept_result(i).empno :=i.empno;
    dept_result(i).ename :=i.ename;
    dept_result(i).sal :=i.sal;
    END LOOP;
    END;
    END;
    Please help me OUT return multiple values through single OUT variable in a procedure.
    Thanks.

  • Calling Oracle Stored proc with record type and table Type

    I have a oracle SP which takes record type and table Type which are used for order management.
    Is there anay way to populate parameters with these datatypes and call the stored procedure using ODP.NET?
    Please help.
    Thanks in advance

    Hi,
    ODP supports associative arrays and REF Cursors. There is no support for PLSQL table of records.
    Jenny

  • How does a record type and table type works

    Hi,
    How a record type and table type work for the ref cursor,
    below i m giving an example but its giving me errors
    can any one help me for this?
    declare
    type empcurtyp is ref cursor;
    type rectype is record (veid t.emp_id%type, vename t.ename%type);
    TYPE tabtype IS TABLE OF rectype;
    empcv empcurtyp;
    vtab tabtype;
    begin
    open empcv for select emp_id,ename from t;
    loop
    fetch empcv into vtab;
         exit when empcv%notfound;
         dbms_output.put_line(vtab.vename||vtab.veid);
    end loop;
    close empcv;
    end;
    here we hav table t and i m taking only two fields of the table t which r emp_id and ename.

    Hi,
    What errors are you getting with this? From experience you don't need a loop to put the records into the ref cursor its usually done on block.
    HTHS
    L :-)

  • Definition of Message Type and Transaction Type from the Implementation per

    My assumption is that both, Notification Type and Message Types are same.
    <b>Is the above assumption right?</b>
    In Sol Man 4.0, the notification types required are
    1)     ABSC  2) SLF1 3) TASK
    <b>Are there any other notification types required for Sol Man 4.0?</b>
    The main transaction types required in Sol Man 4.0 are
    SLFI, SLFT and SLFN
    <b>What is the significance of External Number range and Internal Number range used in the transaction type?</b>

    Hi
    1 > A data type</i> in a programming language is a set of data with values having predefined characteristics. Examples of data types are: integer, floating point unit number, character, string, and pointer.
    The characteristic of columns and variables that defines what types of data values they can store. Examples include character, floating point and integer
    Check out the details:
    http://en.wikipedia.org/wiki/Data_type
    A message type comprises a data type that describes the structure of a message. At the following points in SAP Exchange Infrastructure you can refer to the message to be exchanged at runtime by using the message type:
    details:
    http://help.sap.com/saphelp_nw04/helpdata/en/2d/c0633c3a892251e10000000a114084/content.htm
    2) Regarding the difference between XI 3.0 and PI 7.0, this threads will clear your doubts:
    difference between XI 3.0 and P.I 7.0
    Difference/ changes from XI 3.0 to PI 7.0
    Regard's
    Chetan Ahuja

  • Calling the packager as part of the automated build process

    Hi,
    Is it possible to call the iPhone packager via command line or ANT script? We are developing a pure ActionScript application, and as part of the build process for this app, we'd like to call the packager to build the IPA file.
    Is this possible?
    Stephen

    Is possible.
    This is a piece from my ant build the variables must be configured properly
        <target name="test_package_iphone" depends="-chkName, -iPhonePWD" description="packageApp">
            <apply executable="${PFI_BAT}" parallel="true" dir="${DEBUG_DIR}" relative="true">
                <arg value="-package"/>
                <arg value="-target"/>
                <arg value="ipa-test"/>
                <arg value="-provisioning-profile"/>
                <arg value="${IPHONE_PROVISIONING}"/>
                <arg value="-storetype"/>
                <arg value="pkcs12"/>
                <arg value="-keystore"/>
                <arg value="${IPHONE_KEYSTORE}"/>
                <arg value="-storepass"/>
                <arg value="${IPHONE_PASSWORD}"/>
                <arg value="${app.name}.ipa"/>
                <arg value="${app.name}-app.xml"/>
                <arg value="${app.name}.swf"/>
                <arg value="-C"/>
                <arg value="${ASSETS_DIR}"/>
                <srcfile/>
                <fileset dir="${ASSETS_DIR}"/>
            </apply>
        </target>

  • How can I call the jFreeChart to plot graph and get the result in Servlet?

    I want to use jFreeChart to plot time series graph, and then output the result in Servlet. How can I call the jFreeChart to plot graph and get back the result? Any source code for example? Thanks a lot!!

    Dave,
    ServletDemo1 and others were not in the distribution that I got (jfreechart-0.9.4). I found them under the premium demos somewhere in com/refinery/chart/demo/premium, but could not compile. They're complaining, among other things, about missing classes/packages com.refinery.date.SerialDate and com.refinery.ui. Am I using a wrong version of jfreechart?
    Thanks,
    -Alla
    There is a very simple servlet demo in the JFreeChart
    distribution:
    src/com/jrefinery/chart/demo/ServletDemo1.java
    This simply sends back an image to the browser.
    A second demo, which embeds the chart in an HTML page
    is:
    src/com/jrefinery/chart/demo/ServletDemo2.java
    src/com/jrefinery/chart/demo/ServletDemo2ChartGenerator
    java
    ...includes a time series chart as one of three
    options.
    Regards,
    Dave Gilbert
    JFreeChart Project Leader
    http://www.object-refinery.com/jfreechart/index.html

  • How can I Call the MainVI from its SubVI, and this happen recursively?

    Hi All,
    How can I Call the MainVI from its SubVI, and this happen recursively?
    Actually, LAbView 7.1 doesn't support recurssion?
    Plz help me out!

    Dear GerdW,
    Thanks a lot 2 all of u guys,for all the brilliant responses.
    Actually, my basic aim is to call the Main VI, containing a SubVI.....
    Now, I want to call my main VI from this SubVI...recursively!!!!!..but whenever I tried to put the MainVI in this SubVI..an error message pops out saying recursive calling is not possible.
    I also tried using "Call by reference" but tht also didn't worked...an d error is somewat like...VI is invalid..or type matching..or state matching error.
    Here, Im attaching the snapshot of the MainVI... Im calling the SUBvi from it... It is running GOOD n FINE...
    But prob arrives when I call the Main from the SUBvi, which looks like same as MainVI(with little differences).
    I hope, Im clear in my words n not being ambigous.
    Plz, correct me where ever  im wrong.
    Thank You.
    Mishra_RnD
    Attachments:
    ScrShot.JPG ‏272 KB

  • Where can I get the realtion  between Tcode ,idoctype and message type??

    Hello ,
    I would like to know the relation between Transaction code,idoc type and Message type.
    In which table I can find or which Transatcion I can get all these information..?
    Relation with Transaction code is must where can i find....??
    Please help me in this....
    Thanks in Advance
    Regards
    Preethi

    Hello ,
        It was very helpful answer.....
        But I want the relation with Transaction code....How can I find the realtion between Tcode and Idoc type or Tcode and message type...??
    Please let me know this...
    Thanks in advance..
    Regards
    Preethi

  • What is the difference between partner function and partner type

    Hi Gurus,
    What is the difference between partner function and partner type?
    Thanks,
    Paul

    Hi John,
    The partner types allow us to distinguish between different business partners such as customer, vendor, employee etc and the partner functions represent the functionality or role each partner plays within the business transaction.
    For example under the partner type Customer, you will find - Sold to party, Ship to party, Bill to party, Payer.
    The business partners that exist in the market place are represented with a partner type in the R/3 system. Examples of business partners are customer, vendor, employee and contact person.
    The following partner types are defined in the partner processing for the sales & distribution module –
    a.     AP – contact person (06)
    b.     KU – customer (07)
    c.     LI – vendor (08)
    d.     PE – employee/personnel (09)
    Assigning the partner functions in the SAP system determines the functions of particular partner in the sales process. One partner may take on several functions also.
    REWARD POINTS IF HELPFUL
    Regards
    Sai

  • What is the message type and basic type used for catsdb in idoc help me

    what is the message type and basic type used for catsdb in idoc help me
    ANY IDOC FOR CATSDB PLEASE TELL,
    Regards,
    Jagrut BharatKumar Shukla
    points will be awarded

    Hi,
    Check these message types.
    ATT_ABS_WITH_COST and WORKSCHED_WITH_COST.

  • I want the message types and basic types for catsdb table

    i want the message types and basic types for catsdb table

    Hi Jagrut,
    Message Class is "LR".
    <b>Reward points, if helpful.</b>
    Regards,
    Atin

  • [svn:fx-4.0.0] 13647: this should actually fix the build - call the modified main target to call the bundle task for osmf and actually make the call from frameworks /build.xml

    Revision: 13647
    Revision: 13647
    Author:   [email protected]
    Date:     2010-01-19 17:04:22 -0800 (Tue, 19 Jan 2010)
    Log Message:
    this should actually fix the build - call the modified main target to call the bundle task for osmf and actually make the call from frameworks/build.xml
    QE notes:
    Doc notes:
    Bugs:
    Reviewer:
    Tests run:
    Is noteworthy for integration:
    Modified Paths:
        flex/sdk/branches/4.0.0/frameworks/build.xml

    Hi Renuka,
    The model classes get generated under gen_cmi folder at the time of model import.
    As far I know, the Web Dynpro build operation also re-generates these classes if reqd.
    That is why I asked you to delete the gen_* folder content & do a Project Rebuild operation.
    Or you can delete the model & try importing it again.
    If the problem persists with the generated classes then there is an issue/bug with the generation & I would recommend to raise an OSS message (WD Java component)
    Kind Regards,
    Nitin

  • What is the diff bet condition class and condition type.

    Hello Gurus
    What is the diff bet condition class and condition type.
    I have seen so many threads on this but not getting the exact usefullness.
    Difference between Condition class and Condition Category
    What is the difference between condition class and condition category?
    Condition class and condition category etc.
    As per the knowledge i gained condition class tells the type of the condition ie either price , discount ,taxes etc.
    Then please tell me why we require cond category.Please give a business scenario where we can justify it use.

    Hi shiva
                      Difference between Condition Category and Condition Class
    Condition Category -
    It is the Classification of conditions as per the categories ,Say  for example Freight condition types  you have the same conditon category
    Condition class  -
    It classifies the condition types as price , discounts , taxes , discount etc
    Regards
    Srinath

  • I have a podcast that isn't updating with the weekly podcast.  I called the company that submits them and they say it's on itunes as they have been submitting them. Any suggestions?

    I have a podcast that isn't updating with the weekly podcast.  I called the company that submits them and they say it's on itunes as they have been submitting them. Any suggestions?

    Apple isnt here. this is a user based forum for technical questions. The solution is to restart, reset, and restore as new which is in the manual after that get it replaced for hard ware failure. if your within your one year warranty its replaced if it is out of the warranty then it is 199$

Maybe you are looking for

  • Printing iPod Playlists - Impossible?

    Wondering if anyone else has had this problem and if they've found a solution. My music collection is larger than the capacity of my iPod and I like having control over what is (and is not) on the iPod, so I use manual updating. It's been great. I en

  • Reset my phone and now I have lost all my contacts.How can i retrieve them?

    I was having trouble syvcing my phone with the computer and 1 of the prompts was reset the phone and be able to retrieve my data later. Unfortunatley i'm having some trouble doing that. Could somebody help me with problem. Regards Mick

  • How to produce a HD video compatible with a Samsung Smart TV

    Using Compressor I need to produce a HD video compatible with an Smart Samsung TV. I have tried many formats, but no one is readable. Could you help ? Celes

  • Install Info Objects

    How to install all Info Objects from Business Content to BW at a time?

  • Pinning Objects - Oracle Apps

    Hi All, Has anyone done pinning of objects in shared_pool for any oracle apps related objects ? I would like to know, how to identify the candidates for pinning. Do we need to pin the objects based on their sharable memory or loads into shared_pool o