Use of table function

How could we user the table function in a procedure?

In fact, here's an example function that does the same...
  TYPE split_tbl IS TABLE OF VARCHAR2(32767);
  FUNCTION split (p_list VARCHAR2, p_delim VARCHAR2:=' ') RETURN SPLIT_TBL PIPELINED IS
    l_idx    PLS_INTEGER;
    l_list   VARCHAR2(32767) := p_list;
    l_value  VARCHAR2(32767);
  BEGIN
    LOOP
      l_idx := INSTR(l_list, p_delim);
      IF l_idx > 0 THEN
        PIPE ROW(SUBSTR(l_list, 1, l_idx-1));
        l_list := SUBSTR(l_list, l_idx+LENGTH(p_delim));
      ELSE
        PIPE ROW(l_list);
        EXIT;
      END IF;
    END LOOP;
    RETURN;
  END SPLIT;

Similar Messages

  • How to use the Table Function defined  in package in OWB?

    Hi,
    I defined a table function in a package. I am trying to use that in owb using Table function operator. But I came to know that, owb R1 supports only standalone table functions.
    Is there any other way to use the table function defined in a package. As like we create synonyms for functions, is there any other way to do this.
    I tryed to create synonyms, it is created. But it is showing compilation error. Finally I found that, we can't create synonyms for functions which are defined in packages.
    Any one can explain it, how to resolve this problem.
    Thank you,
    Regards
    Gowtham Sen.

    Hi Marcos,
    Thank you for reply.
    OWB R1 supports stand alone table functions. Here what I mean is, the table fucntion which is not inculded in any package is a stand alone table function.
    for example say sample_tbl_fn is a table function. It is defined as a function.It is a stand alone function. We call this fucntion as "samp_tbl_fn()";
    For exampe say sample_pkg is a package. say a function is defined in a package.
    then we call that function as sample_pkg.functionname(); This is not a stand alone function.
    I hope you understand it.
    owb supports stand alone functions.
    Here I would like to know, is there any other way to use the functions which are defined in package. While I am trying to use those functions (which are defined in package -- giving the name as packagename.functionname) it is throwing an error "Invalid object name."
    Here I would like know, is there any other way to use the table functions which are defined in a package.
    Thank you,
    Regards,
    Gowtham Sen.

  • Query performance improvement using pipelined table function

    Hi,
    I have got two select queries one is like...
    select * from table
    another is using pielined table function
    select *
    from table(pipelined_function(cursor(select * from table)))
    which query will return result set more faster????????
    suggest methods for retrieving dataset more faster (using pipelined table function) than a normal select query.
    rgds
    somy

    Compare the performance between these solutions:
    create table big as select * from all_objects;
    First test the performance of a normal select statement:
    begin
      for r in (select * from big) loop
       null;
      end loop;
    end;
    /Second a pipelined function:
    create type rc_vars as object 
    (OWNER  VARCHAR2(30)
    ,OBJECT_NAME     VARCHAR2(30));
    create or replace type rc_vars_table as table of  rc_vars ;
    create or replace
    function rc_get_vars
    return rc_vars_table
    pipelined
    as
      cursor c_aobj
             is
             select owner, object_name
             from   big;
      l_aobj c_aobj%rowtype;
    begin
      for r_aobj in c_aobj loop
        pipe row(rc_vars(r_aobj.owner,r_aobj.object_name));
      end loop;
      return;
    end;
    /Test the performance of the pipelined function:
    begin
      for r in (select * from table(rc_get_vars)) loop
       null;
      end loop;
    end;
    /On my system the simple select-statement is 20 times faster.
    Correction: It is 10 times faster, not 20.
    Message was edited by:
    wateenmooiedag

  • Using Pipeline Table functions with other tables

    I am on DB 11.2.0.2 and have sparingly used pipelined table functions but am considering it for a project that has some fairly big (lots of rows) sized tables. In my tests, selecting from just the pipelined table perform pretty well (whether it is directly from the pipleined table or the view I created on top of it). Where I start to see some degregation when I try to join the pipelined tabe view to other tables and add where conditions.
    ie:
    SELECT A.empno, A.empname, A.job, B.sal
    FROM EMP_VIEW A, EMP B
    WHERE A.empno = B.empno AND
          B.mgr = '7839'
    I have seen some articles and blogs that mention this as a cardinality issue, and offer some undocumented methods to try and combat.
    Can someone please give me some advice or tips on this. Thanks!
    I have created a simple example using the emp table below to help illustrate what I am doing.
    DROP TYPE EMP_TYPE;
    DROP TYPE EMP_SEQ;
    CREATE OR REPLACE TYPE EMP_SEQ AS OBJECT
           ( EMPNO                                         NUMBER(10),
             ENAME                                         VARCHAR2(100),
             JOB                                           VARCHAR2(100));
    CREATE OR REPLACE TYPE EMP_TYPE AS TABLE OF EMP_SEQ;
    CREATE OR REPLACE FUNCTION get_emp return EMP_TYPE PIPELINED AS
    BEGIN
      FOR cur IN (SELECT
                    empno,
                    ename,
                    job
                  FROM emp
             LOOP
               PIPE ROW(EMP_SEQ(cur.empno,
                                cur.ename,
                                cur.job));
             END LOOP;
             RETURN;
    END get_emp;
    create OR REPLACE view EMP_VIEW as select * from table(get_emp());
    SELECT A.empno, A.empname, A.job, B.sal
    FROM EMP_VIEW A, EMP B
    WHERE A.empno = B.empno AND
          B.mgr = '7839'

    I am on DB 11.2.0.2 and have sparingly used pipelined table functions but am considering it for a project that has some fairly big (lots of rows) sized tables
    Which begs the question: WHY? What PROBLEM are you trying to solve and what makes you think using pipelined table functions is the best way to solve that problem?
    The lack of information about cardinality is the likely root of the degradation you noticed as already mentioned.
    But that should be a red flag about pipelined functions in general. PIPELINED functions hide virtually ALL KNOWLEDGE about the result set that is produced; cardinality is just the tip of the iceberg. Those functions pretty much say 'here is a result set' without ANY information about the number of rows (cardinality), distinct values for any columns, nullability of any columns, constraints that might apply to any columns (foreign key, primary key) and so on.
    If you are going to hide all of that information from Oracle that would normally be used to help optimize queries and select the appropriate execution plan you need to have a VERY good reason.
    The use of PIPELINED functions should be reserved for those use cases where ordinary SQL and PL/SQL cannot get the job done. That is they are a 'special case' solution.
    The classic use case for those functions is for the transform stage of ETL where multiple pipelined functions are chained together: one function feeds its rows to the next function which feeds its rows to another and so on. Each of those 'chained' functions is roughly analogous to a full table scan of the data that often does not need to be joined to other data except perhaps low volumn lookup tables where the data may even be cached.
    I suggest that any exploratory or prototyping work you do use standard relational tables until such point as you run into a problem whose solution might require PIPELINED functions to solve.

  • Getting ORA-00600 when using table functions

    Hello,
    I am trying to use simple table function:
    create or replace type StatCall AS OBJECT (
    dial_number varchar2(255),
    start_date date,
    duration number(20)
    create or replace type StatCallSet AS TABLE OF StatCall;
    create or replace package ref IS
    type refcall_t IS REF CURSOR RETURN calls%ROWTYPE;
    end ref;
    create or replace function GetStats(p ref.refcall_t) return StatCallSet pipelined is
    out_rec StatCall;
    in_rec p%ROWTYPE;
    BEGIN
    LOOP
    FETCH p INTO in_rec;
    EXIT WHEN p%NOTFOUND;
    out_rec.dial_number := in_rec.dial_number;
    out_rec.start_date := in_rec.start_date;
    out_rec.duration := in_rec.duration;
    PIPE ROW(out_rec);
    END LOOP;
    CLOSE p;
    RETURN;
    END;
    select * from TABLE(GetStats(CURSOR(select * from call)));
    And I get:
    ORA-00600: internal error code, arguments: [17285], [0xFFFFFFFF7C4900A8], [1], [0x3943BA5E0], [], [], [], []
    Oracle 9.2.0.2
    Are there any ideas about how to fix this?

    What version of the database?
    Which flavor of Disco (Plus, Desktop, Viewer)?
    Standars EUL or Apps EUL?
    Can you post the code for the calculation?
    ORA-600 errors, as you mentioned, are internal, and may require opening a dialog with Oracle support. Then again, it could be something else in the calculation that is causing the sky to fall.

  • Does using TABLE FUNCTIONS degrades performance

    Hi,
    I am using a TABLE Function TABLE(TABLEA)
    I am using a SQL Statement where I am joing TABLE FUNCTION :TABLE(TABLEA) and Normal table:TABLEB
    i.e
    SELECT CODE,SUD FROM TABLEB,TABLE(TABLEA)
    WHERE CODE=CODE1 (CODE1 is a Object Type variable).

    user598986 wrote:
    I am using a TABLE Function TABLE(TABLEA)
    I am using a SQL Statement where I am joing TABLE FUNCTION :TABLE(TABLEA) and Normal table:TABLEB
    i.e
    SELECT CODE,SUD FROM TABLEB,TABLE(TABLEA)
    WHERE CODE=CODE1 (CODE1 is a Object Type variable).One particular issue with table functions and joins is that the optimizer doesn't have a clue about the cardinality, i.e. the number of rows returned by the table function and therefore applies defaults which might be way off. If you somehow know roughly how many rows are going to be returned (may be a quite constant number of rows or your process know the number of rows in a collection etc.) then you can help the optimizer by using the (undocumented) "CARDINALITY" hint, e.g.
    SELECT /*+ CARDINALITY (A, 100) */ CODE,SUD FROM TABLEB B,TABLE(TABLEA) A...
    tells the optimizer that the table function is going to return 100 rows. Note the usage of the alias in the hint.
    But bear in mind that this only helps partially, some other basic information like column statistics are still missing and therefore the estimates of the optimizer still might be inaccurate.
    Regards,
    Randolf
    Oracle related stuff blog:
    http://oracle-randolf.blogspot.com/
    SQLTools++ for Oracle (Open source Oracle GUI for Windows):
    http://www.sqltools-plusplus.org:7676/
    http://sourceforge.net/projects/sqlt-pp/

  • Interactive report on view based on pipelined table function.

    Hi,
    I want to build an Interactive Report on a view.
    The view definition contains a select on a pipelined table function. I use context functionality to pass paramaters to the pipelined table function.
    A plain select * from #my_view# in SqlPlus results in 121 different rows.
    However, If I base my Interactive report on this view, I get 15 repeated rows (all the same).
    Is it possible to use pipelined table functionality on an Interactive report? I can't seem to get it working.
    If I use the following approach (http://rakeshjsr.blogspot.nl/2010/10/oracle-apex-interactive-report-based-on.html) I do get results, but I can't use this solution for a reason that's not relevant.

    Hello,
    Is it possible to use pipelined table functionality on an Interactive report? I can't seem to get it working. I have used it in one instance and it works fine. However I was passing the values to pipe-lined function directly.
    IR Query..
    SELECT * FROM TABLE(fn_pipeline(:P1_ITEM_NAME))Call pipe-lined function from IR query directly (instead of using view)
    Try sending values to Pipe-lined function directly. In-case if the problem is with setting and getting values from the context?
    Regards,
    Hari

  • How to use a table to fill an array

    I have a cFP 2110 with a couple of relay modules I'm using to automate a process.  I'm  using an array of a cluster of elements to turn the relays on and off with a time delay for each step.  This was the first version I started with and I have since built a state machine around.  What I would like to do is add a table or array to the front pannel and move the relay control and time delay to the front panel and allow the user to specify which relays are on or off and for how long.  I also want to allow the user to save the table and have the option to select other saved versions of the table to operate the module with different.   I also need to add a string control to the table so I will need to use shared variables for to communicate between the target Vi and the host vi the user is working from.  Is a table the correct approach to do this?  I have never used the table functions.  How do I go about building a table and sending the data to an array?  Do I need to send the table contents to file OI first, then have the array read the specified file?
    Thank for the help.
    Danny
    Attachments:
    array.vi ‏40 KB

    Hi Danny,
    Instead of using a constant array on your block diagram, you could use a control array so that the elements show up on the front panel. Then your user will have the ability to change the relays and time delay. You can then use Datalog files (see Help >> Find Examples... and search Datalog) to save individual clusters. Otherwise if you want to save entire arrays, you could just save them to a binary file. 
    Using the array of controls eliminates the need for a table and its conversion, and also provides a front panel interface for your user to control. Does the string control need to be part of these array as well, or can it be separate?
    If you are reading a file back to be used with your program, you will need to read the file to get its contents before using it to control your loop.
    Will
    Certified LabVIEW Architect, Certified Professional Instructor
    Choose Movement Consulting
    choose-mc.com

  • Need some help with the Table Function Operator

    I'm on OWB 10gR2 for Sun/Solaris 10 going against some 10gR2 DB's...
    I've been searching up and down trying to figure out how to make OWB use a Table Function (TF) which will JOIN with another table; allowing a column of the joined table to be a parameter in to the TF. I can't seem to get it to work. I'm able to get this to work in regular SQL, though. Here's the setup:
    -- Source Table:
    DROP TABLE "ZZZ_ROOM_MASTER_EX";
    CREATE TABLE "ZZZ_ROOM_MASTER_EX"
    ( "ID" NUMBER(8,0),
    "ROOM_NUMBER" VARCHAR2(200),
    "FEATURES" VARCHAR2(4000)
    -- Example Data:
    Insert into ZZZ_ROOM_MASTER_EX (ID,ROOM_NUMBER,FEATURES) values (1,'Room 1',null);
    Insert into ZZZ_ROOM_MASTER_EX (ID,ROOM_NUMBER,FEATURES) values (2,'Room 2',null);
    Insert into ZZZ_ROOM_MASTER_EX (ID,ROOM_NUMBER,FEATURES) values (3,'Room 3','1,1;2,3;');
    Insert into ZZZ_ROOM_MASTER_EX (ID,ROOM_NUMBER,FEATURES) values (4,'Room 4','5,2;5,4;');
    Insert into ZZZ_ROOM_MASTER_EX (ID,ROOM_NUMBER,FEATURES) values (5,'Room 5',' ');
    -- Destination Table:
    DROP TABLE "ZZZ_ROOM_FEATURES_EX";
    CREATE TABLE "ZZZ_ROOM_FEATURES_EX"
    ( "ROOM_NUMBER" VARCHAR2(200),
    "FEATUREID" NUMBER(8,0),
    "QUANTITY" NUMBER(8,0)
    -- Types for output table:
    CREATE OR REPLACE TYPE FK_Row_EX AS OBJECT
    ID NUMBER(8,0),
    QUANTITY NUMBER(8,0)
    CREATE OR REPLACE TYPE FK_Table_EX AS TABLE OF FK_Row_EX;
    -- Package Dec:
    CREATE OR REPLACE
    PACKAGE ZZZ_SANDBOX_EX IS
    FUNCTION UNFK(inputString VARCHAR2) RETURN FK_Table_EX;
    END ZZZ_SANDBOX_EX;
    -- Package Body:
    CREATE OR REPLACE
    PACKAGE BODY ZZZ_SANDBOX_EX IS
    FUNCTION UNFK(inputString VARCHAR2) RETURN FK_Table_EX
    AS
    RETURN_VALUE FK_Table_EX := FK_Table_EX();
    i NUMBER(8,0) := 0;
    BEGIN
    -- TODO: Put some real code in here that will actually read the
    -- input string, parse it out, and put data in to RETURN_VALUE
    WHILE(i < 3) LOOP
    RETURN_VALUE.EXTEND;
    RETURN_VALUE(RETURN_VALUE.LAST) := FK_Row_EX(4, 5);
    i := i + 1;
    END LOOP;
    RETURN RETURN_VALUE;
    END UNFK;
    END ZZZ_SANDBOX_EX;
    I've got a source system built by lazy DBA's and app developers who decided to store foreign keys for many-to-many relationships as delimited structures in driving tables. I need to build a generic table function to parse this data and return it as an actual table. In my example code, I don't actually have the parsing part written yet (I need to see how many different formats the source system uses first) so I just threw in some stub code to generate a few rows of 4's and 5's to return.
    I can get the data from my source table to my destination table using the following SQL statement:
    -- from source table joined with table function
    INSERT INTO ZZZ_ROOM_FEATURES_EX(
    ROOM_NUMBER,
    FEATUREID,
    QUANTITY)
    SELECT
    ZZZ_ROOM_MASTER_EX.ROOM_NUMBER,
    UNFK.ID,
    UNFK.QUANTITY
    FROM
    ZZZ_ROOM_MASTER_EX,
    TABLE(ZZZ_SANDBOX_EX.UNFK(ZZZ_ROOM_MASTER_EX.FEATURES)) UNFK
    Now, the big question is--how do I do this from OWB? I've tried several different variations of my function and settings in OWB to see if I can build a single SELECT statement which joins a regular table with a table function--but none of them seem to work, I end up getting SQL generated that won't compile because it doesn't see the source table right:
    INSERT
    /*+ APPEND PARALLEL("ZZZ_ROOM_FEATURES_EX") */
    INTO
    "ZZZ_ROOM_FEATURES_EX"
    ("ROOM_NUMBER",
    "FEATUREID",
    "QUANTITY")
    (SELECT
    "ZZZ_ROOM_MASTER_EX"."ROOM_NUMBER" "ROOM_NUMBER",
    "INGRP2"."ID" "ID_1",
    "INGRP2"."QUANTITY" "QUANTITY"
    FROM
    (SELECT
    "UNFK"."ID" "ID",
    "UNFK"."QUANTITY" "QUANTITY"
    FROM
    TABLE ( "ZZZ_SANDBOX_EX"."UNFK2" ("ZZZ_ROOM_MASTER_EX"."FEATURES")) "UNFK") "INGRP2",
    "ZZZ_ROOM_MASTER_EX" "ZZZ_ROOM_MASTER_EX"
    As you can see, it's trying to create a sub-query in the FROM clause--causing it to just ask for "ZZZ_ROOM_MASTER_EX"."FEATURES" as an input--which isn't available because it's outside of the sub-query!
    Is this some kind of bug with the code generator or am I doing something seriously wrong here? Any help will be greatly appreciated!

    Hello Everybody!
    Thank you for all your response!
    I had changes this work area into Internal table and changed the select query. PLease let me know if this causes any performance issues?
    I had created a Z table with the following fields :
    ZADS :
    MANDT
    VKORG
    ABGRU.
    I had written a select query as below :
    I had removed the select single and insted of using the Structure it_rej, I had changed it into Internal table 
    select vkorg abgru from ZADS into it_rej.
    Earlier :
    IT_REJ is a Work area:
    DATA : BEGIN OF IT_REJ,
    VKORG TYPE VBAK-VKORG,
    ABGRU TYPE VBAP-ABGRU,
    END OF IT_REJ.
    Now :
    DATA : BEGIN OF IT_REJ occurs 0,
    VKORG TYPE VBAK-VKORG,
    ABGRU TYPE VBAP-ABGRU,
    END OF IT_REJ.
    I guess this will fix the issue correct?
    PLease suggest!
    Regards,
    Developer.

  • Problem with Table Function in ver. 8.1.7.0

    Hello,
    I have a Problem using a Table Function in Oracle version 8.1.7.0:
    type TTest_Object is Object
    MSG_TRACKID VARCHAR2(25)
    type TTest_Table is Table of TTest_Object;
    function Test_Function return TTest_Table is
    Result TTest_Table;
    TmpObj TTest_Object := TTest_Object( null );
    begin
    TmpObj.MSG_TRACKID := '00001';
    Result := TTest_Table( TmpObj );
    return(Result);
    end Test_Function;
    when i do:
    declare
    Type TTmpRecord is Record (MSG_TRACKID varchar2(25));
    Type TC is Ref Cursor Return TTmpRecord;
    C1 TC;
    TmpObj VarChar2(25);
    TmpTable TTest_Table;
    begin
    TmpTable := Test_Function;
    open C1 for Select * FROM TABLE(CAST(TmpTable as TTest_Table));
    loop
    fetch C1 into TmpObj;
    exit when C1%notfound;
    DBMS_OUTPUT.PUT_LINE(TmpObj);
    end loop;
    close C1;
    end;
    it works fine!
    but, when i do:
    "Select * From TABLE(CAST(Test_Function as TTest_Table))"
    i get a: "ORA-000904: Invalid Column Name"
    if i do the Select in version 8.1.7.4 it works fine...
    does anyone know a work around in version 8.1.7.0?

    export from a lower version to import in higher ver is ok.
    Please see metalink doc 132904.1 for exp/imp compatiblty matrix.

  • Pipeline Table Function returning a fraction of data

    My current project involves migrating an Oracle database to a new structure based on the new client application requirements. I would like to use pipelined table functions as it seems as though that would provide the best performance.
    The first table has about 65 fields, about 75% of which require some type of recoding for the new app. I have written a function for each transformation and have all of these functions stored in a package. If I do:
    create new_table as select (
    pkg_name.function1(old_field1),
    pkg_name.function2(old_field2),
    pkg_name.function3(old_field3),
    it runs with out any errors but takes about 3 1/2 hours. There are a little more than 10 million rows in the table.
    I wrote a function that is passed the old table as a cursor, runs all the functions for the transformations and then pipes the new row back to the insert statement that called the function. It is incredibly fast but only returns .025% of the data (about 50 rows out of my sample table of 200,000). It does not throw any errors.
    So I am trying to determine what is going on. Perhaps one of my functions has a bug. If there was would cause the row to be kicked out? There are 40 or so functions so tracking this down has been a bit of a bear.
    Any advice as to how I might resolve this would be much appreciated.
    Thanks
    Dan

    . I would like to use pipelined table functions as it seems as though that would provide the best performanceUh huh...
    it runs with out any errors but takes about 3 1/2 hours. There are a little more than 10 million rows in the table.Not the first time a lovely theory has been killed by an ugly fact. Did you do any bench marks to see whether the pipelined functions did offer performance benefits over doing it some other way?
    From the context of your comments I think you are trying to a populate a new table from a single old table. Is this the case? If so I would have thought a straightforward CTAS with normal functions would be more appropriate: pipelined functions are really meant for situations in which one input produced more than one output. Anyway, ifr we are to help you I think you need to give us more details about how this process works and post a sample transformation function.
    There are 40 or so functions so tracking this down has been a bit of a bear.The teaching is: we should code one function and get that working before moving on to the next one. Which might not seem like a helpful thing to say, but the best lesson is often "I'll do it differently next time".
    Cheers, APC

  • Question about Table Function inside a Package

    Hi … I am new in PL/SQL, I am trying to use a table function to create depending on a value passed to it (I am using 10g). Everything works great but the moment I add a parameter everything explode, I am creating it on a package.
    SQL that work
    CREATE OR REPLACE PACKAGE BODY financial_reports AS
    FUNCTION Fund_Amount
    RETURN financial_reports.Fund_Amount_Table
    pipelined parallel_enable IS
    cur_row financial_reports.Fund_Amount_Record;
    BEGIN
    FOR cur_row IN
    SELECT
    to_number(substr(bu5.usrdata, 1, 1)) As SECTION_ID
    ,to_number(substr(bu5.usrdata, 2, 1)) As SUB_SECTION_ID
    ,to_number(substr(bu5.usrdata, 4, 2)) AS LINE_NUMBER
    ,to_number(substr(bu5.usrdata, 7, 2)) As FUND_ID
    ,sum(be.amt) AS AMOUNT
    FROM
    linc.budgetdb_usr5@stjohnsfp bu5
    JOIN linc.budgetdb_event@stjohnsfp be ON
    bu5.keyvalue = be.acctno
    WHERE
    bu5.keyvalue like '__-__-__-____-____-_____'
    AND bu5.usrdata like '__-__-__'
    AND bu5.fieldnum = 1
    AND bu5.ispecname = 'GLMST'
    AND to_number(substr(bu5.usrdata, 7, 2)) = 1
    GROUP BY
    bu5.usrdata
    ORDER BY
    bu5.usrdata
    LOOP
    PIPE ROW(cur_row);
    END LOOP;
    END Fund_Amount;
    END financial_reports;
    SQL that do not work …
    CREATE OR REPLACE PACKAGE BODY financial_reports AS
    FUNCTION Fund_Amount (Fund_Id IN NUMBER)
    RETURN financial_reports.Fund_Amount_Table
    pipelined parallel_enable IS
    cur_row financial_reports.Fund_Amount_Record;
    fund_id_int NUMBER;
    BEGIN
    fund_id_int := Fund_Id;
    FOR cur_row IN
    SELECT
    to_number(substr(bu5.usrdata, 1, 1)) As SECTION_ID
    ,to_number(substr(bu5.usrdata, 2, 1)) As SUB_SECTION_ID
    ,to_number(substr(bu5.usrdata, 4, 2)) AS LINE_NUMBER
    ,to_number(substr(bu5.usrdata, 7, 2)) As FUND_ID
    ,sum(be.amt) AS AMOUNT
    FROM
    linc.budgetdb_usr5@stjohnsfp bu5
    JOIN linc.budgetdb_event@stjohnsfp be ON
    bu5.keyvalue = be.acctno
    WHERE
    bu5.keyvalue like '__-__-__-____-____-_____'
    AND bu5.usrdata like '__-__-__'
    AND bu5.fieldnum = 1
    AND bu5.ispecname = 'GLMST'
    AND to_number(substr(bu5.usrdata, 7, 2)) = fund_id_int
    GROUP BY
    bu5.usrdata
    ORDER BY
    bu5.usrdata
    LOOP
    PIPE ROW(cur_row);
    END LOOP;
    END Fund_Amount;
    END financial_reports;
    Error … (This works without the parameter)
    Error starting at line 43 in command:
    select * from table(financial_reports.Fund_Amount(1) )
    Error at Command Line:1 Column:14
    Error report:
    SQL Error: ORA-22905: cannot access rows from a non-nested table item
    Any help would be greatly appreciated

    try renaming your parameter so as not to confuse with what you are using in your column " to_number(substr(bu5.usrdata, 7, 2)) AS FUND_ID":
    CREATE OR REPLACE PACKAGE BODY financial_reports AS
      FUNCTION Fund_Amount (pFund_Id IN NUMBER)
        RETURN financial_reports.Fund_Amount_Table
        pipelined parallel_enable IS
        cur_row financial_reports.Fund_Amount_Record;
        fund_id_int NUMBER;
      BEGIN
        fund_id_int := pFund_Id;
        FOR cur_row IN ( SELECT to_number(substr(bu5.usrdata, 1, 1)) As SECTION_ID,
                                to_number(substr(bu5.usrdata, 2, 1)) As SUB_SECTION_ID,
                                to_number(substr(bu5.usrdata, 4, 2)) AS LINE_NUMBER,
                                to_number(substr(bu5.usrdata, 7, 2)) As FUND_ID,
                                sum(be.amt) AS AMOUNT
                           FROM linc.budgetdb_usr5@stjohnsfp bu5
                                  JOIN linc.budgetdb_event@stjohnsfp be ON bu5.keyvalue = be.acctno
                          WHERE bu5.keyvalue like '__-__-__-____-____-_____'
                            AND bu5.usrdata like '__-__-__'
                            AND bu5.fieldnum = 1
                            AND bu5.ispecname = 'GLMST'
                            AND to_number(substr(bu5.usrdata, 7, 2)) = fund_id_int
                         GROUP BY bu5.usrdata
                         ORDER BY bu5.usrdata ) LOOP
          PIPE ROW(cur_row);
        END LOOP;
      END Fund_Amount;
    END financial_reports;

  • Usage of TAble Functions in OBIEE

    Hello All,
    I have created a table function in the database.
    Is it possible to use/call table functions in obiee.Please let me know how to use table functions in OBIEE.
    Thanks in advance.

    Hi,
    Thanks for your reply.
    I want to use this table function to generate answers report.
    In the query i am using unions,bind variables.I can not create a database view on this query.The best solution would be creating a table function.
    But,i do not know how to access/use/call this table function to create answers report.
    Thanks in advance.

  • Web Service + Table Function Question

    Hi!
    I've been reading recently an article
    http://www.oracle.com/technology/sample_code/tech/java/jsp/samples/tablefunction/Readme.html
    and i was wondering is there any possibility to do the same thing in apex ?
    There is a need to use the table function.
    Anyone knows how to do it ?
    With regards,
    PsmakR

    PsmakR:
    Unfortunately, the Web service that the particular article you reference is no longer available. There is another weather service that works for US cities by ZIP code:
    http://www.webservicex.net/WeatherForecast.asmx?WSDL
    The way to interact with Web services in Application Express is either to create a reference manually, or to create a reference via a WSDL. You can use the WSDL above to create a form and report on a Web service in Application Express.
    Regards,
    Jason

  • Distributed queries+pipelined table function

    HI friends,
    can i get better performance for distributed queries if i use pipelined table function.I have got my data distribued across three different databases.
    thanx
    somy

    You will need to grant EXECUTE access on the pipelined table function to whatever users want it. When other users call this function, they may need to prefix the schema owner (i.e. <<owner>>.getValue('001') ) unless you've set up the appropriate synonym.
    What version of SQL*Plus do you have on the NT machine?
    Justin
    Distributed Database Consulting, Inc.
    http://www.ddbcinc.com/askDDBC

Maybe you are looking for

  • My iPad Safari keep crashes only at school, My iPad Safari keep crashes only at school

    At school, only at school, my iPad Safari keep crashes. Plz help. And it's iOS 7.1

  • Purchased Music, Can't Download

    I have now purchased two albums in the last two days but can't download the music. I get a message saying check the network connection which makes no sense because I am online with the store already making the purchases. I get the message asking am I

  • BLOB retrieval problem

    I create one function to retrieve PDF file in BLOC column and store the result in UNIX file to be able to see it with ACROBAT. see my function CREATE OR REPLACE FUNCTION GET_PDF_STATEMENT ( p_filename IN VARCHAR2,      p_request_id IN NUMBER )      R

  • A review of Jabra A320s and BT620s on 10.4.6

    Well, I tried the Jabra BT620s Bluetooth wireless headset today in Akihabara, Tokyo. It comes bundled with a small cradle that fits any standard iPod (not Mini, Nano, etc.) and adds BT stereo to the iPod BUT the cradle is NOT a Jabra product. You can

  • QuickTime fails to launch: "Unable to load nib file"

    QuickTime has decided today that it will no longer launch. When I look at the message generated in Console it says: "QuickTime Player[300] Unable to load nib file: MainMenu, exiting" This has been happening since I updated my copy of Fetch. I have tr