Member function and member procedure inside an object type in Oracle.

Hi All,
Please do have a look at these codes and help me understand. I have no idea about this member function and member procedure. How do they work? Please explain me about this.
Regards,
BS2012
create type foo_type as object (
  foo number,
  member procedure proc(p in number),
  member function  func(p in number) return number
create type body foo_type as
  member procedure proc(p in number) is begin
    foo := p*2;
  end proc;
  member function func(p in number) return number is begin
    return foo/p;
  end func;
end;
/

Methods are just like functions or procedures in a package, except they're not in a package, their part of an object type.
The object has attributes (which are the variables declared in it).
To use such an object you would do things like this...
SQL> set serverout on
SQL>
SQL> declare
  2    v_foo foo_type;
  3    v_val number;
  4  begin
  5    v_foo := foo_type(20); -- instantiate the object and initialize the object attributes
  6    v_foo.proc(20); -- call the object method (proc)
  7    v_val := v_foo.func(4); -- call the object method (func)
  8    dbms_output.put_line(v_val);
  9  end;
10  /
10
PL/SQL procedure successfully completed.The Type definition you've declared creates the object class, but not actually an object itself.
To actually have an object you need to declare a variable of that object class type, and then instantiate it. When you instantiate the object you need to initialize all the attributes (generally you can pass null if required for each of them to initialize them).
Once you have your object instantiated, you can call the methods within that object as demonstrated above, a bit like calling functions and procedures in a package, except they are methods within the object type itself, and therefore called directly by referencing them from the variable.
The documentation goes into a lot more detail of objects if you look it up.

Similar Messages

  • All differences between a function and a procedure.

    What are All differences between a function and a procedure.

    What are All differences between a function and a procedure.This is basic procedural programming fundamentals that you should learn at school.
    A function is a procedure that returns a value (of the type defined in the function declaration) using the RETURN statement at the terminal point of the processing code.
    That's the only difference.
    In terms of SQL, procedures cannot be used within SQL and functions can, but only if the function does not contain any OUT or IN OUT parameters and the return type is of a supported SQL type.

  • PL/SQL Object Type - Java oracle.jbo.domain

    PL/SQL Object Type <-> Java oracle.jbo.domain
    can anybody help me, getting my domains to work?
    Following scenario:
    in pl/sql we have an object type called MULTI_LANGUAGE. This type is used for storing multilingual texts as nested table in one(!) column.
    So the object MULTI_LANGUAGE contains a member variable LANGUAGE_COLLECTION of type LANGUAGE_TABLE, which itself is a nested table of objects
    of the type LANGUAGE_FIELD (this again is only a language id and the corresponding content)
    Also the methods setContent(langID, langContent) and getContent(langId) are defined on Object MULTI_LANGUAGE.
    For example: Table having primary key, 2 other columns and one column of object type MULTI_LANGAGE (=nested table of objects)
    |ID|Column1|Column2|  multilingual Column  |
    |--|---------------------------------------|
    |  |       |       |  -------------------  |
    |  |       |       | | 1 | hello         | |
    |  |       |       |  -------------------  |
    |1 | foo   | bar   | | 2 | hallo         | |   <- Row Nr 1
    |  |       |       |  -------------------  |
    |  |       |       | | 3 | ola           | |
    |  |       |       |  -------------------  |
    |--|-------|-------|-----------------------|
    |  |       |       |  -------------------  |
    |  |       |       | | 1 | world         | |
    |  |       |       |  -------------------  |
    |2 | abc   | def   | | 2 | welt          | |   <- Row Nr 2
    |  |       |       |  -------------------  |
    |  |       |       | | 3 | ???  ;-)      | |
    |  |       |       |  -------------------  |
    |--|-------|-------|-----------------------|Now i've tried to modell this structure as an oracle.jbo.domain.
    class MultiLanguage extends Struct having this StructureDef:
    attrs[(0)] = new DomainAttributeDef("LanguageColl", "LANGUAGE_COLL", 0, oracle.jbo.domain.Array.class, 2003, "ARRAY", -127, 0, false, "campusonlinepkg.common.LanguageField");
    and
    class LanguageField extends Struct having this StructureDef:
    attrs[(0)] = new DomainAttributeDef("Id", "ID", 0, oracle.jbo.domain.Number.class, 2, "NUMERIC", -127, 0, false);
    attrs[(1)] = new DomainAttributeDef("Content", "CONTENT", 1, java.lang.String.class, 12, "VARCHAR", -127, 4000, false);
    Is there anything wrong with this StructureDef?
    When running the BC-Browser with -Djbo.debugoutput=console -Djbo.jdbc.driver.verbose=true parameters I get suspect warnings when browsing the records
    [196] Executing FAULT-IN...SELECT NR, NAME FROM B_THESAURI BThesauri WHERE NR=:1
    [197] SQLException: SQLState(null) vendor code(17074)
    [198] java.sql.SQLException: Ungültiges Namensmuster: XMLTEST.null
    ...snip: detail of stack...
    [240] SQLException: SQLState(null) vendor code(17060)
    [241] java.sql.SQLException: Deskriptor konnte nicht erstellt werden: Unable to resolve type "null"
    ...snip: detail of stack...
    [280] Warning:No element type set on this array. Assuming java.lang.Object.
    (XMLTEST is the name of the schema)
    Seems as if the framework can't read the TypeDescriptor or does not know which descriptor to read (XMLTEST.null??)
    Do I have to implement my own JboTypeMap?
    Please help, I'm stuck.
    Thanks in advance, Christian

    Thanks for your suggestion, but it seems to me as if there is one level missing.
    in pl/sql I have following structure:
    Struct MULTI_LANGUAGE (Object type) - outermost
      Array LANGUAGE_TABLE (nested table type)
        Struct LANGUAGE_FIELD (Object type simple) - innermostthe reason why i had to wrap another struct around the array was because it is not possible to define methods on a nested table. this is only possible on objects.
    on the outermost object type (which holds the array of language fields) I needed to define following 2 methods for direct access:
    getContent (langId in number) returns varchar2
    setContent (langId in number, langContent in varchar2)
    I would like to rebuild the same structure in java, because newly written java code should live in perfect harmony with legacy pl/sql code ;-)
    Both applications (Java and pl/sql) have to access the same data as long as migration to java goes on.
    Is this nested structure too much for a Domain?
    Any other suggestions?
    Thanks again, Christian

  • Difference between Function and Stored Procedure

    Hi guys, i don't understand the exact difference between a function and a stored procedure. I did lot of google but still. Can somebody explain in simple words. Thanks.

    Hi,
    Here's an example of a user-defined function:
    CREATE OR REPLACE FUNCTION     factorial
    (      in_num       IN     PLS_INTEGER
    RETURN     PLS_INTEGER
    DETERMINISTIC
    IS
    BEGIN
         IF  in_num IS NULL
         THEN
              RETURN     NULL;
         ELSIF in_num <= 1
         THEN
              RETURN  1;
         ELSE
              RETURN  in_num * factorial (in_num - 1);
         END IF;
    END     factorial;
    SHOW ERRORSThis function retruns an integer. You can use the function (or, more properly, the integer that it returns) anywhere an integer expression is allowed.
    For example
    SELECT     ROWNUM
    ,     factorial (ROWNUM)     AS f
    ,     loc
    ,     SUBSTR ( loc
                , 1
                , factorial (ROWNUM)
                )          AS s
    FROM     scott.dept;Output:
    `   ROWNUM          F LOC           S
             1          1 NEW YORK      N
             2          2 DALLAS        DA
             3          6 CHICAGO       CHICAG
             4         24 BOSTON        BOSTON

  • LabVIEW MilliSecs support manager function and Tick Count block diagram object

    Is the output of the support manager function MilliSecs (used in a CIN) directly comparable with the time returned by the Tick Count (ms) block diagram object? i.e. if they have the same value then it is the 'same' time allowing for OS specific time resolution

    > Is the output of the support manager function MilliSecs (used in a
    > CIN) directly comparable with the time returned by the Tick Count (ms)
    > block diagram object? i.e. if they have the same value then it is the
    > 'same' time allowing for OS specific time resolution
    The LV diagram node is built upon the MilliSecs() function, which is
    built upon various OS specific functions. It is safe to treat them as
    though they are the same function and represent the same clock.
    Greg McKaskle

  • How To Declare an Exception As a Field Inside an Object Type

    Hi All;
    How can i declare(define as a property) an exception in a object type?
    Best Regards...
    Connected to Oracle Database 10g Enterprise Edition Release 10.2.0.1.0
    Connected as hr
    SQL>
    SQL> CREATE TYPE ex_t AS OBJECT
      2  (
      3    i NUMBER,
      4    e EXCEPTION,
      5    MEMBER FUNCTION get_i RETURN number
      6  )
      7  ;
      8  /
    Warning: Type created with compilation errors
    SQL> show err
    Errors for TYPE HR.EX_T:
    LINE/COL ERROR
    PLS-00103: Encountered the symbol "EXCEPTION" when expecting one of the following:      
    <an identifier> <a double-quoted delimited-identifier> LONG_     double ref char time timestamp interval date binary national
    character nchar  The symbol "<an identifier> was inserted before "EXCEPTION" to continue. 
    SQL>

    > 2- You could create a different class just to handle exceptions and call it from this one (again you would build a varchar2 attribute to pass the message).
    Like this one perhaps. (I've not looked at it in a couple of years though.)
    EXCEPTION is not a SQL datatype. Valid datatypes are listed here.

  • Physical service to invoke Oracle stored procedure taking an object type

    Hello,
    I have some stored procedures in Oracle that take a complex object type as parameters. Can I invoke these directly from ODSI? If so, how do I create the physical service for this?
    Example:
    CREATE OR REPLACE TYPE "CCSUSERDV"."TEST_TYPE" as object (
    name varchar2(80),
    text varchar2(1000),
    some_other number
    CREATE OR REPLACE PACKAGE CCSUSERDV.TEST
    as
    function joinText(inVal in TEST_TYPE) return varchar2;
    end;
    CREATE OR REPLACE PACKAGE BODY CCSUSERDV.TEST
    AS
    FUNCTION joinText(inVal in TEST_TYPE) return varchar2 AS
    BEGIN
    if (inVal.text is not null) then
    return inVal.name || '-' || inVal.text;
    else
    return inVal.name || ':' || inVal.some_other;
    end if;
    END;
    END;
    I Want to be able to call TEST.joinText from OSDI. I know I could create a separate function that takes all the attributes of my object, but it would be considerably more convenient to implement in terms of the object instead, because there are several functions that take the same set of about 20 fields as a request.
    Thank you!!
    Jeff

    (1) Your best bet is to create a wrapper stored procedure that takes simple arguments and constructs the object, then calls your stored procedure with the object. You call the wrapper stored procedure from ODSI. JPublisher can create wrapper stored procedures for you.
    (2) If it is impossible for you to create a wrapper stored procedure in the database, you can create a physical data service from the existing stored procedure. You will notice that the function in the physical data service will have simple arguments (not the object), and if you try to execute it, it will fail. It's up to you to write an anonymous pl/sql block that wraps the existing stored procedure (basically what you would have had to write for (1)), and edit the metadata in the physical ds - where it has the name of the stored procedure, replace the name with your anonymous PL/SQL block.
    Below is what the CREATE_BATCH stored procedure from Oracle Process Manufacturing would look like. (it also has CURSOR args - so it is uglier than just Objects). It also demonstrates that you need to do a conversion of boolean args.
    xquery version "1.0" encoding "WINDOWS-1252";
    (::pragma xds <x:xds xmlns:x="urn:annotations.ld.bea.com" targetType="t:CERTIFY_BATCH" xmlns:t="ld:JdbcTest4DataServices/opm/CERTIFY_BATCH">
    <creationDate>2007-01-14T20:55:37</creationDate>
    <relationalDB dbVersion="10" dbType="oracle" name="oracleXeDataSource"/>
    </x:xds>::)
    declare namespace f1 = "ld:JdbcTest4DataServices/opm/CERTIFY_BATCH";
    import schema namespace t1 = "ld:JdbcTest4DataServices/opm/CERTIFY_BATCH" at "ld:JdbcTest4DataServices/opm/schemas/CERTIFY_BATCH.xsd";
    (::pragma function <f:function xmlns:f="urn:annotations.ld.bea.com" kind="read" nativeName="DECLARE p_batch_header gme_batch_header%rowtype; x_batch_header gme_batch_header%rowtype; x_unallocated_material gme_api_pub.unallocated_materials_tab; TYPE rc IS REF CURSOR; PROCEDURE to_ref_cursor(x IN gme_api_pub.unallocated_materials_tab, ref_cursor IN OUT rc) IS l_data bea_unallocated_materials_tab := bea_unallocated_materials_tab(); BEGIN FOR i IN x.FIRST .. x.LAST LOOP l_data.EXTEND; l_data(i) := bea_unallocated_materials_type(x(i).batch_id, x(i).batch_no, x(i).material_detail_id, x(i).line_type, x(i).line_no, x(i).item_id, x(i).item_no, x(i).alloc_qty, x(i).unalloc_qty, x(i).alloc_uom); END LOOP; OPEN ref_cursor FOR SELECT * FROM TABLE ( CAST (l_data AS bea_unallocated_materials_tab) ); END; FUNCTION to_boolean(n IN NUMBER) RETURN BOOLEAN IS BEGIN IF (n = 0) THEN RETURN FALSE; ELSE RETURN TRUE; END IF; END to_boolean;BEGIN p_batch_header.batch_id := ?; p_batch_header.batch_no := ?; p_batch_header.plant_code := ?; p_batch_header.batch_type := ?; p_batch_header.actual_start_date := ?; p_batch_header.actual_cmplt_date := ?; gme_api_pub.certify_batch( p_api_version => ?, p_validation_level => ?, p_init_msg_list => to_boolean(?), p_commit => to_boolean(?), x_message_count => ?, x_message_list => ?, x_return_status => ?, p_del_incomplete_manual => to_boolean(?), p_ignore_shortages => to_boolean(?), p_batch_header => p_batch_header, x_batch_header => x_batch_header, x_unallocated_material => x_unallocated_material ); ? := x_batch_header.batch_id; ? := x_batch_header.batch_no; ? := x_batch_header.plant_code; ? := x_batch_header.batch_type; ? := x_batch_header.actual_start_date; ? := x_batch_header.actual_cmplt_date; ? := x_batch_header.plan_start_date; ? := x_batch_header.plan_cmplt_date; ? := x_batch_header.due_date; ? := x_batch_header.recipe_validity_rule_id; ? := x_batch_header.wip_whse_code; to_ref_cursor(x_unallocated_material, ?);END;" nativeLevel2Container="" nativeLevel3Container="" style="storedProcedure">
    <params xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xdt="http://www.w3.org/2004/07/xpath-datatypes" xmlns:pn1="ld:JdbcTest4DataServices/opm/CERTIFY_BATCH" >
    <param name="BATCH_ID" kind="in" xqueryType="xs:string" nativeTypeCode="12" nativeType="VARCHAR2"/>
    <param name="BATCH_NO" kind="in" xqueryType="xs:decimal" nativeTypeCode="3" nativeType="NUMBER"/>
    <param name="PLANT_CODE" kind="in" xqueryType="xs:string" nativeTypeCode="12" nativeType="VARCHAR2"/>
    <param name="BATCH_TYPE" kind="in" xqueryType="xs:decimal" nativeTypeCode="3" nativeType="NUMBER"/>
    <param name="ACTUAL_START_DATE" kind="in" xqueryType="xs:dateTime" nativeTypeCode="93" nativeType="DATE"/>
    <param name="ACTUAL_CMPLT_DATE" kind="in" xqueryType="xs:dateTime" nativeTypeCode="93" nativeType="DATE"/>
    <param name="P_API_VERSION" kind="in" xqueryType="xs:decimal" nativeTypeCode="3" nativeType="NUMBER"/>
    <param name="P_VALIDATION_LEVEL" kind="in" xqueryType="xs:decimal" nativeTypeCode="3" nativeType="NUMBER"/>
    <param name="P_INIT_MSG_LIST" kind="in" xqueryType="xs:integer" nativeTypeCode="3" nativeType="NUMBER"/>
    <param name="P_COMMIT" kind="in" xqueryType="xs:integer" nativeTypeCode="3" nativeType="NUMBER"/>
    <param name="X_MESSAGE_COUNT" kind="out" xqueryType="xs:decimal" nativeTypeCode="3" nativeType="NUMBER"/>
    <param name="X_MESSAGE_LIST" kind="out" xqueryType="xs:string" nativeTypeCode="12" nativeType="VARCHAR2"/>
    <param name="X_RETURN_STATUS" kind="out" xqueryType="xs:string" nativeTypeCode="12" nativeType="VARCHAR2"/>
    <param name="P_DEL_INCOMPLETE_MANUAL" kind="in" xqueryType="xs:integer" nativeTypeCode="3" nativeType="NUMBER"/>
    <param name="P_IGNORE_SHORTAGES" kind="in" xqueryType="xs:integer" nativeTypeCode="3" nativeType="NUMBER"/>
    <param name="BATCH_ID" kind="out" xqueryType="xs:string" nativeTypeCode="12" nativeType="VARCHAR2"/>
    <param name="BATCH_NO" kind="out" xqueryType="xs:decimal" nativeTypeCode="3" nativeType="NUMBER"/>
    <param name="PLANT_CODE" kind="out" xqueryType="xs:string" nativeTypeCode="12" nativeType="VARCHAR2"/>
    <param name="BATCH_TYPE" kind="out" xqueryType="xs:decimal" nativeTypeCode="3" nativeType="NUMBER"/>
    <param name="ACTUAL_START_DATE" kind="out" xqueryType="xs:dateTime" nativeTypeCode="93" nativeType="DATE"/>
    <param name="ACTUAL_CMPLT_DATE" kind="out" xqueryType="xs:dateTime" nativeTypeCode="93" nativeType="DATE"/>
    <param name="PLAN_START_DATE" kind="out" xqueryType="xs:dateTime" nativeTypeCode="93" nativeType="DATE"/>
    <param name="PLAN_CMPLT_DATE" kind="out" xqueryType="xs:dateTime" nativeTypeCode="93" nativeType="DATE"/>
    <param name="DUE_DATE" kind="out" xqueryType="xs:dateTime" nativeTypeCode="93" nativeType="DATE"/>
    <param name="RECIPE_VALIDITY_RULE_ID" kind="out" xqueryType="xs:string" nativeTypeCode="12" nativeType="VARCHAR2"/>
    <param name="WIP_WHSE_CODE" kind="out" xqueryType="xs:string" nativeTypeCode="12" nativeType="VARCHAR2"/>
    <param name="X_UNALLOCATED_MATERIAL" kind="out" xqueryType="pn1:X_UNALLOCATED_MATERIAL_ROW" nativeTypeCode="-10" nativeType="REF CURSOR"/>
    </params>
    </f:function>::)
    declare function f1:CERTIFY_BATCH($p_batch_header_batch_id as xsd:string, $p_batch_header_batch_no as xsd:decimal, $p_batch_header_plant_code as xsd:string, $p_batch_header_batch_type as xsd:decimal, $p_batch_header_actual_start_date as xsd:dateTime, $p_batch_header_actual_cmplt_date as xsd:dateTime, $p_api_version as xsd:decimal, $p_validation_level as xsd:decimal, $p_init_msg_list as xsd:integer, $p_commit as xsd:integer, $p_del_incomplete_manual as xsd:integer, $p_ignore_shortages as xsd:integer) as schema-element(t1:CERTIFY_BATCH) external;

  • Where are User Defined Functions and Stored Procedures kept in SQL Server?

    Hi,
    I have a growing list of Stored Procedures and User-Defined Functions in SQL Server, and would like to be able to list all my user SP and UDF easily.
    Is it possible to write a query to list all SP and UDF?
    I saw the following specimen code in an SQL book, but am not sure this is what I need because I could not make it work.
    SELECT *
        FROM INFORMATION_SCHEMA.ROUTINES
    WHERE SPECIFIC_SCHEMA = N'CustomerDetails'
        AND SPECIFIC_NAME = N'apf_CusBalances'
    I tried:
    SELECT *
        FROM INFORMATION_SCHEMA.ROUTINES
    but it does not work.
    Suppose all my SP are named following this pattern:
        dbo.usp_Storeproc1
    How would I modify the above code? or is there a better code?
    Thanks
    Leon Lai

    Hi ,
    try this to get list of all stored procedures:
    SELECT *
    FROM sys.procedures where name like 'dbo.usp%'
    Thanks,
    Neetu

  • How to handle the procedure that reutrn object types as out parameter

    I have a procedure where it returns object(CREATE OR REPLACE TYPE xyz AS OBJECT) as a OUT parameter.
    Now i have to pull the data from this type and need to send the data in excel.
    Procedure will fetch data and assign it to object with lot of validations and local parameters variables..
    How can i push the data from the out parameter and need to send that in excel..Its an oracle database 10g..

    here's a basic example...
    SQL> set serveroutput on;
    SQL> create or replace type t_obj as object (x number, y number);
      2  /
    Type created.
    SQL> ed
    Wrote file afiedt.buf
      1  create or replace package mypkg as
      2    procedure testit(p_obj out t_obj);
      3    procedure callme;
      4* end;
      5  /
    Package created.
    SQL> ed
    Wrote file afiedt.buf
      1  create or replace package body mypkg as
      2    procedure testit(p_obj out t_obj) is
      3    begin
      4      p_obj := t_obj(1,2);
      5    end;
      6    procedure callme is
      7      v_obj t_obj;
      8    begin
      9      testit(v_obj);
    10      dbms_output.put_line('X='||v_obj.x||' Y='||v_obj.y);
    11    end;
    12* end;
    SQL> /
    Package body created.
    SQL> exec mypkg.callme;
    X=1 Y=2
    PL/SQL procedure successfully completed.
    SQL>

  • Passing parameter of object type between Oracle & VB

    Hello,
    I want to pass parameters of ref cursor type variable between oracle 8i routines and Vb routines. It will be very helpfull for me if you can help in telling me about how to do it.
    Regards
    Rakesh Banerjee

    1. On the Oracle side, you may need to do the following:-
    (a) define a ref cursor of the desired type in a package specification
    (b) define a procedure that returns the ref cursor type as an out parameter, or alternately a function that returns the ref cursor type as a return value.
    (c) associate a select statement in the definition of the procedure or function using the synrtax OPEN ref_cursor_name FOR "select XYZ from abc"
    (d) compile and debug the package
    2. On the VB side one can:-
    (a) call the stored procedure or function using the ODBC call syntax for calling stored procedures
    (b) bind the output parameter or return value to a resultset variable in VB.
    3. The critical step would be using an ODBC driver that supports this syntax and functionality. If the driver available at your site does not work you may need to buy a third party driver that does.
    Hope that helps ...
    Regards,
    Narayan.

  • Running SQL Server Function and Procedures from Oracle

    I am trying to run SQL Server 2005 functions and/or procedures from a SQL statement in Oracle. I have gone throught the hetergeneous services and have connected to the SQL Server database successfully. I can also do a query to a table in SQL Server successfully; but I have not been able to execute a procedure or a function.

    Have you tried Oracle syntax? It seems to me that you have only tried T-SQL syntax, e.g. execute proc.
    Wrap it in a begin..end tag like you would a normal PL/SQL function or proc call. Assumption is that as Oracle makes the remote database (via the dblink) look like an Oracle database, you should also play along and pretend it is one and treat it as such.
    E.g.declare
      r integer;
    begin
      -- execute remote proc
      procFoo@dblink( 'ABC' );
      -- call a remote function
      r := funcFoo@dblink( 123 );
    end;

  • Member /static function and procedure

    hi guys,
    i'm trying to figure out diffrerences between the following;
    1. member function and static function
    2.*member* procdure and static procedure.
    i wanna know when to use them when creating an object type.thanks.

    hope this enlighten you
    http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14261/objects.htm#CHDEFBEA

  • Cannot call member function on object type

    On 8.1.6 I cannot call a member function from SQL in the way described in the manual.
    The following example is almost copied from the manual:
    create or replace TYPE foo AS OBJECT (a1 NUMBER,
    MEMBER FUNCTION getbar RETURN NUMBER);
    create or replace type body foo is
    MEMBER FUNCTION getbar RETURN NUMBER is
    begin
    return 45;
    end;
    end;
    CREATE TABLE footab(col foo);
    SELECT col,foo.getbar(col) FROM footab; -- OK
    select col,col.getbar() from footab; -- ERROR
    The second select is the way it should be, but I get an error "invalid column name".
    Using the first select, I get the result. This is strange because this is more or less the 'static member' notation (filling in the implicit self parameter myself).
    Is this a known bug in 8.1.6, maybe fixed in later versions?

    Konstantin,
    Did you use loadjava to load the compiled class into the Oracle Database?
    Regards,
    Geoff
    Hello!
    I need to write a member function for object type with java.
    for example:
    create type test as object(
    id number,
    name varchar2(20),
    member function hallo return number);
    create type body test as
    member function hallo return number
    as language java
    name 'test.hallo() return int;
    create table test of test;
    My java-file is:
    public class test {
    public int hallo() {
    return 5;
    select t.hallo() from test t;
    It's does not run. Why?
    I get always an error back. Wrong types or numbers of parameters!!
    please help me.
    thanks in advance
    Konstantin

  • Not able to access the result set from one member function to another

    Im new to jdbc
    I have declared a connection object , a result set object and statement object in one member function and i am not able to access these in another member function. But both are in the same class
    Kindly help
    Thanks
    Shasi

    Kindly refrain from double-posting:
    http://forum.java.sun.com/thread.jspa?threadID=700659&tstart=0
    - Saish

  • Pass C++ Class Member Function as a callable function in AIR Native Extension

    I'm writing an ANE and I'd like to know if anyone has been able to pass a C++ class member function pointer as a callable function from AIR? I have tried this so far with a little bit of C++11 trickery and it's crashing. I've also statically linked the libstdc++ into my library, according to the documentation, in order to ensure that these features I use work correctly. I have code like so:
    FakeWorld* world = new FakeWorld();
    *numFunctions = 1;
    memberFunctions = (FRENamedFunction*) malloc(sizeof(FRENamedFunction) * (*numFunctions));
    ANEMemberFunction mCreateFakeBody = std::tr1::bind(&FakeWorld::createFakeBody, world, std::tr1::placeholders::_1, std::tr1::placeholders::_2, std::tr1::placeholders::_3, std::tr1::placeholders::_4);
    ANEFunction* createFakeBody = mCreateFakeBody.target<ANEFunction>();
    memberFunctions[0].name = (const uint8_t*) "createFakeBody";
    memberFunctions[0].functionData = NULL;
    memberFunctions[0].function = createFakeBody;
    FRESetContextNativeData(ctx, (void*)world);
    I just realized I'm using C here for allocating the member functions array.. silly me, but I don't think this is the cause of my issue. I refuse to believe that Adobe has built to the Native Extensions portion of the runtime in such a way that I have to cram every single function I want to create (natively) into a global, C formatted namespace (Especially since the documentation says that C is only required for the extenion and context initializing function interfacing and the rest of the code can be done in C++ or objective-C). So please let me know if and how this is possible and I thank you so much in advance for your time!P.
    P.S. Currently when I run this code, I can do the object initialization just fine. As soon as I invoke the "createFakeBody" method on the native side, the runtime dies and simply says:
    Problem signature:
      Problem Event Name: BEX
      Application Name: adl.exe
      Application Version: 3.1.0.4880
      Application Timestamp: 4eb7612e
      Fault Module Name: StackHash_0a9e
      Fault Module Version: 0.0.0.0
      Fault Module Timestamp: 00000000
      Exception Offset: 00000000
      Exception Code: c0000005
      Exception Data: 00000008
      OS Version: 6.1.7601.2.1.0.256.48
      Locale ID: 1033
      Additional Information 1: 0a9e
      Additional Information 2: 0a9e372d3b4ad19135b953a78882e789
      Additional Information 3: 0a9e
      Additional Information 4: 0a9e372d3b4ad19135b953a78882e789
    Read our privacy statement online:
      http://go.microsoft.com/fwlink/?linkid=104288&clcid=0x0409
    If the online privacy statement is not available, please read our privacy statement offline:
      C:\Windows\system32\en-US\erofflps.txt
    Thanks again for your assitance.

    It's been a little while since i've dealt with C++ and not up to speed on tr1 or C++0x, so forgive me if i'm not helping.
    The the examples of std::tr1::bind that i'm seeing out there seem to be either dereferencing the bound 'this' pointer when creating the bound method, i.e. in your case *world instead of world, or using std::tr1::ref(*world), therefore i believe that bind expects the bound parameters to be passed by reference.
    Given that the result of std::tr1::bind is callable (basing that on http://stackoverflow.com/questions/3678884/virtual-member-functions-and-stdtr1function-how -does-this-work) could you simplify to the following:
    memberFunctions[0].name = (const uint8_t*) "createFakeBody";
    memberFunctions[0].functionData = NULL;
    memberFunctions[0].function = std::tr1::bind(&FakeWorld::createFakeBody, *world, std::tr1::placeholders::_1, std::tr1::placeholders::_2, std::tr1::placeholders::_3, std::tr1::placeholders::_4);
    Or for an even simpler starting point, creating a test member function 'helloWorld' in FakeWorld that takes no arguments and using:
    memberFunctions[0].name = (const uint8_t*) "helloWorld";
    memberFunctions[0].functionData = NULL;
    memberFunctions[0].function = std::tr1::bind(&FakeWorld::helloWorld, *world);
    Hope this helps.

Maybe you are looking for

  • Pages 5.1 Text box problems

    In Pages 5.1 when I paste a graphic in a text box (e.g., a PNG file), it no longer stays in the text box.  This was a great feature in Pages '09, the ability to paste a graphic into the text box, add figure legend text, and a line around the whole th

  • IPod shuffle= no pref. to stop auto update/sync with itunes 7

    If you have an ipod shuffle and you plug it in to your laptop, with your itunes library located on an external drive, itunes 7 will automatically sync the shuffle with itunes 7 and if the ext. drive is disconnected, subsequently erase all songs on th

  • What is the role of Success factors in the current market

    Hi Gurus, I'm new to SAP domain. I just want to understand how Success factors can change the usability and other factors of traditional SAP R/3? What are few of the points that we have to keep in mind when we are integrating our product with Success

  • I am not able to install itunes in my  windows XP computer because it does not have service pack 3. what can I do?

    Dear friends, I want to transfer files between my windows XP computer and my Ipad4. I am not able to install itunes on my computer because it does not have service pack 3. What can be done? Please help?

  • What shall I do? Is my ipod broken?

    Okey, so I took my ipod with me to a foam party and I dropped it in the foam, luckily I found it and it was working. After that I got pushed into the foam. At the end of the night my ipod screen was black, I have tried charging it and nothing happens