parallel in pipeline table function

Hi all

To "allow the parallel pipeline" table function, what I need to turn a query parallel session first?

I read a few white papers or web pages on map and reduce implemented with function table Oracle and see that, based on the table.

Use the cursor in the loop to get a line, run out! This replaces SQL pl/sql.

What is the cost that must be paid according to the table?

Finally, how can I confirm that Oracle has put the table function in parallel?

Best regards

Leon

user12064076 wrote:

In my application, I wrote stored procedures that return a collection of user-not of the types of objects to Java.

Flawed approach using memory expensive private server (PL/SQL PGA) caching SQL data and then push this data to the client - when the customer can use instead the more scalable and higher shared cache buffer memory instead.

With the types of objects, we can remove most of the redundent data.

This statement makes no sense that it is the same for SQL and sliders. And remove redundant data is preferable to the SQL itself - through partitioning engine pruning, predicates, only by selecting the columns there is place for the projection of SQL and so on.

This OO design reduces the load on the network and makes it easy for Java to parse.

Incorrect answer. It does not reduce network load - it can actually increase. Regarding Java 'parsing' - it's wrong from the beginning approach if the customer is required to analyze the data it receives from the server database. The analysis requires time CPU. Many average general processor muscle which will degrade the performance of analysis.

You may be using the analysis out of context here? Find it me hard to believe that one could design an application and use a server database in this way. The analysis of means for example to receive XML data (text) and then he analysis in an object - like structure for use.

Data of the database must be recovered by the customer in a binary structured format and not in a free format that requires the client to analyze in a structured format.

But the problem is that we accumulate all data in memory first and push them to the client as a whole. If it's too huge, ORA-22813 occurs.
This is why I intend to use the table of piplelined function.

How that will solve the problem?

As I followed your logic:
(1) you do not use the cursor for some obscure (and probably completely unjustified) reason.
(2) you may not return large collection PL/SQL variables without significantly dent PGA (process private memory) on the server and running into errors (this approach is conceptually incorrect anyway)
(3) you are now using an array of pipeline that executes PL/SQL code to execute SQL code - and in turn must be executed by the client as a SQL using a slider

So why put all the other moving parts (the pipeline code) between the two when the customer
(a) must use SQL to access?
(b) create a cursor?

If, as you say, I returned a cursor, it would be very difficult for Java organize data.

A table of pipeline must be able to be used through a cursor. All the DML statements from a client by Oracle are analyzed as cursors.

Read the language PL/SQL Oracle® Database reference guide section on ' + chaining Pipelined Table Functions for Multiple Transformation + ".

The format using a pipeline is (from the manual):

SELECT * FROM TABLE(table_function_name(parameter_list))

The "+ pipeline + ' is created by the SQL engine-, he need SQL to execute the PL/SQL code via the function TABLE() SQL.

You said that the reason to use a pipeline transforms a structure of relational data stored in a structure of the object. You don't need a pipeline for it. Plain vanilla SQL can do the same thing, without the fixed costs of use PL/SQ, SQL data recovery and change within the pipeline between PL/SQL and SQL context engines.

You simply call the constructor of the class of object in the projection of SQL and the cursor SQL returning the instantiated objects. For example

create or replace type TEmployee is object(
 .. property definitions ...
);

create or replace type TEmployeeCollection is table of TEmployee;

select
  TEmployee( col1, col2, .., coln ) as EMP_COLLECTION
from emp
where dept_id = :0
and salary > :1
and date_employed >= :2
order by
  salary, date_employed

No need for PL/SQL code. No need for a pipeline. The client will open the cursor and extraction of objects in a collection. The same approach that the customer would have used during extraction of a cursor on a table of pipeline function.

Pipelines are best used as a process of transformation of data where only SQL cannot perform the transformation. I never in many years of design and writing applications used Oracle PL/SQL pipeline into production on a SQL table. Simply because the SQL itself is capable and powerful enough to do the job - and do it faster and better.

I used pipeline is to transform the data from external sources into sets of SQL data. For example, a pipe on a web service. When the code PL/SQL of the constructions of the SOAP envelope, the HTTP call, analyzes the XML and returns the content in form of lines and columns - that allows to run a SQL SELECT on web-service-turned-into-a-SQL-table.

If you'd told me that Leon - it seems to me that your approach is a typical approach to Java that has very little understanding of the concepts of database and Oracle databases. You can't deal with Oracle as a simple persistence layer. You can't treat SQL and PL/SQL as a simple i/o interface for the extraction of data from Oracle and grinding that in Java. Not if you think that your system to run Java and scaling.

Rethink the Oracle layer, use properly - and your application will occur and will scale. Guaranteed.

However, from my experience, many J2EE developers choose to treat the Oracle as a black box, not further that a kind of file system loaded to store structured data and try to do it in the Java layer. And this fail. And I saw him failing - of the jaw dropping kind epic failures (knocking all the national newspapers and media as a result and an impact on ordinary people who have to deal with the Government).

And it's a shame... SQL and PL/SQL are superior to Java in this regard and are the layers much more able to cope and a power of data in the database. Example of the real world - largest table in our busiest database develops between 350 and 450 million lines per day and all our calculations of the data in this table is inside the database layer - and not in a layer of Java. Oracle performs and scales beautifully... when used correctly.

Tags: Database

Similar Questions

  • Pipeline table functions

    I try to use the table double tube function. However, I need help to understand how... I understand, the pipeline table functions do not wait for the function ends and begins to return the data as soon as it gets. The calling program can continue the treatment rather than wait. Does this program calling both functions work in parallel table?

    The calling function must still wait for all of the lines to be processed it just means that it can start to view until all rows are returned. It will not automatically put the function as a kind of stand-alone function that runs in the background lines back.

    Example:

    You may need to return 100,000 rows

    A pipeline function will return 1-5 000 from 5 000 are returned.

    If you are returning a collection but don't not the processing pipeline, it must wait until all the 100,000 lines to collect and send everything at once.

    A useful case of this pagination, or you want a user to see the first rows quickly since 99% of the time they will not be the page of the second series.

  • In Oracle Pipelined Table functions duplicate rows

    Hi fellow oracle users,

    I am trying to create a table function Oracle piplined that contains duplicate records. Whenever I try to run the same record twice, the duplicate does not appears in the resulting table in pipeline.

    Here is a sample of SQL:

    / * Type declarations * /.
    TYPE MY_RECORD IS (RECORD
    MY_NUM INTEGER
    );
    IS OF TYPE THE MY_RECORD TABLE MY_TABLE;


    / * Pipelined function declaration * /.
    FUNCTION MA_FONCTION MY_TABLE RETURN PIPELINE IS
    V_RECORD MY_RECORD;
    BEGIN
    -Insert the first disc
    V_RECORD. MY_NUM = 1;
    COURSE OF ACTION (V_RECORD);

    -Insert the second duplicate record
    V_RECORD. MY_NUM = 1;
    COURSE OF ACTION (V_RECORD);

    -Return piplined table
    RETURN;
    END;

    / * Function in query pipeline declaration * /.
    SELECT * FROM TABLE (MA_FONCTION); -for some reason any that returns only one record instead of two


    I try to get the duplicate line appears in the select statement. Any help would be greatly appreciated.

    Can you provide real SQL output * more guest try this? I do not see the same behavior

    SQL> SELECT * FROM V$VERSION;
    
    BANNER
    ----------------------------------------------------------------
    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
    PL/SQL Release 10.2.0.4.0 - Production
    CORE    10.2.0.4.0      Production
    TNS for 64-bit Windows: Version 10.2.0.4.0 - Production
    NLSRTL Version 10.2.0.4.0 - Production
    
    SQL> CREATE TYPE MY_RECORD IS OBJECT(MY_NUM INTEGER);
      2  /
    
    Type created.
    
    SQL> CREATE TYPE MY_TABLE IS TABLE OF MY_RECORD;
      2  /
    
    Type created.
    
    SQL> CREATE OR REPLACE FUNCTION MY_FUNCTION
      2  RETURN MY_TABLE
      3  PIPELINED
      4          AS
      5                  V_RECORD        MY_RECORD;
      6          BEGIN
      7                  V_RECORD.MY_NUM := 1;
      8                  PIPE ROW(V_RECORD);
      9
     10                  V_RECORD.MY_NUM := 1;
     11                  PIPE ROW(V_RECORD);
     12
     13                  RETURN;
     14          END;
     15  /
    
    Function created.
    
    SQL> SELECT * FROM TABLE(MY_FUNCTION);
    
                  MY_NUM
    --------------------
                       1
                       1
    
  • Select from 2 dimensions collection returned by a pipeline-table-function

    With the help of 10 gr 2

    A pipeline function returns a collection of an object oriented sub-collection:


    TYPE TXT_ARRAYTYPE IS TABLE OF THE VARCHAR2 (2000);

    type txt2dtable_objtype as object)
    txt2dtable txt_arraytype;

    type txt2dtable_arraytype as the txt2dtable_objtype table;


    FUNCTION getTxtList (start_date IN DATE) RETURN PIPELINED txt2dtable_arraytype
    ....



    How can I select from the function for each element varchar2 grouped by line number (the top-level collection) txt2dtable_arraytype?

    Example:

    Text of RowNum
    1 Hello
    1 World
    2 my
    2 name
    2 is
    2 Nuerni!
    3 How
    ....


    A select statement can be used for an external, OIC - / JDBC / follow App would be great!

    Any ideas?

    Kind regards
    Nuerni

    Something like this:

    SQL>create type txt_arraytype is table of varchar2(2000)
      2  /
    
    Type created.
    
    SQL>create type txt2dtable_objtype as object ( txt2dtable txt_arraytype )
      2  /
    
    Type created.
    
    SQL>create type txt2dtable_arraytype as table of txt2dtable_objtype
      2  /
    
    Type created.
    
    SQL>create or replace FUNCTION getTxtList (start_date in date)
      2  return txt2dtable_arraytype pipelined
      3  is
      4  begin
      5    pipe row( txt2dtable_objtype( TXT_ARRAYTYPE( 'Hello', 'World' ) ) );
      6    pipe row( txt2dtable_objtype( TXT_ARRAYTYPE( 'My', 'name', 'is', 'Anton' ) ) );
      7    pipe row( txt2dtable_objtype( TXT_ARRAYTYPE( 'And', 'this', 'is', 'an', 'example' ) ) );
      8    return;
      9  end;
     10  /
    
    Function created.
    
    SQL>
    SQL>select rn, y.column_value
      2  from ( select rownum rn
      3              , object_value
      4         from table( getTxtList( sysdate ) )
      5       ) x
      6     , table( x.object_value.txt2dtable ) y
      7  /
    
            RN COLUMN_VALUE
    ---------- -----------------------------------------------------------------------------------------
             1 Hello
             1 World
             2 My
             2 name
             2 is
             2 Anton
             3 And
             3 this
             3 is
             3 an
             3 example
    
    11 rows selected.
    
    SQL>
    

    Anton

  • Pipeline table function compile (PLS-00222: no function name)

    Hello

    Trying to stuff a call to v$ sql in a function and are unable to compile:
    create or replace package p is
        type s_row is record(sql_id v$sql.sql_id%type
                            ,child_number v$sql.child_number%type                        
                            ,hash_value v$sql.hash_value%type
                            ,address v$sql.address%type
                            ,executions v$sql.executions%type
                            ,sql_text v$sql.sql_text%type);
        type rows_tt is table of s_row;
    
        function vsql 
            (sqltext IN varchar2 DEFAULT '%zz%')
            return rows_tt pipelined;
    end;
    /
    show errors
    
    create or replace package body p is
    
        function vsql 
            (sqltext IN varchar2 DEFAULT '%zz%')
            return rows_tt pipelined
        is 
        begin
            for rec in (select /* recentsql*/ sql_id
                            , child_number
                            , hash_value
                            , address
                            , executions
                            , sql_text
                        from v$sql 
                        where sql_text like sqltext
                          and upper(sql_text) not like upper('%recentsql%'))
                loop
                    pipe row(s_row ( rec.sql_id
                                   , rec.child_number
                                   , rec.hash_value
                                   , rec.address
                                   , rec.executions
                                   , rec.sql_text));
                end loop;
            return;
        end;
    end;
    /
    show errors
    results in
    HR@XE> @vsql
    
    Package created.
    
    No errors.
    
    Warning: Package Body created with compilation errors.
    
    Errors for PACKAGE BODY P:
    
    LINE/COL ERROR
    -------- -----------------------------------------------------------------
    18/17    PL/SQL: Statement ignored
    18/26    PLS-00222: no function with name 'S_ROW' exists in this scope
    HR@XE>
    What I am doing wrong?

    Thank you
    Jason

    Documents have no constructors. Change:

                    pipe row(s_row ( rec.sql_id
                                   , rec.child_number
                                   , rec.hash_value
                                   , rec.address
                                   , rec.executions
                                   , rec.sql_text));
    

    TO:

                    pipe row(rec);
    

    SY.

  • Alternatives to a PIPELINED table function

    I'm writing a piece of code that display student attendance from Monday to Friday for a given date. I provide the code with the date, it determines the dates for the Monday, Tuesday... Friday of the week and then determines the days during the week the student was or was not present. My data includes two tables:

    Students
    -----------
    number of student_id,
    first name varchar2,
    last_name varchar2,
    number of campus_id

    Attendance
    -------------
    number of student_id,
    date of date_of_attendance

    I would like for the release of the tables to be in the following format:

    student_id name | last_name Mon Mar sea game Fri
    -------------------------------------------------------------------------------
    123456 x 0 1 0 1 1
    163452 Unetelle 1 1 1 1 1

    1 is if there is a record in the table of attendance for the student that day and 0 is it does not exist.

    I tried to do this using a function table in pipeline. Whenever I run the query, I get the following error:

    ORA-06552: PL/SQL: analysis of completed Compilation unit
    ORA-06553: PLS-801: internal error [hshuid: READ invalid]
    06552 00000 - "PL/SQL: %s.
    * Cause:
    * Action:
    Error on line: column 14:12

    I'm using Oracle 10gXE and according to support notes 559786.1 it "should" be due to a bug which follows from the definition of type, including a reserved word. I checked and I have all these words in my definition of type. I tried to run the same code in an 11g database and it worked. Unfortunately using 11 g is not an option for this task.

    Anyone can suggest that another way to achieve this?

    You can use a function table.

    See the "Concepts of function Table" section of the RFSO: http://docs.oracle.com/cd/B19306_01/appdev.102/b14289/dcitblfns.htm

    It shows a simple example. You can change your service (remove PIPELINED) to return a collection in bulk or can return the ref cursor).

  • Functions Pipeline Table with other tables using

    I'm on DB 11.2.0.2 and used sparingly in pipeline table functions, but plans to arrays for a project that has a pretty big (many lines). In my tests, selecting from the table in pipeline perform well enough (if it's directly from the table pipleined or the view from above, I have created). Where I start to see some degregation when I try to join the tabe in pipeline discovered at other tables and add where conditions.

    Download

    SELECT A.empno, A.empname, A.job, B.sal

    OF EMP_VIEW A, B OF THE EMP

    WHERE A.empno = B.empno AND

    B.Mgr = '7839'

    I've seen articles and blogs that mention this as a matter of cardinality and offer some undocumented methods to try to fight.

    Can someone please give me some tips or tricks on this. Thank you!

    I created a simple example using the emp table below to help illustrate what I'm doing.

    DROP TYPE EMP_TYPE;

    DROP TYPE EMP_SEQ;

    CREATE OR REPLACE TYPE EMP_SEQ AS OBJECT

    (EMPNO NUMBER (10),)

    ENAME VARCHAR2 (100),

    VARCHAR2 (100)) WORK;

    /

    CREATE OR REPLACE TYPE EMP_TYPE AS TABLE EMP_SEQ;

    /

    FUNCTION to CREATE or REPLACE get_emp back EMP_TYPE PIPELINED AS

    BEGIN

    TO heart (SELECT IN

    EmpNo,

    Ename,

    job

    WCP

    )

    LOOP

    PIPE ROW (EMP_SEQ (cur.empno,

    cur. Ename,

    cur.job));

    END LOOP;

    RETURN;

    END get_emp;

    /

    create or REPLACE view EMP_VIEW select * from table (get_emp ());

    /

    SELECT A.empno, A.empname, A.job, B.sal

    OF EMP_VIEW A, B OF THE EMP

    WHERE A.empno = B.empno AND

    B.Mgr = '7839'

    bobmagan wrote:

    The ability to join would give me the most flexibility.

    Pipelines can be attached. But here is the PL/SQL code - no tables. And without index.

    Consider a view:

    create or replace view sales_personel in select * from emp where job_type = 'SALES '.

    And you use the view to determine the sellers in department 123:

    Select * from sales_personel where dept_id = 123

    Oracle considers that logically the next SQL statement like her can be pushed in the view:

    select * from emp where job_type = 'SALES' and dept_id = 123


    If the two columns in the filter are indexed for example, he may well decide to use a fusion of index to determine what EMP lines are dirty and department 123.

    Now consider the same exact scenario with a pipeline. The internal process of pipelines are opaque to the SQL engine. He can't say the internal code pipeline "Hey, don't give me employees service 123".

    He needs to run the pipeline. It must evaluate each channeled line and apply the "dept_id = 123" predicate. In essence, you must treat the complete pipeline as a table scan. And a slow that it take more than a simple disc lines when you perform the transformation of data too.

    So yes - you can use the predicates on the pipelines, can join them, use analytical SQL and so immediately - but expect it to behave like a table in terms of optimization of SQL/CBO, is not realistic. And pointing to a somewhat flawed understanding of what a pipeline is and how it should be designed and used.

  • Pipelined table vs ref cursor in a function return

    Hi gurus,

    Everybody has discovered that a (subject) is faster on the other? Data will be primarily consumed from an external application (.net). What are the benefits? I can't decide if that use is

    Thank you very much.

    user12868294 wrote:
    Hi gurus,

    Everybody has discovered that a (subject) is faster on the other? Data will be primarily consumed from an external application (.net). What are the benefits? I can't decide if that use is

    Thank you very much.

    They are two different things.

    A pipeline table acts as an array, but you must always choose in it and so if your consumption that in .net, you would still use a Ref Cursor I guess to query this table in pipeline (I guess .net is not query the tables directly, but must use some sort of slider Ref?)

    Tables in pipeline can be fast, but it depends on what you need to. Is there a reason why you really need a feature in pipeline? If this is not the case, just use a normal query with a Ref Cursor, so your .net application only retrieves the data properly.

  • Integrate the Table function in the package

    Hey everybody,

    I had a problem with my table function. I don't have it created in a package as a function table on the database. Now I have to integrate it in my package,

    but it does not work. What I have to put the type and Assembly in the package_spec? I always get the error: "each cursor or subprogramm in the package_spec statement must have a corresponding definition in the package body.

    But I already joined the funtion in the body. Maybe someone can help me? I would be very grateful!

    It's my spec package: (sorry, I don't know how to insert the code in this forum, maybe you can tell me)

    The search_type is declared, but so far not in the package:

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

    create or replace package test is

    TYPE search_set IS TABLE OF THE schema.search_type;

    function search (.)

    Return search_set;

    end test;

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

    create or replace package test body is

    function search (.)

    return search_set

    pipelined is

    ..

    search for late;

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

    create or repplace type search_type as object

    (..);

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

    If I lump the search_type package specifications, it will not accecpt the 'object '.

    It would be great if you can help me! I would also like to update my post I have someone tell me how to integrate the code correctly in this post.

    Many thanks!

    In your message the definition of function in the SPECIFICATION does not PIPELINED keyword, but your BODY plan has it.

  • How to get Nested table function

    Hi friends,

    In a package, I created a nested table type name Varchar2 EmployeeCodeList.

    Then, I created a function whose return type is EmployeeCodeList. But I don't get how to get the values of this function?

    TYPE EmployeeCodeList IS TABLE OF THE VARCHAR2 (30);

    FUNCTION GenerateRandomEcF (Ec_length NUMBER, NumberOfEmp NUMBER)

    < < the function code > >

    RETURN v_RandomEmpCodes;

    END GenerateRandomEcF;

    PROCEDURE GenerateEmpFile (NumberOfEmp NUMBER, Start_SN NUMBER, EmpValue NUMBER, VARCHAR2, VARCHAR2, Ec_length NUMBER EmpGroup HireDate) IS

    v_Filename VARCHAR2 (40);

    v_EmployeeCodes EmployeeCodeList;

    v_EmpBatchF UTL_FILE. TYPE_DE_FICHIER;

    BEGIN

    v_Filename: = 'EMPLOYEE_BATCH_ ' | TO_CHAR (SYSTIMESTAMP, 'YYYYMMDD_HHMISS'): '. DAT';

    v_EmployeeCodes: = EmployeeCodeList (NumberOfEmp);

    v_EmployeeCodes: = SELECT * FROM TABLE (GenerateRandomAcF (Ac_length, NumberOfVoucher));

    v_EmpBatchF: = UTL_FILE. FOPEN ('EXT_VOUCHER_DIR', v_Filename, 'W');

    IF UTL_FILE.IS_OPEN (v_EmpBatchF) THEN

    FOR i IN 1.NumberOfVoucher LOOP

    UTL_FILE. Put_line (v_EmpBatchF, v_EmployeeCodes (i) |) ',' || Start_SN + (i-1). «, » || EmpValue | «, » || HireDate. «, » || EmpGroup);

    END LOOP;

    END IF;

    END GenerateEmpFile;

    How the line highlighted code above must be written so that I can get value of function in a variable of the same type of nested table.

    If you use the second approach, I mean

    56 v_EmployeeCodes: = GenerateRandomAcF (Ac_length, NumberOfEmployee);

    then the collection must be initialized using the constructor method. Change line 33.48 as number below

    33 v_RandomEmployeeCodes EmployeeCodeList: = EmployeeCodeList();

    48 v_EmployeeCodes EmployeeCodeList: = EmployeeCodeList();

    This is because when you use BULK COLLECT, Oracle automatically populates the collection without initialization. But if you do not COLLECT in BULK, then the collection must be initialized before filling / extending. Otherwise, you will get error of REFERENCE to the COLLECTION that is not INITIALIZED. So this should be the code, you should use. When you do not select... INTO, you might well declare the function is private and it is not necessary to declare in the package specification.

    SQL > CREATE OR REPLACE PACKAGE BODY GenerateEmployeePackage AS

    2 PROCEDURE Get_AC_Range (Ac_length NUMBER, Range_Start SERIES, certain Range_End NUMBER)

    3 EAST

    4 BEGIN

    5 If Ac_length = 8 THEN

    6 Range_Start: = 10000000;

    7 Range_End: = 99999999;

    8 Ac_length ELSIF = 9 THEN

    9 Range_Start: = 100000000;

    10 Range_End: = 999999999;

    11 Ac_length ELSIF = 10 THEN

    12 Range_Start: = 1000000000;

    13 Range_End: = 9999999999;

    14 Ac_length ELSIF = 11 THEN

    15 Range_Start: = 10000000000;

    16 Range_End: = 99999999999;

    17 ELSIF Ac_length = 12 THEN

    18 Range_Start: = 100000000000;

    19 Range_End: = 999999999999;

    20 Ac_length ELSIF = 13 THEN

    21 Range_Start: = 1000000000000;

    22 Range_End: = 9999999999999;

    23 Ac_length ELSIF = 14 THEN

    24 Range_Start: = 10000000000000;

    25 Range_End: = 99999999999999;

    26 END IF;

    27 END Get_AC_Range;

    28

    GenerateRandomAcF FUNCTION 29 (Ac_length NUMBER, NumberOfEmployee NUMBER)

    30 BACK IS EmployeeCodeList

    31 NUMBER Range_Start;

    32 Range_End NUMBER;

    33 v_RandomEmployeeCodes EmployeeCodeList: = EmployeeCodeList ();

    BEGIN 34

    35 Get_AC_Range (Ac_length, Range_Start, Range_End);

    36 v_RandomEmployeeCodes.extend (NumberOfEmployee);

    37

    38 FOR I IN 1.NumberOfEmployee LOOP

    39 v_RandomEmployeeCodes (i): = TRUNC (DBMS_RANDOM.value (down-online Range_Start, high-online Range_End));

    40 END LOOP;

    41

    42 v_RandomEmployeeCodes RETURN;

    43

    END 44 GenerateRandomAcF;

    45

    GenerateEmployeeFile PROCEDURE 46 (NumberOfEmployee NUMBER of Start_SN NUMBER, EmployeeValue NUMBER, displayed EmployeeGroup VARCHAR2, VARCHAR2, Ac_length NUMBER) IS

    47 v_Filename VARCHAR2 (40);

    48 v_EmployeeCodes EmployeeCodeList: = EmployeeCodeList ();

    49 v_EmployeeBatchF UTL_FILE. TYPE_DE_FICHIER;

    BEGIN 50

    51 v_Filename: = 'Employee_BATCH_ ' | TO_CHAR (SYSTIMESTAMP, 'YYYYMMDD_HHMISS'): '. DAT';

    52 v_EmployeeCodes: = EmployeeCodeList();

    53

    54 get nested table function

    55 - SELECT * COLLECT in BULK IN TABLE v_EmployeeCodes (GenerateRandomAcF (Ac_length, NumberOfEmployee));

    56 v_EmployeeCodes: = GenerateRandomAcF (Ac_length, NumberOfEmployee);

    57 v_EmployeeBatchF: = UTL_FILE. FOPEN ('EXT_Employee_DIR', v_Filename, 'W');

    58

    59 if UTL_FILE.IS_OPEN (v_EmployeeBatchF) THEN

    60. FOR i IN v_EmployeeCodes.FIRST... v_EmployeeCodes.Last LOOP

    UTL_FILE 61. Put_line (v_EmployeeBatchF, v_EmployeeCodes (i) |) ',' || (Start_SN + (i-1)). «, » || EmployeeValue | «, » || Posted | «, » || EmployeeGroup);

    LOOP END 62;

    63 END IF;

    64

    END 65 GenerateEmployeeFile;

    66

    END 67 GenerateEmployeePackage;

    68.

  • Oracle Table function

    I want to extract certain age using the TABLE function.
    declare
    type is rendered
    (
    name varchar2 (20).
    sex varchar2 (10),
    number (5) age
    );

    type emp_table is table of SheikYerbouti;

    var emp_table: = emp_table();

    number of l_age;
    Start

    var.extend;
    var (1) .name: = "test1";
    var (1) .sex: = 'male ';
    var (1) .age: = 19;

    var.extend;
    var (2) .name: = "test2."
    (2) var .sex: = 'female ';
    var (2) .age: = 20;

    Select age
    IN l_age
    table (var)
    where var.name = "test1";

    dbms_output.put_line (l_age);
    end;

    I was expection here.

    Can you help me solve this problem.

    Thank you!

    Local types are not allowed in the SQL statement. This means that you said

    type emp_rec is record
    (
    name varchar2(20),
    *** varchar2(10),
    age number(5)
    );
    
    type emp_table is table of emp_rec;
    

    locally. Instead the defined in the database.

  • Display with the Table function in pipeline object

    I try to use a read only View object with a pipeline function table which takes in and defined by the user returns the objects. I work with an OraclePreparedStatement, but want to use a view object.

    This is the query:
    SELECT test_pkg.test_function(?,?) FROM DUAL;

    How can I configure the input parameters of the View object? The only method I can find available is setWhereClauseParam, but there is no where clause.
    Is it possible to use an object view in this situation?

    Any help is greatly appreciated. Thank you.
    S

    This can be done very easily. The query of your view object should be:

    SELECT *
      FROM TABLE(test_pkg.test_function(:bind1, :bind2))
    

    Then create variable bind for both parameters.
    You will set the bind variable in the same way that you define bind variables for any other question.

    Published by: jflack on April 9, 2013 16:28

  • Debug the 'Table function'

    Hello

    This question might be already on the forum, but I couldn't find anything about him.

    My question is: how to debug the service table.

    For example I have function in package

    Function Get_States (P_Parameter_1 In Number , P_Parameter_2 In Number ) Return Collection_type Pipelined ;
    

    And inside the function that I have piping line algorithms say some calculations. When I try to debug, it gives me error.

    Sql_Error.PNG

    Please guide me how to debug this function.

    Here, I found the solution.

    When I start debugging. It shows like this.

    So I just change

    DECLARE
      P_OWNER VARCHAR2(200);
      v_Return BIAS.DEBUG_TEST_PKG.T_PIPEROW;
    BEGIN
      P_OWNER := NULL;
    
        SELECT *
               bulk collect into v_Return
      FROM TABLE(DEBUG_TEST_PKG.DEBUG_PIPELINED_FUNCTION(
        P_OWNER
      ));
      /* Legacy output:
    DBMS_OUTPUT.PUT_LINE('v_Return = ' || v_Return);
    */
      --:v_Return := v_Return;
    --rollback;
    END;
    

    But before that, I noticed a few points.

    1 - whenever I update to the new version, I simply import preferences from the previous version (but this time, I DID NOT import. just do fresh install and configure the debugger on step.). I don't know but this import was somehow me gives error.

    2. just after the creation of new features in the package, it is not in the list of choices debugging functions, so I restart SQL developer.

    Thank you.

  • Why Table function is not allowed on the collections defined in PLSQL?

    We all know that we can use the function table on collections defined as database object type. Why cant Oracle provide this function for defined collections in PLSQL?

    For prior 12c version you can play around with pipelined functions.
    
    SQL> create or replace package emppkg
      2  as
      3    type rec is record (empno integer, ename varchar2(100));
      4    type tbl is table of rec;
      5
      6    function get (pdeptno in integer) return tbl pipelined;
      7  end;
      8  /
    
    Package created.
    
    SQL> show err
    No errors.
    SQL> create or replace package body emppkg
      2  as
      3    function get (pdeptno in integer) return tbl pipelined
      4    is
      5       lrec rec;
      6    begin
      7       for i in (select empno, ename from emp where deptno = pdeptno)
      8       loop
      9          lrec.empno := i.empno;
     10          lrec.ename := i.ename;
     11          pipe row(lrec);
     12       end loop;
     13
     14       return;
     15    end;
     16  end;
     17  /
    
    Package body created.
    
    SQL> show err
    No errors.
    SQL> select * from table(emppkg.get(10));
    
         EMPNO ENAME
    ---------- --------------------
          7782 CLARK
          7839 KING
    
    SQL> select * from table(emppkg.get(20));
    
         EMPNO ENAME
    ---------- --------------------
          7369 SMITH
          7566 JONES
          7788 SCOTT
          7876 ADAMS
    
    SQL> select * from table(emppkg.get(30));
    
         EMPNO ENAME
    ---------- --------------------
          7499 ALLEN
          7521 WARD
          7654 MARTIN
          7698 BLAKE
          7844 TURNER
    
    SQL>
    
  • Returns the Collection using the table function

    Hello

    I'm trying to return a collection with registration type using the function table but face some problems.

    Could someone help me with this.
    SUNNY@11gR1> create or replace package test_pack as
      2  type rec_typ is record (
      3  empname varchar2(30),
      4  empage number(2),
      5  empsal number(10));
      6  type nest_typ is table of rec_typ;
      7  function list_emp return nest_typ;
      8  end;
      9  /
    
    Package created.
    
    Elapsed: 00:00:00.01
    SUNNY@11gR1> create or replace package body test_pack is
      2  function list_emp return nest_typ is
      3  nest_var nest_typ := nest_typ();
      4  begin
      5  nest_var.extend;
      6  nest_var(nest_var.last).empname := 'KING';
      7  nest_var(nest_var.last).empage := 25;
      8  nest_var(nest_var.last).empsal := 2500;
      9  nest_var.extend;
     10  nest_var(nest_var.last).empname := 'SCOTT';
     11  nest_var(nest_var.last).empage := 22;
     12  nest_var(nest_var.last).empsal := 3500;
     13  nest_var.extend;
     14  nest_var(nest_var.last).empname := 'BLAKE';
     15  nest_var(nest_var.last).empage := 1;
     16  return nest_var;
     17  end;
     18  end;
     19  /
    
    Package body created.
    
    Elapsed: 00:00:00.01
    SUNNY@11gR1> select * from table(test_pack.list_emp);
    select * from table(test_pack.list_emp)
                        *
    ERROR at line 1:
    ORA-00902: invalid datatype
    
    
    Elapsed: 00:00:00.01
    SUNNY@11gR1>
    Kind regards
    Sunny

    Hello

    I had to look, because I didn't know the difference. If you use a function in the pipeline, then Oracle will create the implicit type. Take a look at the types:

    select object_name from user_objects where object_type ='TYPE';
    

    There are now objects that you create yourself, having PLSQL in name.

    If you try your first example, you will see it will be no object created by implicit Oracle, so you must declare yourself in SQL.

    Herald tiomela
    Superconsult.nl

Maybe you are looking for

  • Notebook_02.PNG opens automatically when I connect

    Hello When I log on my Mac (13 inch Retina, early 2015, OS 10.11.4) I suddenly noticed a pensionable PNG image. I traced this PNG in some old files of Application Support iWork 09 under/Library/ApplicationSupport/iWork09 I deleted then. The file is a

  • Saudi Arabia supports face time app! If I bought my camera from here!

    Saudi Arabia supports face time app! If I bought my camera from here! I phone 6 s more!

  • Backflip: A lot of "alerts", but the phone does not appear what it is me for alert

    I hope I'm doing this right. kind of a beginner on this site, and they seem to have specific rules for the first assignments. In any case, maybe I shouldn't have gotten the Backflip. After a few days, updates to the facebook got tedious. I'm not real

  • Card slot SIM on the G1 to 820/840 EliteBook

    Hey there! This is my first post here, so bear with me We recently swapped our EliteBook 8470 p and 2170p who had his slot for sim card behind the battery for use with add-on unit high mobile flow (at least if I remember correctly for the p 2170). Bu

  • WindowsUpdate_80071A91

    I have a problem with my updates I got 8 important updates and 31 in option I get the same massage for 3 reviews on my computer "error found code 80071A 91 windows update has encountered an error unknown. I have windows vista Home premium 32-bit