a return type? : expression

Hi all

Could someone tell me what kind of a statement of the operator? : with the second and third operand of different types is? I have attached some code below to help you better understand my question. The code below has not responded to my question though.
public class Main {

    public static void main(String[] args) {
        int i = 1;
        double d = 3.3;
        String s = "hello, world.";
        int x = 10;

        method(x > 5 ? i : d);

        x = 3;
        method(x > 5 ? i : d);

        //method(x > 5 ? i : s);  //compilation error
        System.out.print("printing from System.out: ");
        System.out.println(x > 5 ? i : s);


    }

    private static void method(Integer i) {
        System.out.println("in method(int i), i is: " + i);
    }

    private static void method(Double d) {
        System.out.println("in method(double d), d is: " + d);
    }

    private static void method(String s) {
        System.out.println("method(String s), s is: " + s);
    }
}
The program output is:
in the method (double d), d is: 1.0
in the method (double d), d is: 3.3
printing from System.out: hello, world.

http://Java.Sun.com/docs/books/JLS/third_edition/HTML/expressions.html#15.25 says:

The type of a conditional expression is determined as follows:

* If the second and third operands have the same type (which can be the type null), then this is the type of the conditional expression.
* If one of the operands of the second and the third is of boolean type and the other type is Boolean type, then the type of the conditional expression is Boolean.
* If one of the second and third operands is null and the other type is a reference type, then the type of the conditional expression is this kind of reference.
* Otherwise, if the second and third operands are types that are convertible (§5.1.8) for numeric types, there are several cases:
o If one of the operands is of type byte or byte and the other is of type short or brief, and then the type of the conditional expression is short.
o If either of the operands is of type T, where T is byte, short, or char and the other operand is an expression of type int with the value constant is representable in the type T, the type of the conditional expression is T.
o If either operand is of type Byte, and the other operand is an expression of constant of type int whose value is representable in the type byte, then the type of the conditional expression is byte.
o If one of the operands is of type short and the other operand is an expression of type int constant whose value is representable in the short type, then the type of the conditional expression is short.
o If one of the operands is of type; Character and the other operand is an expression of type int constant whose value is representable in the tank of type, then the type of the conditional expression is char.
o otherwise, promotion digital binary (§5.6.2) is applied to the operand types and the type of the conditional expression is the promoted type of the second and third operands. Note that binary digital promotion place (§5.1.8) unboxing conversion and the conversion value (§5.1.13).
* In the case, the second and third operands are of types S1 and S2, respectively. The type that results from the application of boxing to S1 T1 conversion and the type that results from the application of boxing to S2 T2 conversion. The type of the conditional expression is the result of the capture application conversion (§5.1.10) lub (T1, T2) (§15.12.2.7).

So binary digital promotion is applied, I have either encouraged to double, and the value of the expression is of type double.

Tags: Java

Similar Questions

  • Property Finder have table as return type

    Hi all

    Is it possible to return the finders of vco table types?

    If I give the property name in the property-bean attribute then it gives [Ljava.lang.String;@4981086 as value (as expected).

    < bean-PROPERTY = display name "testProp" = "Property of Test" hidden = "false" name = "testProp" show in the column = see "real" description = "true" / >

    But is it possible to specify bean-property attribute of tag finder so that we can wrap up the property value according to a static utility method. Maybe something like below (I know that the threshold is not correct, but it's just a wild guess)

    < bean-property = "StringUtils.joinArray (testProp) property' display name ="Test well"hidden ="false"name ="testProp"show in the column = see"real"description ="true"/ >"

    Or any other means by which I can manage property array return types.

    Thank you for your help.

    Best regards

    Sumit Tyagi.

    Hi Sergio,

    Get it now, we can specify any OGNL expression in property accessor of property tag attribute. Read a little on the OGNL expressions and had it work.

    The below xml tag property works for me now.


    Best regards

    Sumit Tyagi

  • Binding type variable of function return type?

    Hi, is it possible to bind a type variable to a function return type, so that changes in type of variable according to the function return type definition?
    Something like what is happening with TYPE and % ROWTYPE.

    Thank you

    Veverke wrote:
    Hi, is it possible to bind a type variable to a function return type, so that changes in type of variable according to the function return type definition?

    Well, not directly. However, if the function returns SQL declared of type you could:

    1. create a dummy cursor that selects the function of double
    2. create a dummy record variable dummy cursor %
    3. create your variable or dummy record attribute type:

    SQL> desc f1
    FUNCTION f1 RETURNS VARCHAR2
     Argument Name                  Type                    In/Out Default?
     ------------------------------ ----------------------- ------ --------
     P_NUM                          NUMBER                  IN
    
    SQL> declare
      2      desired_variable f1%type;
      3  begin
      4      desired_variable := 1;
      5  end;
      6  /
        desired_variable f1%type;
                         *
    ERROR at line 2:
    ORA-06550: line 2, column 22:
    PLS-00206: %TYPE must be applied to a variable, column, field or attribute, not to "F1"
    ORA-06550: line 2, column 22:
    PL/SQL: Item ignored
    ORA-06550: line 4, column 5:
    PLS-00320: the declaration of the type of this expression is incomplete or malformed
    ORA-06550: line 4, column 5:
    PL/SQL: Statement ignored
    
    SQL> declare
      2      cursor dummy_cursor is select f1(1) f1 from dual;
      3      dummy_record dummy_cursor%rowtype;
      4      desired_variable dummy_record.f1%type;
      5  begin
      6      desired_variable := 1;
      7  end;
      8  /
    
    PL/SQL procedure successfully completed.
    
    SQL>  
    

    SY.

  • REP-0737: must be a function of return type 'ref cursor.

    Hi all

    I have create a ref cursor query in reports 10 g. But it is giving error REP-0737: must be a function of return type 'ref cursor.

    Here is my code

    function QR_1RefCurDS return sys_refcursor is
    
     My_Cur Sys_Refcursor;
    begin
      Open My_Cur for select * from scott.emp order by deptno;
      return My_Cur
    end;
    

    fate of the screen.

    Ref_Cursor_in_reports10g.jpg

    Oracle Forms/Reports has a complete PL/SQL engine and (only) the SQL parser.

    However, the engine of forms/States PL / SQL and SQL Analyzer are at a level that was in the Oracle 8.0 database.

    So, in the forms/States functions/procedures and forms/States triggers, you can not use SQL commands that did not exist in the 8.0 database.

    The predefined SYS_REFCURSOR type is introduced in Oracle 9i.

    Use this:

    PACKAGE test_rc IS

    TYPE of rc_type IS REF CURSOR RETURN emp % ROWTYPE;

    END;

    FUNCTION RETURN QR_1RefCurDS Test_rc.rc_type IS

    test_rc.rc_type RC;

    BEGIN

    OPEN the RC to SELECT * FROM emp;

    RETURN rc;

    END;

    Kind regards

    Zlatko

  • CallFunction return type of the object instead of boolean

    Hello

    I used getScript("Somescriptname").callFunction to call a function in another script which has a boolean as a return type.

    The call above always returns type object, I tried an explicit cast to a boolean, but his throw syntax error.

    Please suggest

    Thanks and greetings

    Madoux

    Hello Suresh,

    getScript (.callFunction) always returns an object.  Initially, it should be stored in an object and then analyze Boolean value as shown below:

    Object Val = getScript("ScriptName").callFunction ("FunctionName", past of the arguments for the function, if any);

    Analyze as below

    Giveme Boolean = Boolean.parseBoolean (val.toString ());

    System.out.println ("return val:" + giveme);

    This should solve your problem.  Please let me know if this isn't...

    A happy test...

    Kind regards

    Plot of Sri

  • RETURN type of function table

    Hello

    I read conflicting information about the return type that has a table function must or may use.

    First, I am a student of a book that says:

    Function in pipeline returns the data types:

    The main constraint for the pipeline functions, it is the return type must be a collection type autonomous which can be used in SQL - i.e. a VARRAY or table nested.

    and then in the next sentence...

    More precisely a pipeline function can return the following:

    A stand-alone nested table or VARRAY, defined at the schema level.

    A nested table or VARRAY that has been declared in a package type.

    This seems to go against the first quoted sentence.

    Now, before reading the above text I had done just my own test to see if a packed type would work because I thought I had read somewhere that it would not, and he does not (the test code and this output is at the end of this question). When I arrived in the text above, after my test, so I was naturally confused.

    So, I'm going to PL/SQL reference that says:

    RETURN data type

    The data type of the value returned by a function table in pipeline must be a type collection defined either at the level of schema or within a package (therefore, it cannot be a type of associative array).

    I tried to call a function that returns a collection of VARRAY type packaged in both SQL and PL/SQL (of course below is SQL all in any case) and no work.

    Now I'm wondering what is a TABLE function must use a schema type and a function table in pipeline can use a packaged type?  I see that I created and called a function table but examples of Oracle see the creation and use of a function table in pipeline.

    Edit: I should add that I read the following sentence in the SF book on p609 in * table functions: "this type of nested table must be defined as an element of level diagram, because the SQL engine must be able to resolve a reference to a collection of this kind."

    So that it begins to resemble table functions should return a schema type and pipelined table functions, perhaps because that they don't in fact return a collection, rather they return (RowSource) content, can use the schema types or types of packages. Is this correct?

    Can someone clarify this for me please?

    Thank you in advance,

    J

    CREATE OR REPLACE PACKAGE PKGP28M

    VAT-type is varray (5) number;

    END;

    /

    DISPLAY ERRORS

    create or replace type VAT is varray (5) number;

    /

    display errors

    create or replace function tabfunc1 return pkgp28m.vat as

    numtab pkgp28m.vat:=pkgp28m.vat();

    Start

    numtab.extend (5);

    because loop me in 1.5

    numtab (i): = trunc (dbms_random. Value (1.5));

    end loop;

    Return numtab;

    end;

    /

    display errors

    create or replace function tabfunc2 as return VAT

    numtab vat:=vat().

    Start

    numtab.extend (5);

    because loop me in 1.5

    numtab (i): = trunc (dbms_random. Value (1.5));

    end loop;

    Return numtab;

    end;

    /

    display errors

    exec dbms_output.put_line (' call tabfunc1 (returns the packaged type) :');)

    Select * from table (tabfunc1)

    /

    exec dbms_output.put_line (' call tabfunc2 (returns the type of schema) :');)

    Select * from table (tabfunc2)

    /

    declare

    RC sys_refcursor;

    number of v;

    Start

    dbms_output.put_line (' in anonymous block1 - open rc to select in the table (tabfunc1) (returns the packaged type) :');)

    Open rc to select table column_value (tabfunc1);

    loop

    extract the rc in v;

    When the output rc % notfound;

    dbms_output.put_line (' > ' | to_char (v));

    end loop;

    close the rc;

    end;

    /

    declare

    RC sys_refcursor;

    number of v;

    Start

    dbms_output.put_line (' in anonymous block2 - open rc to select in the table (tabfunc2) (returns the type of schema) :');)

    Open rc to select table column_value (tabfunc2);

    loop

    extract the rc in v;

    When the output rc % notfound;

    dbms_output.put_line (' > ' | to_char (v));

    end loop;

    close the rc;

    end;

    /

    Scott@ORCL > @C:\Users\J\Documents\SQL\test29.sql

    Package created.

    No errors.

    Type of creation.

    No errors.

    The function is created.

    No errors.

    The function is created.

    No errors.

    the call of tabfunc1 (returns the packaged type):

    PL/SQL procedure successfully completed.

    Select * from table (tabfunc1)

    *

    ERROR on line 1:

    ORA-00902: invalid data type

    the call of tabfunc2 (returns the type of schema):

    PL/SQL procedure successfully completed.

    COLUMN_VALUE

    ------------

    1

    4

    1

    1

    3

    In anonymous block1 - open rc to select in the table (tabfunc1) (returns the packaged type):

    declare

    *

    ERROR on line 1:

    ORA-00902: invalid data type

    ORA-06512: at line 6

    In anonymous block2 - open rc to select in the table (tabfunc2) (returns the type of schema):

    > 1

    > 2

    > 4

    > 2

    > 3

    PL/SQL procedure successfully completed.

    Post edited by: Jason_942375

    But the compilation of the PIPELINED WILL CREATE the schematic function types automatically. And the TABLE function, applied to the PIPELINED function, use these types of hidden patterns.

  • Return type of dataframe string identifier

    Hello

    If I have to return a dataframe of rqScript which contains the string, how am I suppose to mention it in the return type of rqTableEval.

    For example, if the return value of rqScript is
    data.frame (c (1), c("Name"))
    , which is a number and the other string
    Then in the rqTableEval, identify the return values
    'select ID, 1 '1' chain of double'
    1 works as an identifier for the numbers but '1' doesn't work, '1' as an invalid identifier for the return string

    I tried with the host of permutations "-* ','. '. "\ *", "a" etc., none seems not to work

    Can I please get help on which must be specified as an identifier for the string type?

    Published by: Kedar Gupte on May 21, 2013 01:52

    Kedar,

    The string must be long enough to accommodate the output. For example, for a maximum length of 10 characters, you can do "Lucy" or cast ('a' as varchar2 (10)). You must also use single quotes instead of double quotes. In SQL double quotes are used to specify the identifiers (such as table names, column names, etc.). In your example, '1' is an unknown identifier. What you need is a string literal.

    Denis

  • DatabaseProcedure with the return type preceded of the schema name

    Salvation (Paco)

    I have a question on the DatabaseProcedure class. We use proxy Oracle users to our database connections.
    Everything is accessible via a role of database that are granted to the user. All of our database objects, tables, etc. are protected by this database role.
    When I want to call a function/procedure of database, I need to add the name of the schema as a prefix to the custom database object that uses us for parameters and return types.

    So far so good. I can also define a parameter prefixed by the name of schema via the DatabaseProcedure.registerArrayType...
    But when I try to set a function call that uses this parameter I get an error saying "the statement is not valid.
    The problem is the regular pattern of PROCEDURE_DEFINITION:
    private static final Pattern PROCEDURE_DEFINITION = Pattern.compile("\\s* (FUNCTION|PROCEDURE) \\s+ ([\\w.$]+) \\s* (?:\\((.*?)\\))? \\s* (?:RETURN\\s+(\\w+))? \\s* ;? \\s*", CASE_INSENSITIVE | COMMENTS | DOTALL);
    The return type cannot be prefixed by the name of schema.

    Any good suggestions or workarounds?

    I have actually change the duration of reflection model to make it work-, but I really don't like this solution over the long term.

    / Torben

    Published by: Zonic 2013-05-07 10:52

    Hi Torben,

    I think that I have a work around for the problem which might work for you. If you look at the source of DatabaseProcedure.registerArrayType you will find that it is actually called DatabaseProcedure.registerCustomParamType.

    public static void registerArrayType(String name)
    {
      registerCustomParamType(name, Types.ARRAY, Array.getORADataFactory(), name);
    }
    

    A solution you can replace calls to DatabaseProcedure.registerArrayType with calls to DatabaseProcedure.registerCustomParamType as follows.

    // Instead of DatabaseProcedure.registerArrayType("NAME.WITH.DOTS") call:
    DatabaseProcedure.registerCustomParamType("anyNameWithoutDots", Types.ARRAY, Array.getORADataFactory(), "NAME.WITH.DOTS"); // Don't forget to use uppercase here.
    
    DatabaseProcedure dp = DatabaseProcedure.define("procedure my.procedure(param1 in out anyNameWithoutDots)");
    
    DatabaseProcedure.ParamType type = dp.getParamDef(0).getType();
    System.out.println(type.getName() + " is " + type.getTypeName()); // ANYNAMEWITHOUTDOTS is NAME.WITH.DOTS
    

    In this way, that you don't have to use the 'illegal' name in the definition of DatabaseProcedure.

    Kind regards
    Paco van der Linden

  • PLS-00362: Invalid cursor return type; 'NUMBER' must be a record type

    Hello

    Having a little trouble with the following code example provided to http://www.dba-oracle.com/plsql/t_plsql_cursor_variables.htm:
      1  DECLARE
      2    TYPE t_ref_cursor IS REF CURSOR RETURN NUMBER;
      3    c_cursor  t_ref_cursor;
      4    l_row   NUMBER;
      5  BEGIN
      6    DBMS_OUTPUT.put_line('Strongly typed REF CURSOR using SCALAR type. Expect an error!');
      7    OPEN c_cursor FOR
      8      SELECT COUNT(*) cnt
      9      FROM   cursor_variable_test;
     10    LOOP
     11      FETCH c_cursor
     12      INTO  l_row;
     13      EXIT WHEN c_cursor%NOTFOUND;
     14      DBMS_OUTPUT.put_line(l_row);
     15    END LOOP;
     16    CLOSE c_cursor;
     17* END;
     18  /
      TYPE t_ref_cursor IS REF CURSOR RETURN NUMBER;
                           *
    ERROR at line 2:
    ORA-06550: line 2, column 24:
    PLS-00362: invalid cursor return type; 'NUMBER' must be a record type
    ORA-06550: line 2, column 3:
    PL/SQL: Item ignored
    In the code above, SELECT COUNT (*)... returns a NUMBER. I know it's an aggregation function, but it returns a single value.
    Why can't return a value in a column of a row in a NUMBER?
    How can I change the SQL code so that I can do this?

    Furthermore, I wonder about the use of FETCH with a count (*)... FETCH is supposed to fetch the next row... How it works when you select an aggregate as County?

    Thank you very much
    Jason

    >
    TYPE t_ref_cursor IS REF CURSOR RETURN NUMBER;
    *
    ERROR on line 2:
    ORA-06550: line 2, column 24:
    PLS-00362: Invalid cursor return type; 'NUMBER' must be a record type
    ORA-06550: line 2, column 3:
    PL/SQL: Ignored Element

    In the code above, SELECT COUNT (*)... returns a NUMBER. I know it's an aggregation function, but it returns a single value.
    Why can't return a value in a column of a row in a NUMBER?
    How can I change the SQL code so that I can do this?
    >
    The exception is in line 2: your cursor statement. And the answer is in the text that you access
    >
    The return value of a strongly typed REF CURSOR must be a folder that can be defined using % TYPE % ROWTYPE attributes or record structure.
    >
    You said the CURSOR to return a NUMBER. And as the text says, he must be a 'record '.
    >
    Furthermore, I wonder about the use of FETCH with a count (*)... FETCH is supposed to fetch the next row... How it works when you select an aggregate as County?
    >
    As you said already FETCH retrieves the next line, if any. A query is a request is a request. It returns a result set. A query that uses aggregates returns a result set. A query that does not aggregate returns a result set.

    Your simple COUNT (*) SELECT query returns a result set that consists of a LINE and a line a ONE COLUMN of type NUMBER. Although there is only one column in the result set, what is returned is a RECORD or a LINE. That's why you have to report your data cursor return type a document using the % ROWTYPE or % TYPE attributes or a record structure.

  • Before then, the shift functions return type?

    I can not stress which is the return type of these functions? numeric value or Member?

    And if they come back that a member would be this fomula be valid (I have to take the average of March and June):
    avgppl = @avgrange ("HRsummary"-> "territory", @list (@currmbr ("YearTotal"), @shift (@currmbr ("YearTotal"),-3)))

    Thanks in advance!

    Hello

    All the mentioned functions (Prior, Next, and shift) returns the values and non-members.

    Concerning
    -SM

  • ORA-02327: cannot create indexes on the LOB data type expression

    DB 10.2.0.4
    DB 5.2

    I am not able to move lobindex and lobsegment. While try occurs below error

    SQL > ALTER INDEX dev. "" SYS_IL0000718396C00002$ $"REBUILD THE TABLESPACE DATA_TEMP;
    ALTER INDEX dev. "" SYS_IL0000718396C00002$ $"REBUILD TABLESPACE DATA_TEMP
    *
    ERROR on line 1:
    ORA-02327: cannot create indexes on the LOB data type expression

    Thank you

    Published by: user13382934 on October 16, 2012 14:05

    correct syntax is
    ALTER TABLE.

    MOVE the LOB ()
    STORE AS (tablespace );

    Where is a name of the / columns LOB, not the name of the segment. Moving type LOB data will move its indexes as well.

  • In interfaces covariant return types

    Hello
    I tried this little to understand code snippet covariant returns but when I tried to compile I get errors saying that I need to implement interfaces. I'm in a bit of a puzzle because I think I have them implemented correctly. Can someone help me please this problem...

    interface I1 {number f() ;}
    interface I2 {f(Number i) ;} number
    the interface I3 {int f() ;}

    class C {}
    public number f() {return 1 ;}}
    }

    class C2 implements I1, I2 {}
    public Integer f() {return 1 ;}}
    public Integer f (Float i) {return 1 ;}}
    }

    Class C3 extends C implements I2 {}
    Public Float f (Integer i) {return (float) 1 ;}}
    }

    class C4 extends C implements I3 {}
    public int f() {return 1 ;}}
    }
    Any help is greatly appreciated.

    Here are the error messages:

    The problem here is that you do more to vary the return types. You are also vary the types of parameters . You can't do during the substitution.

  • Why host interface create() method return type is only return RMI types?

    Why host interface create() method return type is only return RMI types? Why not other primitive data types?

    Because the bean home interface an EJB specifies methods that allow the client to create, delete, and find items of the same type as self. The EJB itself must be an RMI type, and it could certainly not be a primitive type.

  • Updating of the Data Services loses configured enter/return types

    v 4.0.1

    I have several configured data services (all PHP services).  I have about 20-25 functions defined in all 6 services, but 4 functions will surely lose the enter/return types configured each time a manual refresh or auto data occurs.  For example, I have a function:

    saveOrder(OrderHeader:Object,_LineItems:Object):Object

    When I right click and 'configure the Types of entry... '. ", and then"configure return Type... ". "I can set the appropriate without any error types.  I get so I expect the function definition:

    saveOrder(OrderHeader:OrderHeaderFlex,_LineItems:LineItemFlex[]):Boolean

    My ACE and PHP code seem to have errors, I've tested successfully this function repeatedly.  However, if I right-click and choose "Refresh" on my name of service or the service itself, the function returns the definition of the unknown.  He will go even after the automatic update, which produces from time to time.  I can configure the types of data and then immediately, click Refresh and this function will return to the unknown, even if there has been absolutely no code changes.  I have other services and functions in the same project (some that use the same types of data involved above) who do not have this behavior.

    Even when these functions "lose" data type configuration, my project will still compile and affected functions will work as expected.

    This occurs because of a bug in Zend. See the bug related to FB and the bug of zend.

    FB-27016

    ZF-10365

    -blandine

  • Doubt about the return type of function

    Hello

    Can a function returns a Boolean value in a select query.

    Suppose m creating a function... so can we have a return type of Boolean as...?

    If so... THN please give an example

    Can a function returns a Boolean value in a select query

    The answer is no. a Boolean is not a SQL data type and may not be used in the SELECT query.
    For the user-defined function to be called in a SQL statement, see http://download.oracle.com/docs/cd/E11882_01/appdev.112/e10471/adfns_packages.htm#ADFNS00908
    Note especially these lines

    "Its formal parameters and its return value (if any) must have built-in data types (for example, CHAR, DATE or NUMBER) Oracle, not types (such as BOOLEAN, RECORD or TABLE) PL/SQL data.

    "There is an exception to this rule: a formal parameter can have a PL/SQL data type, if the corresponding actual parameter is implicitly converted to the data type of the formal parameter" >

    Published by: Johan August 3, 2010 03:48

  • PLS-00630: pipeline functions must have a collection of supported return type

    Hello, I created a TYPE of OBJECT and function PLSQL as shown below, but the function compile errors with that follows. Don't know where is the problem?
    PLS-00630: pipelined functions must have a supported collection return type
    It's about Oracle 10 g r2
    CREATE OR REPLACE TYPE cxs_plsql_profiler_object_type AS OBJECT (
       cxs_object_name      VARCHAR2 (128),
       cxs_object_type      VARCHAR2 (19),
       cxs_object_status    VARCHAR2 (7),
       cxs_read_execution   NUMBER,
       cxs_buffer_gets      NUMBER,
       cxs_disk_reads       NUMBER,
       cxs_executions       NUMBER,
       cxs_sorts            NUMBER,
       cxs_sharable_mem     NUMBER,
       cxs_address          NUMBER,
       cxs_hashvalue        NUMBER,
       cxs_osuser           VARCHAR2 (30),
       cxs_username         VARCHAR2 (30),
       cxs_module           VARCHAR2 (48),
       cxs_machine          VARCHAR2 (64),
       cxs_status           VARCHAR2 (8),
       cxs_terminal         VARCHAR2 (16),
       cxs_percentconsume   NUMBER,
       cxs_percentrepeat    NUMBER,
       cxs_plan             VARCHAR2 (120),
       target_name          VARCHAR2 (200),
       referenced_name      VARCHAR2 (200),
       referenced_type      VARCHAR2 (200),
       targetowner          VARCHAR2 (200),
       refowner             VARCHAR2 (200)
    )
    and here are the API
        FUNCTION CXS_GENERATE_PLSQL_PROFILER
    RETURN cxs_plsql_profiler_object_type
    PIPELINED IS
    out_rec cxs_plsql_profiler_object_type ;
    
    plsbatch plsql_batch;
    skount integer;
    dpendrec depend_tab;
    dkount integer;
    
    
    
    
    CURSOR objects
          IS
             SELECT object_name, object_type
               FROM dba_objects
              WHERE status = 'VALID'
                AND owner NOT IN ('SYS', 'SYSTEM')
                AND object_type IN ('PACKAGE', 'PROCEDURE', 'FUNCTION');
    
          CURSOR apis (p_object dba_objects.object_name%TYPE)
          IS
             SELECT DISTINCT *
                        FROM (SELECT   SUBSTR (a.sql_text, 1, 50) sql_text,
                                       TRUNC
                                          (  a.disk_reads
                                           / DECODE (a.executions,
                                                     0, 1,
                                                     a.executions
                                                    )
                                          ) reads_per_execution,
                                       a.buffer_gets, a.disk_reads, a.executions,
                                       a.sorts, a.sharable_mem, a.address,
                                       a.hash_value, b.osuser, b.username,
                                       b.module, b.machine, b.status, b.terminal,
                                       ROUND
                                          (cxs_db_info.kompute_percentofsql
                                                                   (a.sharable_mem),
                                           5
                                          ) percentkonsume,
                                       cxs_db_info.kount_repeat
                                                             (b.osuser,
                                                              b.terminal
                                                             ) percentr,
                                       c.operation explainplan
                                  FROM v$sqlarea a, v$session b, v$sql_plan c
                                 WHERE b.sql_hash_value = a.hash_value
                                   AND b.sql_address = a.address
                                   AND a.hash_value = c.hash_value
                                   AND a.address = c.address
                                   AND b.status = 'ACTIVE'
                                   AND UPPER (a.sql_text) LIKE
                                                            '%' || p_object || '%'
                                   AND c.ID = 0
                              ORDER BY 2 DESC)
                       WHERE ROWNUM <= 50;   --profile option
    BEGIN
    
    skount := 0;
    dkount := 0;
    
     FOR i IN objects
          LOOP
             FOR j IN apis (i.object_name)
             LOOP
                skount := skount + 1;
                plsbatch(skount).cxs_object_name  := i.object_name;
       plsbatch(skount).cxs_object_type      :=  i.object_type;
       plsbatch(skount).cxs_object_status    :=  i.object_status;
       plsbatch(skount).cxs_read_execution   := j.reads_per_execution;
       plsbatch(skount).cxs_buffer_gets      := j.buffer_gets;
       plsbatch(skount).cxs_disk_reads       := j.disk_reads;
       plsbatch(skount).cxs_executions       := j.executions;
       plsbatch(skount).cxs_sorts            := j.sorts;
       plsbatch(skount).cxs_sharable_mem     := j.sharable_mem;
       plsbatch(skount).cxs_address          := j.address;
       plsbatch(skount).cxs_hashvalue        := j.hashvalue;
       plsbatch(skount).cxs_osuser           := j.osuser;
       plsbatch(skount).cxs_username         := j.username;
       plsbatch(skount).cxs_module           := j.module;
       plsbatch(skount).cxs_machine          := j.machine;
       plsbatch(skount).cxs_status           := j.status;
       plsbatch(skount).cxs_terminal         := j.terminal;
       plsbatch(skount).cxs_percentconsume   := j.percentconsume;
       plsbatch(skount).cxs_percentrepeat    := j.percentrepeat;
       plsbatch(skount).cxs_plan             := j.explainplan;
             END LOOP;
    
             FOR dd IN dpend (i.object_name)
             LOOP
                dkount := dkount + 1;
                dependrec (dkount).target_name := dd.NAME;
                dependrec (dkount).refname := dd.referenced_name;
                dependrec (dkount).reftype := dd.referenced_type;
                dependrec (dkount).target_owner := dd.owner;
                dependrec (dkount).refowner := dd.referenced_owner;
             END LOOP;
          END LOOP;
    
    for a in 1..skount loop
    
       out_rec.cxs_object_type      := plsbatch(a).object_type;
       out_rec.cxs_object_status    := plsbatch(a).object_status;
       out_rec.cxs_read_execution   := plsbatch(a).reads_per_execution;
       out_rec.cxs_buffer_gets      := plsbatch(a).buffer_gets;
       out_rec.cxs_disk_reads       := plsbatch(a).disk_reads;
       out_rec.cxs_executions       := plsbatch(a).executions;
       out_rec.cxs_sorts            := plsbatch(a).sorts;
       out_rec.cxs_sharable_mem     := plsbatch(a).sharable_mem;
       out_rec.cxs_address          := plsbatch(a).address;
       out_rec.cxs_hashvalue        := plsbatch(a).hashvalue;
       out_rec.cxs_osuser           := plsbatch(a).osuser;
       out_rec.cxs_username         := plsbatch(a).username;
       out_rec.cxs_module           := plsbatch(a).module;
       out_rec.cxs_machine          := plsbatch(a).machine;
       out_rec.cxs_status           := plsbatch(a).status;
       out_rec.cxs_terminal         := plsbatch(a).terminal;
       out_rec.cxs_percentconsume   := plsbatch(a).percentconsume;
       out_rec.cxs_percentrepeat    := plsbatch(a).percentrepeat;
       out_rec.cxs_plan             := plsbatch(a).explainplan;
       PIPE ROW(out_rec);
    end loop;
    
    
    for b in 1..dkount loop
        out_rec.target_name := dd.NAME;
                out_rec.refname := dependrec (b).referenced_name;
                out_rec.reftype := dependrec (b).referenced_type;
                out_rec.target_owner := dependrec (b).owner;
                out_rec.refowner := dependrec (b).referenced_owner;
                PIPE ROW(out_rec);
     end loop;
    RETURN;
    EXCEPTION
    WHEN OTHERS THEN
    DBMS_OUTPUT.PUT_LINE(DBMS_UTILITY.format_error_backtrace);
    DBMS_OUTPUT.PUT_LINE(SQLCODE);
    DBMS_OUTPUT.PUT_LINE(SQLERRM);
    END; 
    and here's tradtional types of tables that are used in the code above.
     TYPE type_plsql_rec IS RECORD (
       cxs_object_name      VARCHAR2 (128),
       cxs_object_type      VARCHAR2 (19),
       cxs_object_status    VARCHAR2 (7),
       cxs_read_execution   NUMBER,
       cxs_buffer_gets      NUMBER,
       cxs_disk_reads       NUMBER,
       cxs_executions       NUMBER,
       cxs_sorts            NUMBER,
       cxs_sharable_mem     NUMBER,
       cxs_address          NUMBER,
       cxs_hashvalue        NUMBER,
       cxs_osuser           VARCHAR2 (30),
       cxs_username         VARCHAR2 (30),
       cxs_module           VARCHAR2 (48),
       cxs_machine          VARCHAR2 (64),
       cxs_status           VARCHAR2 (8),
       cxs_terminal         VARCHAR2 (16),
       cxs_percentconsume   NUMBER,
       cxs_percentrepeat    NUMBER,
       cxs_plan             VARCHAR2 (120)
       );
    
       TYPE plsql_batch IS TABLE OF type_plsql_rec
          INDEX BY BINARY_INTEGER;
          
          
           TYPE type_depend_tab IS RECORD (
          target_name    dba_dependencies.NAME%TYPE,
          refname        dba_dependencies.referenced_name%TYPE,
          reftype        dba_dependencies.referenced_type%TYPE,
          target_owner   dba_dependencies.owner%TYPE,
          refowner       dba_dependencies.referenced_owner%TYPE
       );
    
       TYPE depend_tab IS TABLE OF type_depend_tab
          INDEX BY BINARY_INTEGER;
    Thank you for your time in reading this post

    R

    Johan says:
    Sorry!.
    Actually, I meant

    I thought as well.

    Typos can be expensive however. As a probe of NASA Mars in 99, which was lost due to a simple mathematical error - a confusion between English and metric units. ;-)

    Or screw up a server in reason to use a Unix fork() where the client process think that it is the parent and the beginning more children who believe they are also parents of spawning... (one of my mistakes of kewlest never) :-)

Maybe you are looking for

  • screenshot for Firefox 9 I get errors

    Whenever I try to download and install a screenshot for Firefox 9 it says error try again I am now tired of trying to do this

  • NB100 - how to disable scrolling?

    On a new NB100, whenever I have use the scroll bar in Internet Explore two pointing arrows will appear in front of the needle and disrupt the function of scrolling of the sidebar. I was unable to turn off or find where it came from. I would appreciat

  • Communication controller Eurotherm 2416

    I just downloaded the Eurotherm ET24xx driver on driver page OR. When I run the sample VI lack the Vi loads of void VI for example "read registry floating point.vi. Can someone help me with this? is the missing driver under vi or is there something I

  • I get messages that support and problems Windows has stopped working. and also that I have no more memory on line 2. What can I do to fix this?

    I get messages that support and problems Windows has stopped working.  I told myself that I will advise if a solution is found, I get another box saying that I have to close becausse that Windows does not work.  I also get messages that I have not mo

  • Ativa trasmet cord

    I am not able to drag files, a HP computer to a new windows 7 Compaq Preserio Home Premium, with a cable to transfer MS Ativa. I called Office Depot to make sure that I was captivated by the right cable, not help. Can someone walk me step by step thr