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.

Similar Messages

  • Need Help: Using Ref Cursor in ProC to call a function within a Package

    I'm calling a function within a package that is returning a REF CURSOR.
    As per the Oracle Pro*C Programmer's Guide, I did the following:
    1) declared my cursor with a: EXEC SQL BEGIN DECLARE SECTION and declared the cursor as: SQL_CURSOR my_cursor;
    2) I allocated the cursor as: EXEC SQL ALLOCATE :my_cursor;
    3) Via a EXEC SQL.....END-EXEC begin block
    I called the package function and assign the return value to my cursor
    e.g. my_cursor := package.function(:host1, :host2);
    Now, the only difference between my code and the example given in the Pro*C Programmer's Guide is that the example calls a PROCEDURE within a package that passes back the REF CURSOR as an OUT host variable.
    Whereas, since I am calling a function, the function ASSIGNS the return REF CURSOR in the return value.
    If I say my_cursor := package.function(:host1, :host2); I get a message stating, "PLS-00201: identifier MY_CURSOR" must be declared"
    If I say :my_cursor := package.function(:host1, :host2); I get a message stating, "ORA-01480: trailing null missing from STR bind value"
    I just want to call a package function and assign the return value to a REF CURSOR variable. There must be a way of doing this. I can do this easily in standard PL/SQL. How can this be done in Pro*C ???
    Thanks for any help.

    Folks, I figured it out. For those who may face this problem in the future you may want to take note for future reference.
    Oracle does not allow you to assign the return value of a REF CURSOR from a FUNCTION ( not Procedure - - there is a difference) directly to a host variable. This is the case even if that host variable is declared a CURSOR variable.
    The trick is as follows: Declare the REF CURSOR within the PL/SQL BEGIN Block, using the TYPE statement, that will contain the call to the package function. On the call, you then assign the return REF CURSOR value that the function is returning to your REF CURSOR variable declared in the DECLARE section of the EXEC SQL .... END-EXEC PL/SQL Block.
    THEN, assign the REF CURSOR variable that was populated from the function call to your HOST cursor varaible. Then fetch this HOST Cursor variable into your Host record structure variable. Then you can deference individual fields as need be within your C or C++ code.
    I hope this will help someone facing a deadline crunch. Happy computing !

  • 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 do I view a FUNCTION within a Package Body

    I can see the FUNCTION being executed within the Package...
    FUNCTION Stop_Refresh_AsBilled
    RETURN Number;
    And within Oracle SQL Developer and using the Connection and "Packages" part of the Schema, I see the Function Name. However, when I <Double-Click> on the FUNCTION Name within the Schema, it is taking me to where the FUNCTION is executed within the Package and NOT to the PL/SQL Code that actually makes up the FUNCTION.
    Am I missing something here??? Maybe in my Preferences??? How can I drill down further to actually find the FUNCTION Definition and PL/SQL Code that makes up the FUNCTION within the Package Body???
    I can bring up the Package Body and Search on the FUNCTION that way. I'm hoping there is an easier way however to drill down to the actual PL/SQL Code that makes up the FUNCTION.
    I hope I am being clear in my explanation here.
    Thanks for your review and I am hopeful for a reply.
    PSULionRP

    Jim, opening the body node to see all functions and procedures sometimes does not work in 3.0
    I have many packages generated by Feuerstien's CodeGen utility. The Query package appears just fine with every function and procedure appearing as expected in both header and body nodes. However, the Change Package fails miserably. Header shows all functions and procedures fine, but the body node only shows the top private declarations of variables and types. Not one function or procedure appears in the expanded node.
    The only thing I can figure is that the Change package of about 30 named items has many of the same name+ with overloaded parameters. I think SQL Dev is having problems parsing the names in the body even though it does fine with the names in the header of the package--perhaps because of many private variables and PRAGMA's declared at the top of the body.
    Both packages have about 30 functions, but the Change package body has over 2000 lines while the Query package has fewer than 500.
    Just adding to the mystery--but I think it merits a bug report (gotta figure out where to report it now).

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

  • How do you call a function module in a web dynpro application ?

    Why do you delete my postings ?????????????????????????????
    pls see subject
    Edited by: Ilhan Ertas on Apr 1, 2009 4:51 PM
    Edited by: Ilhan Ertas on Apr 1, 2009 4:52 PM

    Its not me deleting them.  Perhaps a different moderator or a technical problem within SCN itself.
    Someone might be concerned about your question because it is very basic.
    You can call a function module from WD the same way you did in any ABAP program - with the CALL FUNCTION syntax.  There is a service call wizard that will generate a matching context and calling code for you - but it is just a helper, code generator.  Everything it does can be done by hand as well (and often better than the generator).

  • 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                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • I can access a function in a package using OCI drivers but not PDO drivers

    Hello all, i am a newbie to Oracle and its drivers for PHP. I would like to use PDO, and I have my database activity in packages, which have procedures and functions. My package has overloaded functions and that has been giving me a tough time with these drivers. So one signature of my function get_data contains a four arguments and all four are numbers, while another signature of get_data has the first two as numbers and the next two as varchar2. So when I try to access this function which is part of a package, I am able to retrieve data, and the driver I am using is OCI8, but when I try to do the same with PDO, it does not work. It gives me this error,
    *General error: 6553 OCIStmtExecute: ORA-06553: PLS-307: too many declarations of 'GET_DATA' match this call  (/var/www/php-5.3.3/ext/pdo_oci/oci_statement.c:146)' in /var/www/pdo_check.php:251 Stack trace: #0 /var/www/pdo_check.php(251): PDOStatement->execute() #1 /var/www/pdo_check.php(345): dbPDO->execPackage2() #2 {main} thrown in /var/www/pdo_check.php on line 251 *
    I got this error earlier with OCI drivers, then I added the datatype while binding the values.
    Has anybody had this headache earlier??
    ##Works
    *$qu = oci_parse($connect, 'select pack.get_data(:p1,:p2,:p3,:p4)as rc from dual');
    $p1 = (int)121;
    $p2 = (int)222;
    $p3 = (int)324;
    $p4 = (int)001;
    oci_bind_by_name($qu,":p1",$p1,10,OCI_B_INT);
    oci_bind_by_name($qu,":p2",$p2,10,OCI_B_INT);
    oci_bind_by_name($qu,":p3",$p3,10,OCI_B_INT);
    oci_bind_by_name($qu,":p4",$p4,10,OCI_B_INT);
    oci_execute($qu) or die("did not execute");
    $r = oci_fetch_array($qu);*
    ##Does not work
    *$sql = 'select pack.get_data(:p1,:p2,:p3,:p4) from dual';
    $result = $this->dbConnect->prepare($sql);
    $p1 = (int)2;
    $p2 = (int)2;
    $p3 = (int)2;
    $p4 = (int)6;
    $result->bindParam(':p1', $p1, PDO::PARAM_INT);
    $result->bindParam(':p2', $p2, PDO::PARAM_INT);
    $result->bindParam(':p3', $p3, PDO::PARAM_INT);
    $result->bindParam(':p4', $p4, PDO::PARAM_INT);
    $result->execute();*
    I am still perplexed why is PDO giving me an error, when I have virtually mentioned everything is asks for?

    I think the only person who can really answer this question is Chris Jones. For my money I tend to steer clear of PDO as it is a bit quirky ( at least in my experience ) and it does not support reference cursors.

  • How to Call C functions within Flash?

    I have a bunch of functions written in C++. I would like to
    be able to call these functions within my flash application so that
    I can pass data to the functions and get the returned values. Is
    this possible with Flash 8?
    If this is not possible then is there a way that I can have
    Flash share memory space with another stand-alone application? This
    way, a C++ program could read and write data to the shared memory
    and Flash could also read and write to it.

    you can write a dll and then call mmexecute in the flash IDE,
    but I
    think in the player it is not possible.
    mProjector on windows will let you write c plugins that you
    can call from Flash
    http://www.screentime.com/software/mprojector/plugins.html
    give it a look - it might do what you need...
    On 2006-05-04 15:50:24 -0400, "mmakrzem"
    <[email protected]> said:
    > I have a bunch of functions written in C++. I would like
    to be able to
    > call these functions within my flash application so that
    I can pass
    > data to the functions and get the returned values. Is
    this possible
    > with Flash 8?
    >
    > If this is not possible then is there a way that I can
    have Flash
    > share memory space with another stand-alone application?
    This way, a
    > C++ program could read and write data to the shared
    memory and Flash
    > could also read and write to it.
    John Pattenden
    Screentime Media
    Flash Screen Saver, Application and Wallpaper tools
    http://www.screentime.com

  • Can we call a function within a function??????Urgent

    Dear All,
    Like we can call a procedure from another procedure , in the same way can we call a function within a function. Please reply it's urgent.
    Regards

    > Please reply it's urgent.
    My usual soapbox response.
    Saying your posting is urgent is rude and arrogant. Why? Because you are saying that other people who have posted problems here, have less important problems than yours. That despite how complex and critical their problem may be, yours take priority.
    You're also demaning attention and a quick answer from people that provide support here - in their free time... and not getting paid a single cent for their efforts.
    So just how can you demand any urgency to your posting from them?
    Remember that this is a public forum. You cannot demand anything here. This is not Oracle Support. There are no SLA's here. Basic nettiquette applies.

  • Call a functions within a function ?

    Hi
    Is there anyway to call my functions within a function ?
    function musicPlayer() {
         trace("Music");
         function pauseMusic(){
              trace("Pause");
    if i call musicPlayer function i will get Music in output now how can i call pauseMusic from outside of parent function !?
    is this possible ?
    thanks in advance

    You can call functions within other functions, but you don't want define functions inside other functions... they will only have scope within the function if they work at all.
    function pauseMusic(){
         trace("Pause");
    function musicPlayer() {
         trace("Music");
         pauseMusic();
    musicPlayer();

  • EL - How do you call a method that requires a parameter

    How do you call a method that requires a parameter
    In scriplet code here is what I am trying to do
    <%= car.getDefaultColor(car.getCarType()) %>
    How do I do this in EL
    Here is my guess (it generates the Exception described below)
    ${car.defaultColor(car.carType)}
    Here is the Exception I am getting:
    javax.servlet.ServletException: <h3>Validation error messages from tag library c</h3>tag = 'out' / attribute = 'value': An error occurred while parsing custom action attribute "value" with value "${car.defaultColor(car.carType)}": Encountered "(", expected one of ["}", ".", ">", "gt", "<", "lt", "==", "eq", "<=", "le", ">=", "ge", "!=", "ne", "[", "+", "-", "*", "/", "div", "%", "mod", "and", "&&", "or", "||"]
    Any Ideas?
    P.S. If it matters to you, I am using JSTL 1.0 and the code snippets above are actually within the value attribute of a <c:out value="" /> statement.

    How do you call a method that requires a parameter
    In scriplet code here is what I am trying to do
    <%= car.getDefaultColor(car.getCarType()) %>
    How do I do this in ELYou don't. EL is very strict in method signatures. All get methods must be public Type getProperty(void); And all set methods must be public void setProperty(Type t);
    So you will have to re-work your Bean so it does not need an argument to the get method (getDefaultColor()). Since you are calling another method out of car, you might re-write the getDefaultColor method as such:
      public Object getDefaultColor() {
        CarType ct = this.getCarType();
        //then do other stuff
      }If that isn't suitable, then provide a helper method that is used to set the current car type and then call the getDefaultColor:
      private CarType curCarType;
      public void setCurrentCarType(CarType ct) { curCarType = ct; }
      public Object getDefaultColor() {
        if (curCarType == null) throw new IllegalStateException("CarType must be set before getting color");
        //normal work using curCarType
    <c:set target="${car}" property="currentCarType" value="${car.carType}"/>
    <c:out value="${car.defaultColor}"/>It is better to do as little of the data manipulation (setting up the car type) in the JSP as possible, so the first option is better than the second. Also better then the second would be to set the current car type in a servlet or data access object (or wherever) from which your retreive the car to begin with. Manipulatig it in the JSP itself should be your last resort (to keep as much business logic out of the JSP as possible).
    Here is my guess (it generates the Exception
    described below)
    ${car.defaultColor(car.carType)}
    Here is the Exception I am getting:
    javax.servlet.ServletException: <h3>Validation error
    messages from tag library c</h3>tag = 'out' /
    attribute = 'value': An error occurred while parsing
    custom action attribute "value" with value
    "${car.defaultColor(car.carType)}": Encountered "(",
    expected one of ["}", ".", ">", "gt", "<", "lt",
    "==", "eq", "<=", "le", ">=", "ge", "!=", "ne", "[",
    "+", "-", "*", "/", "div", "%", "mod", "and", "&&",
    "or", "||"]
    Any Ideas?
    P.S. If it matters to you, I am using JSTL 1.0 and
    the code snippets above are actually within the value
    attribute of a <c:out value="" /> statement.

  • How do you call 0900 numbers on iphone?

    how do you call 0900 numbers on iphone? it keeps saying that i cant call it- is there a code or anything?
    im on vodafone
    thanks

    thanks for the advice both
    ive noticed though that sometimes companies provide a cheaper alternative to an 0900 number as in 8***** or something - if this makes any sense? but even those numbers are still blocked???

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

Maybe you are looking for

  • Incomplete Data on report (report does not show all records from the table)

    Hello, I have problem with CR XI, I'm running the same report on the same data with simple select all records from the table (no sorting, no grouping, no filters) Sometimes report shows me all records sometimes not. Mostly not all records on the repo

  • Web Part Error From build-in "Contacts" App

    My SP 2013 Foundations has been functioning normally for the past few months until this week. I added the built-in "Contacts" app back when the site was built. This week for some reason when I go to click "Add", I receive the following error: "Web Pa

  • Why I can't subtract two images in imaq vision builder?

    Hi, I have many times tried but failed to get the objects in a image by subtraction with another image which is background, in imaq vision builder(ver. 6.0). I totally can't use the "operators" command under "greyscale" to subtract the two images bec

  • Acrobat 10.1.4 Update Causes Excel Convert to PDF Fail

    The Acrobat feature which allows a "convert to pdf" option in Excel 2010 (Windows 7) fails to execute properly after the update to 10.1.4.  It chops up a single page width into multiple pages.  I would have been trying to scan tomorrow but have read

  • Need help on FI/CO config

    Hi, Is anyone working with energy company...if so pleeeease let me know the procedures for configuring FI/CO module. Thanks van1276