ORA-00904 with nested tables

Hello. I have a problem of creating tables with nested tables.
After you have created a few types, I would create a table based on these, but I get

SQL error: ORA-00904: invalid identifier
+ 00904. 00000 - '% s: invalid identifier ' +.

over and over again. This is my SQL code:

1 create or replace TYPE t_indirizzo () AS OBJECT
via VARCHAR (45), 2
3 NUMBER,
4 cap INTEGER (5).
5 Città varchar (30),
6 provincia varchar (30),
region 7 varchar (30)
)

8 create or replace TYPE t_telefono () AS OBJECT
9 num_tel Number (15)
)

10 create or replace TYPE t_listaTelefono AS TABLE OF THE t_telefono

11 create or replace TYPE t_cliente () AS OBJECT
12 cod_cliente NUMBER (8).
13 address t_indirizzo,
14 email varchar (30),
Telefono 15 t_listaTelefono
(16) NOT FINAL

17 CREATE TABLE client (t_cliente)
18 cod_cliente NOT NULL,
19 address NOT NULL,
email 20 NOT NULL,
21 PRIMARY KEY (cod_cliente)
(22) TABLE IMBRIQUE 'telefono' STORE AS 'numTelCli_tab '.
23 RETURN VALUE

My version of Oracle is 10.2.0. Thank you in advance.

Published by: user11231503 on 2.35 giu-8-2009

so, just to be sure, run this:

create or replace TYPE t_indirizzo AS OBJECT (
via VARCHAR(45),
numero NUMBER,
cap INTEGER(5),
citta VARCHAR(30),
provincia VARCHAR(30),
regione VARCHAR(30)
);
/ 

create or replace TYPE t_telefono AS OBJECT (
num_tel NUMBER(15)
);
/ 

create or replace TYPE t_listaTelefono AS TABLE OF t_telefono
/ 

create or replace TYPE t_cliente AS OBJECT (
cod_cliente NUMBER(8),
indirizzo t_indirizzo,
email VARCHAR(30),
telefono t_listaTelefono
) NOT FINAL;
/ 

CREATE TABLE cliente OF t_cliente(
cod_cliente NOT NULL,
indirizzo NOT NULL,
email NOT NULL,
PRIMARY KEY (cod_cliente)
) nested table telefono store as numTelCli_tab
return as value
/
 

Tags: Database

Similar Questions

  • ORA-00904 on CREATE TABLE with a virtual column based on the XMLTYPE content

    Hello

    This is another one for the gurus of the syntax...

    Try the following, fails with ORA-00904: "MESSAGE". "' GETROOTELEMENT": invalid identifier
    CREATE TABLE XML_TEST_VIRT
      (
       MSG_TYPE         GENERATED ALWAYS AS (MESSAGE.GETROOTELEMENT()) VIRTUAL,
       MESSAGE  XMLTYPE             NOT     NULL,
       IE906    XMLTYPE             DEFAULT NULL
      )
       XMLTYPE COLUMN MESSAGE STORE AS SECUREFILE BINARY XML
       XMLTYPE COLUMN IE906   STORE AS SECUREFILE BINARY XML
    /
    While it succeeds
    CREATE TABLE XML_TEST_VIRT
      (
       MSG_TYPE         GENERATED ALWAYS AS (EXTRACT(MESSAGE, '/*').GETROOTELEMENT()) VIRTUAL,
       MESSAGE  XMLTYPE             NOT     NULL,
       IE906    XMLTYPE             DEFAULT NULL
      )
       XMLTYPE COLUMN MESSAGE STORE AS SECUREFILE BINARY XML
       XMLTYPE COLUMN IE906   STORE AS SECUREFILE BINARY XML
    /
    The GETROOTELEMENT from SYS member function. XMLTYPE is stated as "PARALLEL_ENABLE DETERMINISTIC" the method called is not the problem, as evidenced by the 2nd case.
    Using the MESSAGE column that is of type XMLTYPE directly seems to be the problem. But the question is "why." The result of the EXTRACT function is of type XMLTYPE and call his works of members, the column is also of type XMLTYPE still call its members fails...

    Thanks in advance for any ideas on that.

    Best regards
    Philippe

    Going on the means to go far, far back.

    2003 re: function getRootElement ORA-00904

  • Error in the importation of tables with nested table types

    Hello

    I have two tables with the nested table type when I m try to import a schema to another all tables with error to give the type of identifying different

    Here is my order of import
    imp leader = tables_nested.dmp ignore = y fromuser = ABC touser = DEV_SCHEMA toid_novalidate = sup_payment_type
    I tried to import with the option TOID_NOVALIDATE, but it says
    IMP-00086: TOLD 'SUP_PAYMENT_TYPE' not found in the export file


    Here, the view of my log file.

    . . table import 'CONTRACT' 788 imported lines
    . . importation of "EQUIPMENT" 4301 imported table lines
    . . rows in table 'CONT_EQUIPMENT' import imported 4300
    IMP-00017: statement failed with error ORACLE 2304:
    "CREATE TYPE"SUP_PAYMENT_TYPE"TIMESTAMP" 2007-11 - 28:10:50:50' OID "3FF6F10."
    "CADC08A99E040A8C0010178F9"AS OBJECT ().
    "CONT_NO NUMBER".
    "EQP_NO NUMBER".
    "PMT_NO NUMBER".
    'DATE OF PLAN_PMT_DATE '.
    "S_NO NUMBER".
    "BATCH_NO NUMBER".
    'DATE OF TRAN_DT '.
    'DATE OF ACTUAL_PMT_DATE '.
    "ACTUAL_PAID_AMT_CURR NUMBER".
    "ACTUAL_PAID_AMT_KZT NUMBER".
    "PMT_CURSTYP_CD NUMBER".
    'NUMBER OF PMT_EXG_RATE);'
    IMP-00003: ORACLE error 2304
    ORA-02304: invalid literal object identifier
    IMP-00063: WARNING: jump table "DEV_SCHEMA". "" SUPPLIER_PAYMENT "as the type of the object
    'DEV_SCHEMA '. "' SUP_PAYMENT_TYPE ' could not be created or has identify different
    About to activate the constraints...

    Thank you

    Baptist

    Get the error on tahiti, I realized this must be a common problem and is described in Metaclunk.
    So in Metaclunk I get "ora-02304 imp' and came up with 1066139.6 ML.
    It describes your situation.
    So many times, it is very easy to solve your problems in a few minutes. I always wonder why people walk immediately into shock and horror and nothing to do when they hit a mistake.

    ----
    Sybrand Bakker
    Senior Oracle DBA

  • With nested table test procedure

    Hello by the Expert,

    I have a procedure that accepts an array as an input parameter. Now my problem is how to test this procedure from sqlplus. strugling with passing values using table...

    Details:
    Oracle: Oracle Database 11 g Enterprise Edition Release 11.2.0.1.0 - 64 bit Production.
    Procedure: sp_dl_ins_stg_tab_npi (i_provider_npi_arr IN provider_npi_nt)
    -> provider_npi_nt is a nested table.

    Structure of the table:

    create or replace type provider_identifier_typ as an object
    (
    provider_identifier VARCHAR2 (30),
    identifier_type VARCHAR2 (15)
    )
    create or replace type provider_identifier_nt in the provider_identifier_typ table;

    create or replace type provider_npi_type as object)
    aut_official_nm_suffix VARCHAR2 (10),
    aut_official_credential_txt VARCHAR2 (100),
    provider_identifier_tab provider_identifier_nt
    )

    create or replace type provider_npi_nt in the provider_npi_typ table;


    Note: provider_npi_type Type is nested with provider_identifier_nt

    Appreciate your help
    Concerning

    Hello

    You will need to use an anonymous block to build the table and call the procedure.
    For example:

    DECLARE 
    
     npi_nt provider_npi_nt;
    
    BEGIN
    
     npi_nt := provider_npi_nt(
                  provider_npi_typ('A', 'some text',
                     provider_identifier_nt(
                        provider_identifier_typ('ID-A1','Type1'),
                        provider_identifier_typ('ID-A2','Type2')
                     )
                  ),
                  provider_npi_typ('B', 'some text',
                     provider_identifier_nt(
                        provider_identifier_typ('ID-B1','Type1'),
                        provider_identifier_typ('ID-B2','Type2'),
                        provider_identifier_typ('ID-B2','Type3')
                     )
                  )
               );
    
     SP_DL_INS_STG_TAB_NPI(npi_nt);
    
    END;
    /
    

    Here, I created the object of each manufacturer of nesting. As you can see, it can quickly become a process of 'painful '.
    On the contrary, if your data is in the database tables, the table can be built more easily with a single query.

  • Problem using the list separated by commas with nested table element

    Hello

    I have a list separated by commas like this:
    H23004,H24005,T7231,T8231,T9231
    And want to create a function that creates a where clause clause for each element with an output like this:
    UPPER('H23004') IN (UPPER(charge))
    OR UPPER('H23005') IN (UPPER(charge))
    OR UPPER('T7231') IN (UPPER(charge))
    OR UPPER('T8231') IN (UPPER(charge))
    OR UPPER('T9231') IN (UPPER(charge))
    Here's my test function that is not working properly:
    create or replace function FNC_LIST_TO_WHERE_CLAUSE(v_list in VARCHAR2) return varchar2 is
     -- declaration of list type
     TYPE batch_type IS TABLE OF pr_stamm.charge%TYPE;
     -- variable for Batches
     v_batch batch_type := batch_type('''' || replace(v_list,',',''',''') || '''');
     return_script varchar2(1000);
    
     BEGIN
     -- loop as long as there are objects left
     FOR i IN v_batch.FIRST .. v_batch.LAST
     LOOP
       --DBMS_OUTPUT.PUT_LINE(offices(i));
       -- create where clause
       IF i = 1 THEN
         return_script := 'UPPER(' || v_batch(i) || ') IN (UPPER(charge))';
       ELSE
         return_script := return_script || ' OR UPPER(' || v_batch(i) || ') IN (UPPER(charge))';
       END IF;
     END LOOP;
    
     return (return_script);
     end;
    The out put looks like this:
    UPPER('H23004','H24005','T7231','T8231','T9231') IN (UPPER(charge))
    I don't know what I did wrong? It calculates the amount of the incorrect array element! (v_batch. Must be 5)
    v_batch. FIRST = 1
    v_batch. LAST = 1

    Kind regards

    Tobias

    Try this...

    declare
    text varchar2 (1000): = "H23004, H24005, T7231, T8231, T9231;
    v_where varchar2 (1000);
    Start
    Text: = text | «, » ;
    While instr (text, ',') <> 0
    loop
    v_where: = v_where | ' UPPER ("': substr (Text, 1, InStr(Text,',',1)-1) |") ' IN (UPPER (load)) OR ';
    text: = substr (text, instr(text,',',1) + 1);
    end loop;
    v_where: = substr (v_where, 1, length (v_where)-3);
    dbms_output.put_line (v_where);
    end;

    convert it to function...

  • calling a procedure with nested table as input param type

    Hello

    I have a guy like that table.

    create or replace type table_type like table of the varchar2 (4000);

    I have a procedure like this.

    proc_temp (v_table_type, table_type)

    Start

    key code...

    end;


    I have a table like this.

    tab_test_data

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

    ABCD

    efghd

    MNOP

    XYXX

    I want to move this data in table tab_test_data as param of entry while calling this proc could you please tell me how the procedure that calls the statement will be the writtern.

    I try like this.

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

    declare

    TABLE_TYPE v_table;

    Start

    proce_temp (v_table); - here, I want to pass data to the table as entry

    end;

    /

    You already have the data in a table (tab_test_data), then why don't you just use the table inside the proce_temp? Why should I set a collection type and pass it as a parameter? Collections use the expensive PGA memory. If the application that you build this way may have some serious scalability issues.

    Sort of a technical solution would be like this. You can use BULK COLLECT.

    declare
    TABLE_TYPE v_table;
    Start
    Select to bulk column_name fired in v_table
    of tab_test_data;

    proce_temp (v_table);
    end;
    /

  • Help please with nested tables

    I'm fighting to properly set up the levels of my play on words.

    I have 30 levels

    var wordLevels:Array = [wordsL01, wordsL02, wordsL03, wordsL04, wordsL05, wordsL06, wordsL07, wordsL08, wordsL09, wordsL1, 0]

    wordsL11, wordsL12, wordsL13, wordsL14, wordsL15, wordsL16, wordsL17, wordsL18, wordsL19, wordsL20,

    wordsL21, wordsL22, wordsL23, wordsL24, wordsL25, wordsL26, wordsL27, wordsL28, wordsL29, wordsL30]

    Each level has 10 words

    public var wordsL01:Array = [wordsL1W1, wordsL1W2, wordsL1W3, wordsL1W4, wordsL1W5, wordsL1W6, wordsL1W7, wordsL1W8, wordsL1W 9, wordsL1W10];

    Every word is divided into sounds.

    public var wordsL2W9:Array = ["th', 'r', 'ee'];

    I want to display the score etc. after each level. I think for this I will have to write a loop to generate ten words in a current level and then after each level is completed displays the score etc. before moving on to the next level.

    I tried to write the loop for this (see code below), but instead of retracing the 10 words I expected, I had the following in the output panel: Function() {} function

    What's wrong in my code? I have marked the relevant bits in red:

    package

    {

    import flash.display.MovieClip;

    import flash.text.TextField;

    import flash.events.Event;

    import flash.utils.Timer;

    import flash.events. *;

    import flash.events.MouseEvent;

    / public dynamic class WordArray extends MovieClip

    {

    public var wordtext:wordText = new wordText;

    var activeWordArray:Array;

    var activeLevelofTenWordsArray:Array;

    public var wordsL1:Array = ['elephant', 'a', 'of', 'off', 'walk', 'no', 'got', 'in', 'East', 'it']; This was for testing only, be removed as soon as al levels can be broken up

    public var wordsL1W1:Array = ['a'];

    public var wordsL1W2:Array = ["h", "a","s"];

    public var wordsL1W3:Array = ['o', 'f'];

    public var wordsL1W4:Array = ['o', 'f', 'f'];

    public var wordsL1W5:Array = ["o", "n"];  / / year so on until wordsL30W10:

    public var wordsL01:Array = [wordsL1W1, wordsL1W2, wordsL1W3, wordsL1W4, wordsL1W5, wordsL1W6, wordsL1W7, wordsL1W8, wordsL1W 9, wordsL1W10];

    public var wordsL02 //etc up to wordsL30.

    public var wordLevels:Array = [wordsL01, wordsL02, wordsL03, wordsL04, wordsL05, wordsL06, wordsL07, wordsL08, wordsL09, wordsL1, 0]

    wordsL11, wordsL12, wordsL13, wordsL14, wordsL15, wordsL16, wordsL17, wordsL18, wordsL19, wordsL20,

    wordsL21, wordsL22, wordsL23, wordsL24, wordsL25, wordsL26, wordsL27, wordsL28, wordsL29, wordsL30]

    private var tf:TextField;

    public var letterArray:LetterArray;

    public var tileTimer = new Timer (500,384);

    the constructor code

    public void WordArray(_tf:TextField)

    {

    TF = _tf;

    levelGenerator();

    }

    function levelGenerator (): void

    {

    * To obtain a higher level of 10 words

    if(wordLevels.Length>0)

    {

    activeLevelofTenWords(); / / to get the next word

    runTiles();

    trace ("' level generator works '");

    }

    on the other

    {

    Game is complete

    }

    }

    function activeLevelofTenWords (): void

    {

    activeLevelofTenWordsArray = wordLevels.shift (); //should I add a split here?

    trace ("current level of ten words to follow directly reference");

    trace (activeLevelofTenWords);

    worked up to here, next steps and tests to follow

    nextWordF();

    }

    function runTiles (): void

    {

    * Run letter tiles Start *.

    letterArray = new LetterArray();

    addChild (letterArray);

    tileTimer.addEventListener (TimerEvent.TIMER, gameLoop);

    tileTimer.start ();

    / * function gameLoop(timerEvent:TimerEvent):void public

    {

    trace ("tile timer started");

    letterArray.gameLoop ();

    }*/

    * end *.

    }

    function nextWordF (): void

    {

    if(wordsL1.Length>0)

    {

    activeWordF();

    populateMyWordBox();

    }

    }

    private function activeWordF (): void

    {

    activeWordArray = wordsL1.shift ().split("");

    This table must be sent to the class that checks which letters are clicked (used in this class, if that's where the letters clicked are handled) so the letters clicked can be compared to the elements of activeWordArray.

    When clicked letters are completed for that Word, call nextWordF().

    }

    public void populateMyWordBox()

    {

    trace ("my Word box place works");

    trace (wordsL01);

    trace(wordsL1[0]);

    trace (wordsL1W1);

    TF. Text = activeWordArray.join("");

    }

    }

    }

    I saw a typo in:

    trace (activeLevelofTenWords);

    should be

    trace (activeLevelofTenWordsArray);

  • ORA-00904 when you select a nested table column

    Hello

    I use a table with the following description:

    SQL > desc muenzen
    Name Null? Typ
    ------------------------------- -------- ----------------------------

    1 MUENZ_ID NOT NULL NUMBER
    2 MUENZ_TEXT NOT NULL VARCHAR2 (200 CHAR)
    3 MUENZ_BESCHREIBUNG CLOB
    MUENZ_BILD 4 MUENZ_BILDER_TAB
    MUENZ_BILDER ist NO FINAL
    5 4 NUMMER NUMBER
    6 4 BILD BLOB

    METHOD
    ------
    MEMBER FUNCTION BILD_SUCHEN RETURNS THE BLOB
    Argument name Typ/output Defaultwert?
    ------------------------------ ----------------------- ------ --------
    NUMMER NUMBER IN
    BILD BLOB IN
    7 MUENZ_ERSTELLER NOT NULL VARCHAR2 (30 CHAR)
    8 MUENZ_ERSTELL_DATUM NOT NULL DATE
    9 MUENZ_AENDERER VARCHAR2 (30 CHAR)
    DATE OF MUENZ_AEND_DATUM 10

    I use the folling SELECT statement: select muenz_id, muenz_text, MUENZE. MUENZ_BILDER_TAB (MUENZE. MUENZ_BILDER. Nummer) of muenzen; and got the error:

    ORA-00904: "MUENZE. "" "" MUENZ_BILDER '. "" NUMMER": ungultiger Bezeichner

    00904, 00000 - '% s: invalid identifier '.

    * Cause:

    * Action:

    What ist the right identifier?

    Please help me

    Concerning

    Siegwin

    Hello siegwin.port

    I corrected the tablenames.

  • DROP table and CREATE with column name and ORA: 00904

    Hello
    I created a table with an attribute date CRTD_ON and two other attributes. Successfully created. I can see the data tab and the window empty data with column names in the header...
    Now, I had to change the name of field attribute date on OPNG_DATE so I don't bother to change, instead, I deleted and created with the name of the column has changed. Then I restart the ddl. Once again managed to create. But this time I am not able to see the data tab or the column headings. And I see the error of the log of the data Publisher ORA-00904: "CRTD_ON": invalid identifier
    Is this a bug?

    There is a current bug where you will get the data if you have a public synonym with the same table name pointing to another table with another structure. Can you confirm that in your environment?

    K.

  • help join you a table nested with ordinary table

    IM creating a nested table object prtcnpt_info codelist. In a block anonymous im saying t_code as type nested table codelist.
    Now when I try to join the table nested to ordinary table oracle DB and I get the error: PL/SQL: ORA-00904: "COLUMN_VALUE": invalid identifier.
    Please help me on this and provide link tutorial about this concepts... Here is the code I wrote

    -Start code.
    create or replace type prtcnpt_info as an object (identification number
    , name varchar2 (200)
    (, code varchar2 (30));


    create type codelist is the prtcnpt_info table;


    declare
    t_code codelist.
    Start

    Select prtcnpt_info (b.pid, b.name, pt.code) in bulk collect into t_code
    party pt
    mc_code b
    where pt.cd in ("AAA", "BBB")
    and pt.ptype_id = b.pt_type_id;


    INSERT INTO table (ID
    RUN_ID
    DATA
    P_ID
    )
    SELECT id
    run_id
    data
    prtct.id-> 1
    IN table_2 t2
    , (by selecting column_value in table (t_code)) prtct
    WHERE prtct.id = t2. P_ID; -> 2

    end;

    -End code;
    also of the anonymous block
    1 = > is this right until you get the id value (b.pid) of the tablet_code nested as prtct alias?
    2 = > is this right until you reach the nested with ordinary table table? I want to join the id column in the tables.

    Published by: 914912 on April 30, 2012 02:11

    Write the insert like this and try

    insert into table
    (
           id
         , run_id
         , data
         , p_id
    )
     select id,
         run_id,
         data,
         prtct.id
       from table_2 t2
         table(t_code) prtct
      where prtct.id = t2.p_id;
    
  • 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

  • ORA-00904: "RENEWED_FD." "' OLD_FDR_NO ': invalid identifier...... HOW table TO INSERT SEVERAL ROWS of ONE TABLE to ANOTHER.

    Hi all

    I have two tables RENEWED_FD and KEC_FDACCT_MSTR.

    In the RENEWED_FD table, there are columns namely OLD_FDR_NO, ACCT_CUST_CODE, ACCT_TYPE, QUANTITY.

    In the KEC_FDACCT_MSTR table, there are columns namely ACCT_FD_NO, ACCT_CUST_CODE, ACCT_TYPE, QUANTITY.

    In the RENEWED_FD table, OLD_FDR_NO is present and rest all columns are empty, so I want to insert all other values of column in table KEC_FDACCT_MSTR

    where RENEWED_FD. OLD_FDR_NO = KEC_FDACCT_MSTR. ACCT_FD_NO.

    How to do this in Toad for ORACLE FORMS 6i or Oracle?

    Help me

    Thank you.

    Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production


    I tried with the following code:

    Code:

    INSERT INTO RENEWED_FD

    (ACCT_CUST_CODE, ACCT_TYPE, SUM)

    SELECT ACCT_CUST_CODE, ACCT_TYPE, AMOUNT

    OF KEC_FDACCT_MSTR

    WHERE RENEWED_FD. OLD_FDR_NO = KEC_FDACCT_MSTR. ACCT_FD_NO;

    But I got this error:

    ORA-00904: "RENEWED_FD." "" OLD_FDR_NO ": invalid identifier

    Oh, you're on 9i db. In 9i the MATCHED and UNMATCHED aren't optional, and you must use both. FUSION has evolved through time, and it's a shame that you cannot make the most out of it because of your version.

    You use better UPDATE statement then.

    update of renewed_fd one

    Set)

    a.acct_cust_code

    a.acct_type

    a.amount

    ) =

    (

    Select b.acct_cust_code

    b.acct_type

    b.amount

    of kec_fdacct_mstr b

    where a.old_fdr_no = b.acct_fd_no

    )

    where

    There are)

    Select null

    of kec_fdacct_mstr b

    where a.old_fdr_no = b.acct_fd_no

    )

  • Update fails with ORA-00904 invalid identifier

    Hi all
    I have problems of construction of an ' update '. Execute the following select statement,
    SELECT 
     XREF.REGN_ID,
           XREF.COUNTY_NM,
           OWNER.CASE_OWNER_ID,
           OWNER.FORMER_AREA,
           OWNER.AREA,
           OWNER.COUNTY_NUMBER,
           OWNER.OFFICE
      FROM PS2_CASE_OWNER_SEYED OWNER,
           DWFSSD.TAFS_REGN_AREA_XREF_MART XREF
              WHERE    (OWNER.AREA = XREF.AREA_ID(+))
                 AND (OWNER.OFFICE = XREF.OFFICE_CD(+) )
                 AND (OWNER.COUNTY_NUMBER = XREF.COUNTY_NUM(+))
    Returns
    REGN_ID   COUNTY_NM                        CASE_OWNER_ID   FORMER_AREA   AREA   COUNTY_NUMBER   OFFICE   
    "1"       "Alfalfa"                        "5008756"       "1"           "1"    "02"            "C"      
    "1"       "Alfalfa"                        "5008954"       "1"           "1"    "02"            "C"      
    "1"       "Beckham"                        "5008803"       "1"           "1"    "05"            "C"      
    "1"       "Beckham"                        "5008222"       "1"           "1"    "05"            "C"      
    "1"       "Beckham"                        "5008223"       "1"           "1"    "05"            "C"      
    "1"       "Beckham"                        "5008424"       "1"           "1"    "05"            "C"      
    "1"       "Beckham"                        "5008442"       "1"           "1"    "05"            "C"      
    "1"       "Beckham"                        "5008780"       "1"           "1"    "05"            "C"      
    "1"       "Beckham"                        "5008787"       "1"           "1"    "05"            "C"      
    "1"       "Beckham"                        "5008788"       "1"           "1"    "05"            "C" 
    I am trying to execute the following statement, "Update", update the PS2_CASE_OWNER_SEYED table.
    UPDATE (
      SELECT OWNER.AREA, XREF.REGN_ID, XREF.COUNTY_NM
      FROM PS2_CASE_OWNER_SEYED OWNER, DWFSSD.TAFS_REGN_AREA_XREF_MART XREF
       WHERE    (OWNER.AREA = XREF.AREA_ID(+))
         AND (OWNER.OFFICE = XREF.OFFICE_CD(+) )
         AND (OWNER.COUNTY_NUMBER = XREF.COUNTY_NUM(+))
    )
    SET OWNER.FORMER_AREA = OWNER.AREA,
        OWNER.AREA = XREF.REGN_ID,
        OWNER.COUNTY_NAME = XREF.COUNTY_NM;
    The "Update" statement returns the following error:
    ORA-00904: "XREF"."COUNTY_NM": invalid identifier
    Any ideas what's wrong with the update statement?

    Thank you

    Seyed

    Hi, Seyed,

    Here's a way to do this UPDATE:

    UPDATE     emp
    SET     sal     = sal * 1.05
    ,     comm     = NVL (comm, 0) + 500
    WHERE     deptno     IN (
                   SELECT     deptno
                   FROM     dept
                   WHERE     loc     = 'DALLAS'
                 )
    ;
    

    If you want to use an inline view, you can do this:

    UPDATE     (
              SELECT     e.sal
              ,     e.comm
              FROM     emp     e
              JOIN     dept     d  ON     d.deptno  = e.deptno
              WHERE     d.loc     = 'DALLAS'
         )
    SET     sal     = sal * 1.05
    ,     comm     = NVL (comm, 0) + 500
    ;
    

    Whatever it is, the emp table is left as you wish:

    EMPNO ENAME  JOB         MGR HIREDATE          SAL  COMM DEPTNO
    ----- ------ --------- ----- ---------- ---------- ----- ------
     7782 CLARK  MANAGER    7839 06/09/1981       2450           10
     7839 KING   PRESIDENT       11/17/1981       5000           10
     7934 MILLER CLERK      7782 01/23/1982       1300           10
     7876 ADAMS  CLERK      7788 05/23/1987       1155   500     20
     7902 FORD   ANALYST    7566 12/03/1981       3150   500     20
     7566 JONES  MANAGER    7839 04/02/1981    3123.75   500     20
     7788 SCOTT  ANALYST    7566 04/19/1987       3150   500     20
     7369 SMITH  CLERK      7902 12/17/1980        840   500     20
     7499 ALLEN  SALESMAN   7698 02/20/1981       1600   300     30
     7698 BLAKE  MANAGER    7839 05/01/1981       2850           30
     7900 JAMES  CLERK      7698 12/03/1981        950           30
     7654 MARTIN SALESMAN   7698 09/28/1981       1250  1400     30
     7844 TURNER SALESMAN   7698 09/08/1981       1500     0     30
     7521 WARD   SALESMAN   7698 02/22/1981       1250   500     30
    
  • Use FOR... LOOP counter in the treatment of PL/SQL procedures with nest. Table

    Hi all!
    I learn PL/SQL on the book by Steve Bobrovsky (specified below, sample comes from it) and I have a question.

    In the procedure of the below specified program used a currentElement integer variable to get the reference to the line in the nested table of data type % ROWTYPE.
    Meanwhile, the program itself uses a common FOR... LOOP counter I have.
    DECLARE
     TYPE partsTable IS TABLE OF parts%ROWTYPE;
     tempParts partsTable := partsTable();
     CURSOR selectedParts IS 
      SELECT * FROM parts ORDER BY id;
     currentPart selectedParts%ROWTYPE;
     currentElement INTEGER;
     PROCEDURE printParts(p_title IN VARCHAR2, p_collection IN partsTable) IS
      BEGIN
       DBMS_OUTPUT.PUT_LINE(' ');
       DBMS_OUTPUT.PUT_LINE(p_title || ' elements: ' || p_collection.COUNT);
       currentElement := p_collection.FIRST;
       FOR i IN 1 .. p_collection.COUNT
       LOOP
        DBMS_OUTPUT.PUT('Element #' || currentElement || ' is ');
         IF tempParts(currentElement).id IS NULL THEN DBMS_OUTPUT.PUT_LINE('an empty element.');
         ELSE DBMS_OUTPUT.PUT_LINE('ID: ' || tempParts(currentElement).id || ' DESCRIPTION: ' || tempParts(currentElement).description);
         END IF;
        currentElement := p_collection.NEXT(currentElement);
       END LOOP;
     END printParts;
    BEGIN
     FOR currentPart IN selectedParts
     LOOP
      tempParts.EXTEND(2);
      tempParts(tempParts.LAST) := currentPart;
     END LOOP;
     printParts('Densely populated', tempParts);
     FOR i IN 1 .. tempParts.COUNT
     LOOP
      IF tempParts(i).id is NULL THEN tempParts.DELETE(i);
      END IF;
     END LOOP;
     FOR i IN 1 .. 50
     LOOP
      DBMS_OUTPUT.PUT('-');
     END LOOP;
     printParts('Sparsely populated', tempParts);
    END;
    /
    When I substituted a global variable of INTEGER type such for... The LOOP counter, an APEX have returned an error "ORA-01403: no data found.
    DECLARE
     TYPE partsTable IS TABLE OF parts%ROWTYPE;
     tempParts partsTable := partsTable();
     CURSOR selectedParts IS 
      SELECT * FROM parts ORDER BY id;
     currentPart selectedParts%ROWTYPE;
     PROCEDURE printParts(p_title IN VARCHAR2, p_collection IN partsTable) IS
      BEGIN
       DBMS_OUTPUT.PUT_LINE(' ');
       DBMS_OUTPUT.PUT_LINE(p_title || ' elements: ' || p_collection.COUNT);
       FOR i IN 1 .. p_collection.COUNT
       LOOP
        DBMS_OUTPUT.PUT('Element is ');
         IF tempParts(i).id IS NULL THEN DBMS_OUTPUT.PUT_LINE('an empty element.');
         ELSE DBMS_OUTPUT.PUT_LINE('ID: ' || tempParts(i).id || ' DESCRIPTION: ' || tempParts(i).description);
         END IF;
       END LOOP;
     END printParts;
    BEGIN
     FOR currentPart IN selectedParts
     LOOP
      tempParts.EXTEND(2);
      tempParts(tempParts.LAST) := currentPart;
     END LOOP;
     printParts('Densely populated', tempParts);
     FOR i IN 1 .. tempParts.COUNT
     LOOP
      IF tempParts(i).id is NULL THEN tempParts.DELETE(i);
      END IF;
     END LOOP;
     FOR i IN 1 .. 50
     LOOP
      DBMS_OUTPUT.PUT('-');
     END LOOP;
     printParts('Sparsely populated', tempParts);
    END;
    /
    When I tried to manage this code in SQL * Plus, the following picture emerged:
    Densely populated elements: 10
    Element is an empty element.
    Element is ID: 1 DESCRIPTION: Fax Machine
    Element is an empty element.
    Element is ID: 2 DESCRIPTION: Copy Machine
    Element is an empty element.
    Element is ID: 3 DESCRIPTION: Laptop PC
    Element is an empty element.
    Element is ID: 4 DESCRIPTION: Desktop PC
    Element is an empty element.
    Element is ID: 5 DESCRIPTION: Scanner
    --------------------------------------------------
    Sparsely populated elements: 5
    DECLARE
    *                                                 
    ERROR at line 1:                                  
    ORA-01403: no data found                          
    ORA-06512: at line 14                             
    ORA-06512: at line 35
    What's not in the code (or what I did not understand)? Help please!

    Your error occurs because you are dealing with a sparsely populated collection and using an index for items that do not exist.

    For collections of the low density of population, you must iterate through using FIRST and THEN as modeled not from 1 to COUNT.

    The crucial difference between your code and the example is:

    tempParts(i)
    

    Which, as you have demonstrated, doesn't work very well (!) if there is no item (i).

    The code example is a little unusual in my opinion.

       currentElement := p_collection.FIRST;
       FOR i IN 1 .. p_collection.COUNT
       LOOP
        ...
        currentElement := p_collection.NEXT(currentElement);
       END LOOP;
    

    It works, but it's an unusual way to iterate through a collection of rare which is perhaps most often done like this:

       currentElement := p_collection.FIRST;
       WHILE(currentElement IS NOT NULL)
       LOOP
        ...
        currentElement := p_collection.NEXT(currentElement);
       END LOOP;
    

    Which is perhaps less open to confusion.

    In the end, the distinction between

    tempParts(currentElement).id
    

    and

    tempParts(i).id
    

    is crucial.

  • Problem with comparison column multi Nested Tables

    Hello

    I am facing a problem while comparing two collections using operator of type MULTISET. Below I pasted code examples referring to the Employees table in the HR schema.
    program works very well, if it's a single column if I declare that, tab type is table of varchar2 (n);

    Example code:
    --create type base_type as object (id number,name varchar2(10));
    --create type type_tab is table of base_type;
    declare
    v type_tab :=type_tab();
    v2 type_tab :=type_tab();
    v3 type_tab :=type_tab();
    v1 number;
    begin
    select base_type(employee_id,last_name) bulk collect into v from employees where employee_id in (100,101,102);
    select base_type(employee_id,last_name) bulk collect into v2 from employees where employee_id in (100,101);
    
    v3:= v MULTISET EXCEPT v2;
    end;
    Error
    ERROR on line 10:
    ORA-06550: line 10, column 6:
    PLS-00306: wrong number or types of arguments in the call to 'MULTISET_EXCEPT_ALL '.
    ORA-06550: line 10, column 1:
    PL/SQL: Statement ignored

    Could you please address the issue and guide me how to solve this problem.
    Thank you.
    Renji

    Why would you use collections like this in the first place?

    When the data is the engine of SQL, then use the SQL engine to to deal with - not PL/SQL. And no - nested tables have no place in a good, working, flexible, high-performance and scalable relational design in Oracle.

    To do this, use the multiset SQL function - example

    .. your plsql code..
    
      select
        v MULTISET EXCEPT v2 into  v3
      from dual;
    end;
    

Maybe you are looking for

  • My Mute button light won't

    I have a Pavilion Notebook - 15 model No. ab032tx On the installation of the IDE, audio driver, it gives the error that it is not supported and is abandoned. Help, please

  • I have a virus, but where?

    I just started out of Office responses from my contacts and have had a call from a friend saying that I have sent 2 emails in 30mins last that something like this: Hey! Signed with my email address. ----- I went through all the threads here who say "

  • Using the output with 6009 or 6216 possible buffer?

    Hello I have a USB6009 and a USB6216. I need to generate a signal by using the analog output and I would use the output buffer. My questions are: -The USB6009 has an output buffer? I always get an error, but I know from experience that this device is

  • Error followed by phone call report scam.

    Hi all 4-5 days, I allowed my system to make an error report after a glitch that makes Windows close. I have not done this before and hardly have these glitches. Today, I got a phone call from an Indian call centre telling me that they were Microsoft

  • LV/CVI how can I access variables 'unique process' shared by his name?

    LabviewCVI 9.0, how can I access a variable shared 'unique process' by his name?