How do we call a function returning a collection from package

Dear Member,
i have a package spec whose code is as follows:
create or replace package c_test as
procedure main;
TYPE JOURNAL_HEADER_TYPE IS TABLE OF NUMBER;
l_header JOURNAL_HEADER_TYPE := JOURNAL_HEADER_TYPE();
TYPE JOURNAL_SOURCE_TYPE IS TABLE OF VARCHAR2(255);
l_source  JOURNAL_SOURCE_TYPE := JOURNAL_SOURCE_TYPE();
FUNCTION JOURNAL_SOURCE_STRING(P_SOURCE_STRING IN VARCHAR2)
RETURN JOURNAL_SOURCE_TYPE;
FUNCTION JOURNAL_HEADER_STRING(P_HEADER_STRING IN VARCHAR2)
RETURN JOURNAL_HEADER_TYPE;
end main;
I have a package body in which i am trying to call the above functions in the procedure main:
SELECT COUNT(*)
INTO l_je_header_id_count
FROM ( select c_charge.je_header_id je_header_id
from dual)
WHERE je_header_id IN (select * from THE ( SELECT CAST(JOURNAL_HEADER_STRING(P_JOURNAL_HEADER_ID) AS JOURNAL_HEADER_TYPE ) FROM dual ))
if i try to compile the package its giving me ORA-00902: invalid datatype error. How do i remove this error.
If i create both "Type" and "Function" separately outside package then the above sql works perfectly.
Please correct me if am doing any thing wrong here.
Thanks

Hi,
The collection type that you declared local to the pl/sql procedure/ package and is not visible to SQL.
If you want to use the collection in your sql, you need to create it as a SQL Type and then use it in your queries.
Thanks.
Rajesh.

Similar Messages

  • How do you call a function that belongs in a package?

    Hello,
    Can anyone help me with this issue? My intent is to create a procedure that returns a cursor to the results of the query without passing in the cursor to the function. After reading thru online tutorials, I found that I had to create a function, not a procedure.
    I created a .sql file as such:
    create or replace package GetEmployeeCursors is
    type empResultSet is REF CURSOR;
    function Funct1 return empResultSet;
    end GetEmployeeCursors;
    create or replace package body GetEmployeeCursors is function Funct1 return
    empResultSet is
    tmpResultSet empResultSet;
    begin
    open tmpResultSet for
    select * from employee;
    return tmpResultSet;
    end Funct1;
    end GetEmployeeCursors;
    Both the package and package body were created without any problems.
    Then, I tried to call the Funct1() in many ways, including the following:
    call System.getEmployeeCursors.Funct1()
    call getEmployeeCursors.Funct1()
    call Funct1()
    All produced the following error message:
    ERROR at line 1:
    ORA-06576: not a valid function or procedure name
    How do I call Funct1()?
    Thanks so much in advance,
    --Anna                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    Hello Frank,
    Thanks for the information regarding not using the system schema when creating packages.
    I tried what you suggested to call the Funct1 in many ways:
    SQL> mycursor := system.getEmployeeCursors.funct1;
    SP2-0734: unknown command beginning "mycursor :..." - rest of line ignored.
    SQL> mycursor := getEmployeeCursors.funct1;
    SP2-0734: unknown command beginning "mycursor :..." - rest of line ignored.
    SQL> mycursor := funct1;
    SP2-0734: unknown command beginning "mycursor :..." - rest of line ignored.
    SQL> select *
    2 from table(system.getEmployeeCursors.funct1);
    from table(system.getEmployeeCursors.funct1)
    ERROR at line 2:
    ORA-22905: cannot access rows from a non-nested table item
    Could there be something else I need to do before making the function call?
    Thanks alot!
    --Anna                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • How do you call a function in an attached MovieClip from the current MovieClip?

    Hi there,
    I have this MovieClip A (converted as a symbol) and put in my
    main MovieClip B using attachMovie() , and I am wondering how I can
    call a function defined in A from within B.
    Is it possible?
    Thanks

    Hi kglad,
    yes, I did the attachMovie of the symbol B and it seems like
    none of the ActionScript written in B was not carried over.
    This is how I built B into a symbol :
    (1) Two layers ( one for the ActionScript only, the other for
    the Components)
    (2) I defined the functions to be called remotely by A in the
    ActionScript layer
    (3) I selected all the components in the Components Layer and
    did a Convert To Symbol
    (4) I added the Symbol into A's Library
    (5) I used attachMovie to instantiate the Symbol of B
    I must have missed out something somewhere
    Thanks

  • How can I call a function from a procedure

    I have a function named: f_calc_value which return the variable v_result. This function is part of a package.
    How can I call this function from a new procedure I am creating?
    Thanks

    or refer this theread....calling function from procedure

  • How do I call a function in java?

    I'm calling a function called lightParse() from the method. But, I'm getting an error:
    F:\Data>javac -classpath xerces.jar;xalan.jar;classpath%; Test.java
    Test.java:22: lightParse(java.lang.String) in Test cannot be applied to ()
    lightParse();
    ^
    The scenario or code portion is :
    import javax.swing.*;
    import java.awt.*;
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import org.w3c.dom.Document;
    import org.w3c.dom.Node;
    import org.w3c.dom.NodeList;
    import org.xml.sax.SAXException;
    public class Test extends JFrame
         JList list;
         JScrollPane listContainer;
         public Test()
              setSize(300, 300);
              setVisible(true);
              initialize();
              lightParse(); // calling the function
         public void initialize()
              list = new JList(new DefaultListModel()); // Set the initial model
              listContainer = new JScrollPane(list);
              listContainer.setSize(new Dimension(200, 200));
              getContentPane().setLayout(new BorderLayout());
              getContentPane().add(listContainer, "Center");
              validate(); // Validate the screen
    // The function is the following
         public void lightParse(String url)
              DocumentBuilder parser;
              DocumentBuilderFactory factory =
                        DocumentBuilderFactory.newInstance();
              try {
                        parser = factory.newDocumentBuilder();
                        Document doc = parser.parse(url);
    How do I call the function correctly with the right parameter?
    Thanks in advance for the answer.

    u r calling lightParse method without passing the expected "String" argument. There must not be an overloaded method for lightParse without any arguments.
    So u should use this:
    lightParse(some string here);
    Hope this explains.
    I'm calling a function called lightParse() from the
    method. But, I'm getting an error:
    F:\Data>javac -classpath
    xerces.jar;xalan.jar;classpath%; Test.java
    Test.java:22: lightParse(java.lang.String) in Test
    cannot be applied to ()
    lightParse();
    ^
    The scenario or code portion is :
    import javax.swing.*;
    import java.awt.*;
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import org.w3c.dom.Document;
    import org.w3c.dom.Node;
    import org.w3c.dom.NodeList;
    import org.xml.sax.SAXException;
    public class Test extends JFrame
    JList list;
    JScrollPane listContainer;
    public Test()
    setSize(300, 300);
    setVisible(true);
    initialize();
    lightParse(); // calling the function
    public void initialize()
    list = new JList(new DefaultListModel()); // Set the
    e initial model
    listContainer = new JScrollPane(list);
    listContainer.setSize(new Dimension(200, 200));
    getContentPane().setLayout(new BorderLayout());
    getContentPane().add(listContainer, "Center");
    validate(); // Validate the screen
    // The function is the following
    public void lightParse(String url)
    DocumentBuilder parser;
    DocumentBuilderFactory factory =
    DocumentBuilderFactory.newInstance();
    try {
    parser = factory.newDocumentBuilder();
    Document doc = parser.parse(url);
    How do I call the function correctly with the right
    parameter?
    Thanks in advance for the answer.

  • How do you call a function within a package using OCI in C

    I am trying to call a user-defined function in Oracle 8.1.7 using OCI in C. I am getting a ORA-06550 PLS-00221, <function name> is not a procedure or is undefined. Can anyone tell me how I would call a function using OCI?
    Thanks.

    I think I figured it out, but I am now getting a ORA-06512 error; numeric or value error: character string buffer too small.

  • How do i call a function within the jsp?

    Hi,
    What i am doing is now allow a user to type in comment and when the user click on "Add" button, it will call my function and write to a txt file.How can i call a custom jsp function within my jsp page or what is the correct way to do this?
    [My current codes]
    <form name="SubmitEvent" method="post" action="addComment()">
    </form>
    function addComment()
    System.out.println("Entered Add Comment function");
    Thanks for your help!

    You can define a Java Bean (I presume you know the rules to write a Java Bean) and send the read value as parameter to the Bean and then call a function in the Bean from the JSP.
    Contact me if you need more help!

  • Calling a function in child window from parent window

    Hi,
    How can I call a method in child window from parent window in adobe air using javascript. In the following example I need to call mytest() function in
    child.html from parent.html file.
    Thanks,
    ASM
    //parent.html
    <HTML><HEAD>
    <script>
    var initOptions = new air.NativeWindowInitOptions();
    initOptions.type = air.NativeWindowType.NORMAL;
    initOptions.systemChrome = air.NativeWindowSystemChrome.STANDARD;
    var bounds = new air.Rectangle(300, 300, 600, 500);
    var html2 = air.HTMLLoader.createRootWindow(false, initOptions, false, bounds);
    var urlReq2 = new air.URLRequest("child.html");
    html2.load(urlReq2);
    html2.stage.nativeWindow.activate();
    html2.window.mytest();       //NOT WORKING
    </script>
    </HEAD><body></body></HTML> 
    // child.html
    <HTML><HEAD>
    <script>
    function mytest()
      air.trace("in child window");
    </script>
    </HEAD> <body></body></HTML>

    I suspect your problem is that the child window hasn't been created by the time you call the function in the parent.Loading the content is an asynchronous processes -- AIR doesn't stop executing your code until the window has finished loading child.html. So, you will need to add an eventlistener to html2 and call the function from there:
    html2.addEventListener( "complete", onChildLoaded );
    function onChildLoaded( event )
         html2.window.mytest();

  • How can I use 3D function in Photoshop CS6 (student package)?

    Please let me know how can I use 3D function in Photoshop CS6 (student package)?
    Thanks,

    Thanks so much for your helpful reply.
    Now I' ve already installed Adobe Creative Suite 6 Production Premium (Student Package), Extended included. But when I open Photoshop CS6, there' s still no 3D function in menu bar.
    Would you please tell me how to activate this function?
    Thanks,

  • How can i call the certificate selection dialog box from source code?

    How can i call the certificate selection dialog box from source code?
    NB: Of course if i have more than one certificate in the Microsoft Keystore 'My'.
    Thank You in advance

    I found an example of the "TestStand UI Expression Control.ctl" and it works just the way I need it. (check the link)
    Proper use of "TestStand UI ExpressionEdit Control" in LabVIEW http://forums.ni.com/ni/board/message?board.id=330&requireLogin=False&thread.id=10609 
    The "Expression Browser Dialog Box Button" F(x) stays disable while editing the VI, however it become available when the VI is called from TestStand.
    Thank you,
    Hecuba
    Mfg. Test Engineer
    Certified LabVIEW Associate Developer

  • How to get safecontrol tag section to a collection from web.config in c#

    how to  get safecontrol tag section to a collection from web.config in c#
    Below is my config file. I need to read the safecontrol tagsection and get all those in to a collection.please help me on this.
    <?xml
    version="1.0"
    encoding="UTF-8"
    standalone="yes"?>
    <configuration>
    <SafeControls>
    <SafeControl
    Assembly="System.Web,
    Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
    Namespace="System.Web.UI.WebControls"
    TypeName="*"
    Safe="True"
    AllowRemoteDesigner="True"
    SafeAgainstScript="False"
    />
    <SafeControl
    Assembly="System.Web,
    Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
    Namespace="System.Web.UI.HtmlControls"
    TypeName="*"
    Safe="True"
    AllowRemoteDesigner="True"
    SafeAgainstScript="False"
    />
    </
    SafeControls>
    </configuration>
    adityadugyala

    Here is the way to read and write custom sections programtically in web.config.
    http://msdn.microsoft.com/en-us/library/2tw134k3.aspx
    Or use the traditional way of reading XML with XMLDocument.
    Bala

  • How do I removed adobe master suite 3 collection from my computer?

    How do I remove adobe master suite 3 collection from computer?

    This will help :-
    http://helpx.adobe.com/creative-suite/kb/remove-creative-suite-3-cs3.html

  • How to call C function in .m file from another function in a .mm file

    I am making an interface class between a C library and an objetive C application.
    I have not problem calling function the C library from .mm funstions,
    but I am having problems calling .m functions from the .mm class.
    here is an example of what I mean.
    here in my .m vector file
    *struct dVector*
    * float m_x;*
    * float m_y;*
    * float m_z;*
    * float m_w;*
    *struct dVector InitVector (float x, float y, float z, float w);*
    *struct dVector AddVector (struct dVector* A, struct dVector* B);*
    *struct dVector SubVector (struct dVector* A, struct dVector* B);*
    here is my .mm class
    *#import <Foundation/Foundation.h>*
    *@interface iNewton : NSObject*
    * void* m_world;*
    *-(id) init;*
    *-(void) dealloc;*
    -(void) CreateBox: (Entity*) ent: (int) shapeId;*
    @end
    here is the implemrntation of function funtion CreateBox in a .mm file
    [code]-(void*) CreateBox: (Entity*) ent: (int) shapeId
    struct dVector minBox;
    struct dVector maxBox;
    // this is fine
    [ent GetBBox: &minBox: &maxBox];
    //calculate the box size and dimensions of the physics collision shape
    // this report a link errors, and I do no knwo why
    struct dVector size = SubVector(&maxBox, &minBox);
    struct dVector origin = AddVector (&maxBox, &minBox);
    // thsi work without problemen
    return NewtonCreateBox ((NewtonWorld*) world, size.m_x, size.m_y, size.m_z, shapeId, &offset.mfront.mx);
    I get these compiler errors
    Building target “tutorial102AddingRigidBody” of project “newton_iPhone” with configuration “Debug_Emulation” — (3 errors)
    cd /Users/juliojerez/Desktop/NewtonMac/NewtonSDK/newton_iPhone
    setenv MACOSXDEPLOYMENTTARGET 10.5
    setenv PATH "/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Developer/usr /bin:/usr/bin:/bin:/usr/sbin:/sbin"
    /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/g++-4.0 -arch i386 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator2.2 .1.sdk -L/Users/juliojerez/Desktop/NewtonMac/NewtonSDK/newtoniPhone/build/DebugEmulation-iphonesimulator -L/Users/juliojerez/Desktop/NewtonMac/NewtonSDK/newton_iPhone/../sdk -F/Users/juliojerez/Desktop/NewtonMac/NewtonSDK/newtoniPhone/build/DebugEmulation-iphonesimulator -filelist /Users/juliojerez/Desktop/NewtonMac/NewtonSDK/newtoniPhone/build/Debug_Emulation-iphonesimulator/tutorial_102_AddingRigidBody.build/ Objects-normal/i386/tutorial_102AddingRigidBodies.LinkFileList -mmacosx-version-min=10.5 -framework Foundation -framework UIKit -framework OpenGLES -framework QuartzCore -framework CoreGraphics -lnewton_iPhoneEmulation -o /Users/juliojerez/Desktop/NewtonMac/NewtonSDK/newtoniPhone/build/Debug_Emulation-iphonesimulator/tutorial_102_AddingRigidBodies.app/ tutorial_102AddingRigidBodies
    Undefined symbols:
    "AddVector(dVector*, dVector*)", referenced from:
    -[iNewton CreateBox::] in iNewton.o
    "SubVector(dVector*, dVector*)", referenced from:
    -[iNewton CreateBox::] in iNewton.o
    "Scale(dVector*, float)", referenced from:
    -[iNewton CreateBox::] in iNewton.o
    ld: symbol(s) not found
    collect2: ld returned 1 exit status
    "AddVector(dVector*, dVector*)", referenced from:
    -[iNewton CreateBox::] in iNewton.o
    "SubVector(dVector*, dVector*)", referenced from:
    -[iNewton CreateBox::] in iNewton.o
    "Scale(dVector*, float)", referenced from:
    -[iNewton CreateBox::] in iNewton.o
    ld: symbol(s) not found
    collect2: ld returned 1 exit status
    Build failed (3 errors)
    Basically I can call objective C class methods from .mm files,
    but I can not call functions who are not members of a class from .mm funtions.
    Does any one knows how I can solve this?
    I have two books on objective C and neither show how to do that.
    Please I will apreciate if some one can help me with this.
    Julio Jerez

    julio jerez wrote:
    // this is fine
    [ent GetBBox: &minBox: &maxBox];
    why will tha be wrong?
    ent is a objective C class with a method GetBBox
    wich I use in hundred of places with out problem.
    Beside that is not the problem that.
    Well, you've got me on this one. You are correct. Apparently you don't need to specify the parameter names. Still, I strongly encourage you to use parameter names. Even though they apparently aren't required, I've never seen them not used. I would have expected to see:
    [ent GetBBoxMin: & minBox max: & maxBox]
    The problem is calling C function that are declared in .m files.
    if you read the errors, they are linking errors not compiler errors.
    this is a C function that is declared in a .m file
    struct dVector size = SubVector(&maxBox, &minBox);
    beside I also use those functions in many other place as well in teh project and they work.
    If it helps I can post a link to the a download place to the xcode project maybe it is eassy to see what I am trying to do.
    That would probably be a good idea.
    Normally, all you need is
    extern "C"
    but there is so much missing from what you've posted that I can't tell for sure what is going on.

  • How to get a stored function return value (which is not a cursor)?

    I want to do so with ADO inside Visual Basic. I know how to call a stored procedure, but nothing I tried could help me in calling a stored function and getting its return code. Note that the function has no cursors within its argument or return code.
    Your quick response would be appreciated
    Eyal

    Eyal,
    A stored function returns a value. You need to have the first parameter (of correct data type) for the returned value. The parameter binding is pretty much the same as you would do with stored procedures.
    e.g. "begin :1= proc(....); end;"
    Sinclair

  • How do i call these functions without an error? Python

    Hi, I'm confused on how to call these functions I'm continuously getting error can you please help me.
    I am also unsure on how parameters work and don't know what I need to write in them, i'm a bit of noob so will need you to explain thoroughly thank you
    I am trying to get a dice roll and then the player chooses which counter to move, the program will then automatically minus the movement from the counters position
    counter = ()
    postiony_red1 = 605
    postiony_red2 = 605
    def dice_roll():
        import random
        dice = random.randint(1, 4)
        print("You rolled a", dice)
        if dice == 1 :
            print("You can step forward", dice, "move")
        elif dice == 2 or dice == 3:
            print("You can move", dice, "steps forward")
        else:
            print("You can move 1 space back")
        input("Press return")
        return dice
    def move(dice):
        if dice == 1:
            move = -60
        elif dice == 2:
            move = -120
        elif dice == 3:
            move = -180
        elif dice == 4:
            move = 60
        print("move")
        return move
    def ask_player():
        while counter != ("counter 1") or ("counter 2"):
            counter = input("Do you wish to move counter 1 or counter 2?")
            return counter
    def counter_postion():
        if counter == ("counter 1"):
            move += postiony_red1
            print("total move is", move)
        elif counter == ("counter 2"):
            move += postiony_red2
            print("total move is", move)
    dice_roll()

    This forum section here is about Small Basic programing language!
    I dunno Python, but the few droplets I've heard about is that Python is very strict about global variables!
    And that every time we need to assign values to them, we gotta declare it w/
    global keyword inside each function that needs it:
    def ask_player():
    global counter
    while counter != "counter 1" or "counter 2":
    counter = input("Do you wish to move counter 1 or counter 2?")
    return counter
    Click on "Propose As Answer" if some post solves your problem or "Vote As Helpful" if some post has been useful to you! (^_^)

Maybe you are looking for