ORA-22907: invalid CAST to a type that is not a nested table or VARRAY. Typed collection function

Hello

I tried to create a function that might return the type that is created on the outside.

So I wrote script below. until the function created it compiled successfully, but after that, when the data querying, we encountered error,

"ORA-22907: invalid CAST to a type that is not a nested table or VARRAY.

SQL> create table emp
  2  (
  3    ename        varchar2(200 byte),
  4    mgr          number,
  5    employee_id  number
  6  );


Table created.


SQL> insert into emp (ename, mgr, employee_id)
  2       values ('king', 12, 1);


1 row created.


SQL> insert into emp (ename, mgr, employee_id)
  2       values ('clark', 12, 2);


1 row created.


SQL> commit;


Commit complete.


SQL> create or replace type t_emp as object (ename varchar2 (200), mgr number, employee_id number);
  2  /


Type created.


SQL> create or replace function f_emp return  t_emp
  2   is
  3  type rc_emp is ref cursor;
  4  r_emp rc_emp;
  5  v_emp t_emp;
  6  begin
  7   open r_emp for select * from emp where rownum=1;
  8   fetch r_emp into v_emp;
  9  close r_emp;
 10  return v_emp;
 11  exception
 12      when others then
 13      dbms_output.put_line(dbms_utility.format_error_stack);
 14      dbms_output.put_line(dbms_utility.format_call_stack);
 15      dbms_output.put_line(dbms_utility.format_error_backtrace);
 16      raise_application_error(-20001,sqlerrm);
 17  end;
 18  /


Function created.


SQL> show errors;
No errors.
SQL> select * from f_emp;
select * from f_emp
              *
ERROR at line 1:
ORA-04044: procedure, function, package, or type is not allowed here




SQL> select * from table(cast (f_emp as t_emp));
select * from table(cast (f_emp as t_emp))
                          *
ERROR at line 1:
ORA-22907: invalid CAST to a type that is not a nested table or VARRAY




SQL>

Like this:

...

CREATE or REPLACE TYPE t_emp_array IS TABLE OF THE t_emp;

/

FUNCTION to CREATE or REPLACE f_emp RETURN t_emp_array

is

type rc_emp is ref cursor;

r_emp rc_emp;

v_emp_array t_emp_array: = t_emp_array();

BEGIN

R_emp OPEN for SELECT t_emp(ename,mgr,employee_id) FROM emp WHERE ROWNUM = 1;

collect the fetch r_emp in bulk in v_emp_array;

CLOSE R_emp;

Return v_emp_array;

exception

while others then

dbms_output.put_line (dbms_utility.format_error_stack);

dbms_output.put_line (dbms_utility.format_call_stack);

dbms_output.put_line (dbms_utility.format_error_backtrace);

raise_application_error (-20001, SQLERRM);

end;

/

SELECT *.

table (f_emp ());

a table function works with a table (nested table or varray)

HTH

Tags: Database

Similar Questions

  • All mounting options "link invalid brother" and a player that will not go up?

    I'm doing some repairs on a MBPro (machine girl) who was running El Capitan (10.11). I started upward in OS X Recovery mode, but disk utility fails because the drive does not appear. I also tried the Warrior Disk and got a similar error (2351, 5:4112 is the DW code gave me). In THE DISC is "grayed out", which I suppose means it is not mounted.

    All the options for data recovery on the drive that will not go up? There is no return from this machine. I am computer scientist of family and I can't tell you how many times I say "run a backup" or "did you make a backup? I should probably start taking laptops and my family do.

    I booted in single user Mode and run ' fsck - fy ' but I don't get "the Macintosh HD volume cannot be repaired." and above that the outlet says: "the brother link invalid.

    All of the suggestions. I'll send my daughter in the Genius Bar with her laptop and see if they have all the options before you go ahead and delete it.

    See you soon,.
    Dave

    How old is the MBP? It is possible to have a HD failure.

  • What is the preferred means of data transmission as a type of record between the nested table of pl/sql program or an associative array

    What is the preferred means of data transmission in the associative array of the nested table record vs

    Choose between Nested Tables and associative arrays

    The two nested tables and associative arrays (formerly index - by tables) use similar index notation, but they have different characteristics when it comes to persistence and ease of passing parameters.

    Nested tables can be stored in a column of data, but can of associative arrays. Nested tables can simplify the SQL operations where you would normally join a single-column table with a larger table.

    Associative arrays are appropriate for relatively small lookup tables where the collection can be constructed in memory whenever a procedure is called or a package is initialized. They are good for the collection of the information volume is unknown beforehand, because there is no fixed limit on their size. Their index values are more flexible, as associative array indices can be negative, can be no sequential and can use values of string instead of numbers.

    PL/SQL automatically converts between the bays of the host and the associative arrays that use values of digital keys. The most effective way to move the collections to and from the database server is to implement data values in associative arrays, and then use these associative arrays with erections in bulk (the FORALL statement or BULK COLLECT clause).

    With the help of documents and Collections of PL/SQL

    Read this:

    How to pass the record set as a parameter of the procedure.

    https://community.Oracle.com/thread/2375173?TSTART=0

  • The columns appear in the data store that are not in the table

    Hi guru,.

    I have a table that I built in Oracle and added to ODI by refactoring it, but when I add it as a source to my interface, it contains columns that are not physically in the Oracle table that I can look into a TOAD. I dropped the prior of the table deleted-> interface-> reverse engineering table but I get an additional column. Y at - it an explanation for that? I have the table listed in a stored procedure - should I delete this step as well before reverse engineering, or is something else.

    Thanks in advance.

    Mike

    Yes. There is a possible explanation. How do you are engineering it? If you use Oracle RKM, you may be using a customized version of this KM which adds a column of your table name...

  • RoboHelp 2015: Several output types that are not available when you open the project created with RH9

    I recently upgraded from RoboHelp 9 in RoboHelp 2015, and I have installed all updates. I use WebHelp output for most of my projects. I would like to use the new features of HR 2015, specifically the release of HTML5 sensitive; However, when I open a project created with RH9, this type of output is not available. This type of output, and many others is not listed as options can I choose from eBook including HTML5 Multiscreen, and others. I tried to create a new project with HR 2015, and import my RH9 project files, but the sensitive HTML5 output and others remained unavailable. Are there settings I can change into my existing project or HR 2015 in order to use these features and new types of output? Recreate all the subjects in HR 2015 seems to be a very undesirable solution.

    Operating system: Windows 7, 64 bit

    Right click on the pod output and select new.  All options will be listed.

  • best way to get documents that are NOT in another table

    I have two large tables in oracle. An array of account that has millions of rows. Each account can be registered in a particular program and can therefore also to the Enrollment table, also with millions of rows. I am to find the most optimal way to find all accounts into ACCOUNT which are NOT in the Enrollment table.

    I did something like this:

    Select / * + index (ACCOUNT idx_acct_no) * /.
    a.Acct_No
    one account
    If a.acct_no not in (Select e.acct_no from e REGISTRATION);


    It takes a long time to run, even though I'm using the index.

    I even tried to use the PK on the ACCOUNT dashboard, as is a FK on the ENROLLMENT table as such:

    Select a.acct_no
    one account
    Where a.id not in (Select e.id of e REGISTRATION);

    too, it takes too much time to recover (if any).

    Is there a better way to make this choice please?

    +
    Try this:

    SELECT a.acct_no
      FROM ACCOUNT a
     WHERE NOT EXISTS (SELECT '?'
                         FROM ENROLLMENT e
                        WHERE e.acct_no = a.acct_no);
    

    : p

  • ORA-20507: invalid numeric value

    Hi all
    I implement this excellent example: http://apex.oracle.com/pls/otn/f?p=48254:2:965943842947140:NO:P2_EMPNO:7369 #.
    I am able to call the PopUp page and create the new value for the element. "My data is also backed up in my form Page, but I get a ' ORA-20507: invalid numeric value ' error message. Once, I check the table that the record has been inserted, but the error message continues to be displayed.
    I saw the Forum and many State of discussions that it is a "to_number" which must be added to the logic in the application process. I tried this and have also tried logic V ("") for the Page element in the process of application, but without success. If anyone knows how to fix this your help is really needed, thanks.

    Hi Charles,

    The example of the 'new town' was based on the assumption that the city would be the value stored on the table rather than a foreign key.

    I've updated your process to get the ID for the new item and pass back to the home page:

    DECLARE
     vCOUNT NUMBER;
     vID NUMBER;
    BEGIN
     IF :G_CLASS_NAME IS NOT NULL THEN
      SELECT COUNT(*) INTO vCOUNT FROM HRT_CLASS_NAME WHERE CLASS_NAME = :G_CLASS_NAME;
      IF vCOUNT = 0 THEN
       INSERT INTO HRT_CLASS_NAME (CLASS_NAME) VALUES (:G_CLASS_NAME);
      END IF;
      SELECT PK_CLASS_NAME_ID INTO vID
       FROM HRT_CLASS_NAME WHERE CLASS_NAME = :G_CLASS_NAME;
      HTP.PRN(vID);
     END IF;
    END;
    

    (Note that I had a lot of problems to actually make a value - the definition of the table displays the fields with a type of NUMBER(*,0) - I think that this should be just NUMBER - you might want to change these, I've updated PK_CLASS_NAME_ID)

    The PTH. PRN (vID) line passes the PK of the folder to the javascript function call that past on it (the "ret" in the code value) return to the homepage and the new classname:

    function saveClassName()
    {
      var classname = document.getElementById('P3_CLASS_NAME').value;
     if (classname == '')
     {
      alert('You must enter in a name');
      return false;
     }
     else
     {
      var get = new htmldb_Get(null,$v('pFlowId'), 'APPLICATION_PROCESS=CREATE_CLASS_NAME',3);
      get.add('G_CLASS_NAME',classname);
      ret = get.get();
      opener.updateClassNameList(ret, classname);
      get = null;
      close();
     }
    }
    

    The function updateClassNameList on the homepage just must then use to create the list, select an option:

    function updateClassNameList(newid, newclassname)
    {
     var classnamelist = document.getElementById('P2_FK_CLASS_NAME_ID');
     appendToSelect(classnamelist, newid, newclassname);
     classnamelist.selectedIndex = classnamelist.options.length - 1;
    }
    

    Andy

  • SQL * Loader - rejected records - error on table ORA-01722: invalid number

    Get the following errors:

    Please tell me where I'm wrong?
    The log file and extracts the data file with the control file is attached.
    Also guide me please how I can download 4900 files at once?

    -------------------------------------
    SQL * Loader: release 11.1.0.7.0 - Production on Fri 14 Oct 03:06:06 2011

    Copyright (c) 1982, 2007, Oracle. All rights reserved.

    Control file: sample.ctl
    Data file: Cities.csv
    Bad leadership: Cities.bad
    Discard File: none is specified

    (Allow all releases)

    Number of loading: ALL
    Number of jump: 0
    Authorized errors: 50
    Link table: 64 lines, maximum of 256000 bytes
    Continuation of the debate: none is specified
    Path used: classics

    Table CITY, loaded from every logical record.
    Insert the option in effect for this table: INSERT

    Column Position Len term Encl. Datatype name
    ------------------------------ ---------- ----- ---- ---- ---------------------
    FIRST ID *, CHARACTER
    35. ACCORDING TO NAME, ' CHARACTER
    COUNTRYCODE 3, ' CHARACTER
    THE NEXT POPULATION * CHARACTER WHT

    Sheet 1: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Sheet 2: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Sheet 3: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Folder 4: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Sheet 5: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Sheet 6: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Sheet 7: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Sheet 8: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    File 9: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Case 10: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Factsheet 11: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Sheet 12: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    File 13: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Fact sheet 14: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Fact sheet 15: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Sheet 16: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    File 17: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Sheet 18: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    File 19: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Sheet 20: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Sheet 21: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Account 22: rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Sheet 23: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Record number of 24: rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Sheet 25: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Fact sheet 26: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Fact sheet 27: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Record 28: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Record 29: rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Record 30: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Record of 31: rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    • Statement 32: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Record 33: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Page 34: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Record 35: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Record 36: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Record 37: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Record 38: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Sheet 39: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Record 40: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Sheet 41: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Page 42: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Record 43: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Sheet 44: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Record 45: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    • Statement 46: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Record 47: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Record 48: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Record 49: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Page 50: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Record 51: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number


    NUMBER of MAXIMUM ERRORS EXCEEDED - above the statistics reflect partial performance.

    CITY table:
    0 rows successfully loaded.
    51 lines not filled due to data errors.
    0 rows not loading because all WHEN clauses were failed.
    0 rows not populated because all fields are null.


    The space allocated to bind table: 35840 bytes (64 lines)
    Bytes of read buffer: 1048576

    Total logical records ignored: 0
    Total logical records read: 64
    Total rejected logical records: 51
    Total logical records ignored: 0

    Run started on Fri 14 Oct 03:06:06 2011
    Run finished Fri Oct 14 03:06:12 2011

    Time was: 00:00:06.18
    Time processor was: 00:00:00.03



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

    my control file (sample.ctl):

    Load data infile 'Cities.csv '.
    in the town of table
    fields completed by «,»
    (external id integer,
    char (35) name box by ' ', '
    CountryCode tank (3) box by ' ', '
    external population integer terminated by '\n '.
    )

    my data (Cities.csv) file (it contains 4900 documents, but I show here just 4 records for ease)

    3830, "Virginia Beach", "USA", 425257
    3831, 'Atlanta', 'USA', 416474
    3832, "Sacramento", "USA", 407018
    3833, 'Oakland', 'USA', 399484


    Thanks in advance!

    Watch when I have a little change your database as follows

    1,'Kabul','AFG',1780000
    2,'Qandahar','AFG','237500'
    3,'Herat','AFG','186800'  
    

    I got the same error (last 2 rows rejected for the same number invalid error)

    mhouri > select * from cities;
    
            ID NAME                                COU POPULATION
    ---------- ----------------------------------- --- ----------
             1 Kabul                               AFG    1780000
    
    SQL*Loader: Release 10.2.0.3.0 - Production on Fri Oct 14 10:38:06 2011
    
    Copyright (c) 1982, 2005, Oracle.  All rights reserved.
    
    Control File:   cities.ctl
    Data File:      cities.dat
      Bad File:     cities.bad
      Discard File:  none specified
    
     (Allow all discards)
    
    Number to load: ALL
    Number to skip: 0
    Errors allowed: 50
    Bind array:     64 rows, maximum of 256000 bytes
    Continuation:    none specified
    Path used:      Conventional
    
    Table CITIES, loaded from every logical record.
    Insert option in effect for this table: INSERT
    
       Column Name                  Position   Len  Term Encl Datatype
    ------------------------------ ---------- ----- ---- ---- ---------------------
    ID                                  FIRST     *   ,       CHARACTER
    NAME                                 NEXT    35   ,    '  CHARACTER
    COUNTRYCODE                          NEXT     3   ,    '  CHARACTER
    POPULATION                           NEXT     *  WHT      CHARACTER            
    
    Record 4: Rejected - Error on table CITIES, column ID.
    Column not found before end of logical record (use TRAILING NULLCOLS)
    Record 2: Rejected - Error on table CITIES, column POPULATION.
    ORA-01722: invalid number
    
    Record 3: Rejected - Error on table CITIES, column POPULATION.
    ORA-01722: invalid number
    
    Table CITIES:
      1 Row successfully loaded.
      3 Rows not loaded due to data errors.
      0 Rows not loaded because all WHEN clauses were failed.
      0 Rows not loaded because all fields were null.
    
    Space allocated for bind array:                  35840 bytes(64 rows)
    Read   buffer bytes: 1048576
    
    Total logical records skipped:          0
    Total logical records read:             4
    Total logical records rejected:         3
    Total logical records discarded:        0
    
    Run began on Fri Oct 14 10:38:06 2011
    Run ended on Fri Oct 14 10:38:06 2011
    
    Elapsed time was:     00:00:00.23
    CPU time was:         00:00:00.09
    

    Value of the population within the data file must be a number

    Best regards

    Mohamed Houri

  • compare the data and the output data that do not exist

    Hello
    I've written a procedure to insert data into a table 3 where I compare the data between two tables, if it matches it insert in the table test_a Joanie. If the exists not or other tables i.e. test_code and test_type it should output this data, where there is no. my code works for a single table, which is test_code. It's not DBMS display a line that is not in the table test_type. could just tell my why? Assume that if test_code a line which is only not in test_type it should out saying this line of incompatibilities with test_type and vice versa.

    -Here's my code

    Test of CREATE OR REPLACE PROCEDURE. GET_data
    IS

    BEGIN
    DELETE test.test_a;
    FOR c IN (select a.cCODE,
    a.type,
    a.Indicator,
    RTrim (xmlagg (xmlelement (e, a.codenum |))) (') a.codenum order) .extract ('/ / text()'), ',') codeNUMber.
    b.CCODE cc,
    b.type tp,
    b.Indicator ind
    test.test_code a, test.test_type b
    where a.ccode = b.ccode (+)
    AND a.type = b.type (+)
    AND a.indicator = b.indicator (+)
    Group of a.ccode, a.type, a.indicator, b.CCODE, b.type, b.indicator
    order of a.ccode)
    LOOP
    BEGIN
    IF (c.cCODE = C.c.c.
    AND C.type = C.tp
    AND C.indicator = C.ind
    AND C.SYS_IND = C.SYSIND) THEN
    insert into test.test_a (CCODE, type indicator)
    values (C.cCODE, C.type, C.indicator);
    ON THE OTHER
    dbms_output.put_line (' rules for cCODE issue: ' |) C.cCODE);
    dbms_output.put_line ('type: ' |) C.type);
    dbms_output.put_line (' indicator: ' |) C.Indicator);
    dbms_output.put_line (' problem of rules for CC: ' |) C.C.C.) ;
    dbms_output.put_line ('tp: ' |) C.TP);
    dbms_output.put_line ('ind: ' |) C.IND);
    END IF;
    EXCEPTION
    WHILE OTHERS THEN
    dbms_output.put_line (' rules for cCODE issue: ' |) C.cCODE);
    dbms_output.put_line ('type: ' |) C.type);
    dbms_output.put_line (' indicator: ' |) C.Indicator);
    dbms_output.put_line (' problem of rules for CC: ' |) C.C.C.) ;
    dbms_output.put_line ('tp: ' |) C.TP);
    dbms_output.put_line ('ind: ' |) C.IND);
    END;
    end loop;
    commit;
    END;
    /


    Thank you

    You must use a FULL OUTER JOIN instead an OUTER JOIN for this.

    Just curious, why do you need to use dbms_output instead to execute the SQL query with additional conditions (if part of your procedure)?. You can use two times, one to insert those that match and one for the selection of others who do not match.

    Kind regards.

  • ORA-00902: invalid data type

    Hello
    What is the problem with my NUMBER data type:
    SQL> create table sale (purchase-no NUMBER (9) CONSTRAINT sale-purchase-no-pk PR
    IMARY KEY , costumer-id NUMBER (9) CONSTRAINT sale-customer-id-nk NOT NULL);
    create table sale (purchase-no NUMBER (9) CONSTRAINT sale-purchase-no-pk PRIMARY
     KEY , costumer-id NUMBER (9) CONSTRAINT sale-customer-id-nk NOT NULL)
                               *
    ERROR at line 1:
    ORA-00902: invalid datatype
    Thank you.

    Your column and constraint names have traits that are not allowed in the names of identifiers.

    Try using instead underscore traits.

  • table font PL/SQL: ORA-00902: invalid data type

    I m is

    PL/SQL: ORA-00902: invalid data type

    error in


    OPEN FOR PPymtCur
    SELECT *.
    TABLE (CAST (up_gap_tra_reports.myArray AS traArray));

    in my up_gap_tra_reports package.

    CREATE OR REPLACE PACKAGE GAPSDVEL.up_gap_tra_reports
    AS

    TraRecord RECORD TYPE IS
    (
    group1StudEnrol NUMBER (6.1).
    group2StudEnrol NUMBER (6.1).
    pymtAmt gap_payment.NET_AMT%TYPE
    );


    TYPE traArray IS TABLE OF THE traRecord;
    myArray traArray: = traArray();

    END up_gap_tra_reports;

    I have alreay hv declared of type traArray.

    pls help me solve this problem.

    Meghna wrote:
    is it possible to use the collection pl/sql in SQL or refcur without creating it because I'm not able to create the type of database.

    The only way I know is function in pipeline:

    create or replace
      package pkg1
        is
          type traRecord
            is record(
                      ename emp.ename%type,
                      sal   emp.sal%type
                     );
          TYPE traArray IS TABLE OF traRecord;
          function f1
            return traArray
            pipelined;
    end;
    /
    create or replace
      package body pkg1
        is
        function f1
            return traArray
            pipelined
          is
              v_rec traRecord;
          begin
              v_rec.ename := 'Sam';
              v_rec.sal := 1000;
              pipe row(v_rec);
              v_rec.ename := 'John';
              v_rec.sal := 1500;
              pipe row(v_rec);
              v_rec.ename := 'Mary';
              v_rec.sal := 2000;
              pipe row(v_rec);
              return;
        end;
    end;
    /
    

    Now, you can:

    SQL> select * from table(pkg1.f1)
      2  /
    
    ENAME             SAL
    ---------- ----------
    Sam              1000
    John             1500
    Mary             2000
    
    SQL>
    

    Don't forget, it will create the generated system types:

    SQL> select type_name from user_types
      2  /
    
    TYPE_NAME
    ------------------------------
    SYS_PLSQL_73305_9_1
    SYS_PLSQL_73305_DUMMY_1
    SYS_PLSQL_73305_34_1
    
    SQL> desc SYS_PLSQL_73305_9_1
     Name                                      Null?    Type
     ----------------------------------------- -------- ----------------------------
     ENAME                                              VARCHAR2(10)
     SAL                                                NUMBER(7,2)
    
    SQL> desc SYS_PLSQL_73305_DUMMY_1
     SYS_PLSQL_73305_DUMMY_1 TABLE OF NUMBER
    
    SQL> desc SYS_PLSQL_73305_34_1
     SYS_PLSQL_73305_34_1 TABLE OF SYS_PLSQL_73305_9_1
     Name                                      Null?    Type
     ----------------------------------------- -------- ----------------------------
     ENAME                                              VARCHAR2(10)
     SAL                                                NUMBER(7,2)
    
    SQL> 
    

    SY.

  • Error Type 2 SCD: ODI - 1228:ORA - 01747: invalid column, table.column, or user.table.column specification

    ODI error. When you try to import.

    Error Type 2 SCD: ODI - 1228:ORA - 01747: invalid column, table.column, or user.table.column specification

    It is a common question.

    Allow your SCD SCD table column properties if you do not select "crush on change."
    This property simply

    -Online CPC IKM goto => select ignore option error on update of existing lines.

  • ORA-00902: invalid data type on xmltable

    Hello

    I learn XMLTABLE but not able to run the following queries,

    with xml11g as
    (
    select '<?xml version="1.0"?>
    <purchaseorder orderdate="1999-10-20">
      <shipto country="us">
        <name>alice smith</name>
        <street>123 maple street</street>
        <city>mill valley</city>
        <state>ca</state>
        <zip>90952</zip>
      </shipto>
      <billto country="us">
        <name>robert smith</name>
        <street>8 oak avenue</street>
        <city>old town</city>
        <state>pa</state>
        <zip>95819</zip>
      </billto>
      <comment>hurry, my lawn is going wild!</comment>
      <items>
        <item partnum="872-aa">
          <productname>lawnmower</productname>
          <quantity>1</quantity>
          <usprice>148.95</usprice>
          <comment>confirm this is electric</comment>
        </item>
        <item partnum="926-aa">
          <productname>baby monitor</productname>
          <quantity>1</quantity>
          <usprice>39.98</usprice>
          <shipdate>1999-05-21</shipdate>
        </item>
      </items>
    </purchaseorder>' myxml from dual
    )
    select s.*, b.*
    from xml11g t,
      xmltable ('/purchaseorder' passing
        xmlparse(document t.myxml)
        columns
          "shipto" xml,
          "billto" xml
        ) x,
        xmltable ('/shipto' passing x."shipto"
          columns
            "name" char(20),
            "street" char(40),
            "city" char(40),
            "state" char(2),
            "zip" number(10)
        ) s,
        xmltable ('/billto' passing x."billto"
          columns
            "name" char(20),
            "street" char(40),
            "city" char(40),
            "state" char(2),
            "zip" number(10)
        ) b;
    
    

    It is showing me special suite

    < zip > 90952 < / zip >

    *

    ERROR on line 10:

    ORA-00902: invalid data type

    Please guide me what I'm missing here.

    Thanks and greetings

    Alexander gelin

    For me the (slightly modified) works:

    [sql]

    with xml11g as
    (
    Select ' 
     
       
        Alice Smith 
        123 maple Street 
        Mill Valley 
        CA 
        90952 
       
       
        Robert Smith 
        8 Oak avenue 
        old town 
        PA 
        95819 
       
      Hurry, my lawn is going wild
    !                 lawn mower        1        148.95        confirm this is electric                    baby monitor        1        39.98        1999-05-21            "double myxml. ) Select *. of xml11g t.   XMLTable ('/ purchaseorder' by the way)     xmlParse (document t.myxml)     columns       "shipto" XMLtype,       "billto" XMLtype     )     x,     XMLTable ("' / shipto' passing x." ShipTo")       columns         'name' char (20)         , 40 "Street."         'city' 40,         'State' (2) tank.         "zip" INTEGER     + 1 ,     XMLTable ("' / billto' passing x." BillTo")       columns         'name' char (20),         40 "Street."         'city' 40,         'State' (2) tank.         "zip" INTEGER    

    ) b ;

    [SQL]

  • ORA-01722: invalid number - when the last column has numbers that have a decimal separator

    Here are examples of data-

    FRT, 1.64, VAT, 23,36

    FRT, 1.64, VAT, 23,36

    When I try to convert 1.64 to_number everything is good, but when I do the same thing with 23,36 I get the following error

    ORA-29913: error in executing ODCIEXTTABLEFETCH legend

    ORA-01722: invalid number

    ORA-06512: at "SYS." ORACLE_LOADER', line 52

    I tried this query example

    Select to_number (CONSIGNMENT_NET_VALUE) as Col1 of DUMP_EXT

    Select to_number (CONSIGNMENT_NET_VALUE, '9999999999D' 99999', NLS_NUMERIC_CHARACTERS = ",". ") as Col1 DUMP_EXT-> 268906.1

    make the same mistake - any help greatly appreciated.

    T.

    Srini

    Try using:

    RECORDS DELIMITED BY newline

    Instead of:

    RECORDS DELIMITED BY '\n'


    on your table to create, in addition to just help to_number or to_number return with ' NLS_NUMERIC_CHARACTERS = ".," ' in your query, in the period before the comma as decimal separator comes before the grouping separator.

    What is probably happening is that your return to the line of the system data come from different East of your new line on the system that you load in.  You may need to experiment and

    Select dump (consignment_net_value) in the dump_ext;

    to determine what additional invisible characters, such as Chr (10) and Chr (13) can be added at the end of the number that you have to cut, so just using line feed does not work.  This is why it only happens with the numbers at the end of the line.

    Post edited by: BarbaraBoehmer

  • ORA-39083: Type THAT TABLESPACE could not create object

    Hello
    I am importing a dump file into a new database by the following command line:

    Impdp system/***@orcl DUMPFILE is EXP_FUL_H9DEV. LOGFILE = mYLOG.log DMP

    But I have this error:
    ORA-39083: Type THAT TABLESPACE could not create object error:
    ORA-01119: error in creating database file ' D:\BASE\H9DEV\DATA\PSDEFAULT. DBF'
    ORA-27040: create file error, cannot create the file
    04002 - OSD: could not open the file
    S/O-error: (OS 21) the device is not ready.


    In the original database tablespace PSDEFAULT was on D: file system. But D: does not exist on the new server. How to tell datapump/oracle to create it on the same file system where the other new database datafile are (E:\oradata...)? An impdp command line parameter?

    Thank you.

    See the documentation for the following impdp option:
    REMAP_DATAFILE
    REMAP_TABLESPACE

    (and perhaps EXCLUDE?)

Maybe you are looking for