Nested table update gets ORA-00904 with ExecuteSQL, error-free in TOAD

I'm trying to run an UPDATE query through the ExecuteSQL method
of the oraDatabase object. The catch seems to be that this one
affects a nested table (field to be updated is a table itself).
This SQL runs perfectly in T.O.A.D. ...
UPDATE B457.AIRLINE a SET
a.rental_cust_code=B457.RENTCUSTCODELIST(rentcustcodes
('45645'),rentcustcodes('1234'),rentcustcodes('234234')) WHERE
a.AIRLINE_CODE='RCR'
...but, it produces the "SQL execution error, ORA-00904: invalid
column name" when run using ExecuteSQL.
Do I need to use a different syntax?

and the complete example
SQL> create or replace TYPE t_indirizzo AS OBJECT (
  2  via VARCHAR(45),
  3  numero NUMBER,
  4  cap INTEGER(5),
  5  citta VARCHAR(30),
  6  provincia VARCHAR(30),
  7  regione VARCHAR(30)
  8  );
  9  /
Type created.
SQL>
SQL>
SQL> create or replace TYPE t_telefono AS OBJECT (
  2  num_tel NUMBER(15)
  3  );
  4  /
Type created.
SQL>
SQL> create or replace TYPE t_listaTelefono AS TABLE OF t_telefono
  2  /
Type created.
SQL>
SQL> create or replace TYPE t_cliente AS OBJECT (
  2  cod_cliente NUMBER(8),
  3  indirizzo t_indirizzo,
  4  email VARCHAR(30),
  5  telefono t_listaTelefono
  6  ) NOT FINAL;
  7  /
Type created.
SQL>
SQL> CREATE TABLE cliente OF t_cliente(
  2  cod_cliente NOT NULL,
  3  indirizzo NOT NULL,
  4  email NOT NULL,
  5  PRIMARY KEY (cod_cliente)
  6  ) nested table telefono store as numTelCli_tab
  7  return as value
  8  /
Table created.
SQL>

Similar Messages

  • Getting ora:00904 invalid indentifier error while running i query

    Hi,
    I have a remote database and local database both are oracle 10gR2.Now i have written the below mentioned query in my local database and is working fine,but in case remote database it is throughing error ora:00904 invalid indentifier.
    I had export the dump from remote db and import it on my local db and i tried the same and it is working fine on local after that also.
    As i believe that this error usually come for column name not exist or column name or it's length or for any special character in column name of the table.But as i said it is working fine on local db but not in remote db though i am using the same dump for local and remote.
    Though when i am querying the table i can able to fetch data for the any record but when i am using the below mentioned query for the same i am getting the error.As i am doing this to fecth the data for child parent related relationship.
    Can any one suggest is there anything related to configaration or something else.
    Please do let me know if you do want some more information on the query what i am doing inside of it.
    Rgds,
    Anit
    Edited by: Anit A. on Sep 1, 2008 2:32 AM
    Edited by: Anit A. on Sep 1, 2008 2:33 AM

    WITH t
    AS
    SELECT decode(t.spnlevel
    ,3,t.u_quotesdtlid
    ,2,decode((select count(*)
    from u_quotesdtl t2
    where t2.u_quotesdtlid = t.u_quotesdtlid
    and t2.parentspn = (t2.jobgroupid||':'||t2.jobtype)
    ),0,(select t1.u_quotesdtlid
    from u_quotesdtl t1
    where t1.spnitemcode = t.parentspn
    and t1.spnlevel = '3'
    and t1.jobtype = t.jobtype
    and t1.jobgroupid = t.jobgroupid
    and t1.QUOTEID = t.QUOTEID
    ),t.u_quotesdtlid
    ,1,decode((select count(*)
    from u_quotesdtl t2
    where t2.QUOTEID = t.QUOTEID
    and t2.parentspn = (t2.jobgroupid||':'||t2.jobtype)
    ),0,t.u_quotesdtlid,decode((select count(*)
    from u_quotesdtl t3
    where t3.QUOTEID = t.QUOTEID
    and t3.parentspn = (t3.jobgroupid||':'||t3.jobtype)
    and t3.u_quotesdtlid in (select t1.u_quotesdtlid
    from u_quotesdtl t1
    where t1.spnitemcode = t.parentspn
    and t1.spnlevel = '2'
    and t1.jobtype = t.jobtype
    and t1.jobgroupid = t.jobgroupid
    and t1.QUOTEID = t.QUOTEID
    ),0,(select t4.u_quotesdtlid
    from u_quotesdtl t4
    ,(select t1.parentspn
    ,t1.jobtype
    ,t1.jobgroupid
    from u_quotesdtl t1
    where t1.spnitemcode = t.parentspn
    and t1.spnlevel = '2'
    and t1.jobtype = t.jobtype
    and t1.jobgroupid = t.jobgroupid
    and t1.QUOTEID = t.QUOTEID
    ) t5
    where t4.spnitemcode = t5.parentspn
    and t4.spnlevel = '3'
    and t4.jobtype = t5.jobtype
    and t4.jobgroupid = t5.jobgroupid
    and t4.QUOTEID = t.QUOTEID
    (select t1.u_quotesdtlid
    from u_quotesdtl t1
    where t1.spnitemcode = t.parentspn
    and t1.spnlevel = '2'
    and t1.jobtype = t.jobtype
    and t1.jobgroupid = t.jobgroupid
    and t1.QUOTEID = t.QUOTEID
    ,null,t.u_quotesdtlid) as parentquoteid
    ,t.u_quotesdtlid as quotesdtlid
    ,t.spnlevel as spnlevel
    FROM u_quotesdtl t
    WHERE t.QUOTEID ='som key id'
    ORDER BY parentquoteid,t.spnlevel desc
    select * from t;

  • Why do I get a "DATE1 : ORA-00904 Invalid identifier" error ?

    Hi,
    Despite my efforts, I can't see why I get a "DATE1 : ORA-00904 Invalid identifier' error whith this request.
    {code}With S1 as (
    SELECT TRUNC(DATE1, 'MM'),
    ROUND(SUM(VALEUR), 2)
    FROM EVV_E036
    GROUP BY TRUNC(DATE1, 'MM')
    ORDER BY TRUNC(DATE1, 'MM'))
    SELECT n,
    NVL(ROUND(SUM(Valeur),2), 0)
    FROM (select add_months(to_date('01/01/2006', 'dd/mm/yyyy'), level - 1) n FROM dual connect by level <= 12) months
    LEFT JOIN S1
    ON months.n = TRUNC(DATE1, 'MM')
    GROUP BY n
    ORDER BY n{code}
    The line in error is this one : {code}ON months.n = TRUNC(DATE1, 'MM'){code}
    Any idea much appreciated !
    Regards,
    Christian

    hi,
    I have done this and get no more errors. Now I see that the values I get are equal to 0. Or, I do get values different from 0 in my table ! I can't see why the left join gives 0. I have to dig this and come back tomorrow.
    With S1 as (
    SELECT TRUNC(DATE1, 'MM') Date1,
           ROUND(SUM(VALEUR), 2) Debit
    FROM   EVV_E036
    WHERE  CLEF_VAR = (SELECT CLEF_VAR FROM SITE_ECHELLE WHERE SITE = 'E036')
    AND    DATE1 BETWEEN TO_DATE ('01/01/2007000000', 'DD/MM/YYYYHH24MISS') AND TO_DATE ('31/12/2007235959', 'DD/MM/YYYYHH24MISS')
    GROUP  BY TRUNC(DATE1, 'MM')
    ORDER  BY TRUNC(DATE1, 'MM'))
    SELECT n,
           NVL(ROUND(SUM(Debit),2), 0)
    FROM   (select add_months(to_date('01/01/2006', 'dd/mm/yyyy'), level - 1) n FROM dual connect by level <= 12) months
    LEFT JOIN S1
         ON months.n = date1
    GROUP BY n
    ORDER BY n

  • ORA-00904 with bitmap indexes

    Hi,
    I'm running the following query:
    SELECT
    FLOW.PRODUCT_CODE,
    FLOW.CUSTOMER_SK,
    FLOW.BRAND_SK,
    26,
    FLOW.MPR_SK
    FROM     
    RSB_FACT_FLOW_SD          FLOW,
    RSB_DIM_FLOW               DIM
    WHERE     
    FLOW.FLOW_SK     = DIM.FLOW_SK
    AND     DIM.FLOW_ID                = 'CFRD'
    AND     FLOW.PRODUCT_CODE          = 'G'
    AND     FLOW.FLOW_DATE                >= '01 JAN 2006'
    AND     FLOW.FLOW_DATE                <= '31 JAN 2006'
    AND     EXISTS
         (     SELECT     1
              FROM     RSB_FACT_FLOW_SD          A,
                   RSB_DIM_FLOW          B
              WHERE     
              A.MPR_SK     = FLOW.MPR_SK
         AND A.RECEIVED_DATE >= FLOW.RECEIVED_DATE
              AND     B.FLOW_SK= A.FLOW_SK
              AND     B.FLOW_ID= 'WAO2'
              AND      A.REASON= '02CRO'
    I get ORA-00904: "FLOW"."RECEIVED_DATE": invalid identifier
    This is the defintion of the table:
    CREATE TABLE RSB_FACT_FLOW_SD
    PRODUCT_CODE CHAR(1) NOT NULL,
    WEEK_END_DATE DATE NOT NULL,
    CUSTOMER_SK NUMBER(10) NOT NULL,
    CUSTOMER_ATTRIBUTE_SK NUMBER(10) NOT NULL,
    MPR_SK NUMBER(10) NOT NULL,
    MPR_PROFILE_SK NUMBER(10) NOT NULL,
    SPECCOND_PROFILE_SK NUMBER(10) NOT NULL,
    BRAND_SK NUMBER(10) NOT NULL,
    FLOW_SK NUMBER(10) NOT NULL,
    FLOW_DATE DATE,
    RECEIVED_DATE DATE,
    VALIDATION_STATUS CHAR(1),
    FLOW_TYPE CHAR(1),
    RECEIVED_FROM_SENT_TO VARCHAR2(4),
    REASON VARCHAR2(255),
    FLOW_SEQUENCE NUMBER,
    CUSTOMER_SEGMENT_SK NUMBER(10),
    BRAND_PARTNER_SK NUMBER
    TABLESPACE DW_DATA
    PCTUSED 90
    PCTFREE 0
    PARALLEL
    LOGGING;
    CREATE BITMAP INDEX RSB_FACT_FLOW_SD_IX01 ON RSB_FACT_FLOW_SD
    (PRODUCT_CODE) TABLESPACE DW_INDEXES PARALLEL PCTFREE 0 NOLOGGING COMPUTE STATISTICS;
    CREATE BITMAP INDEX RSB_FACT_FLOW_SD_IX02 ON RSB_FACT_FLOW_SD
    (WEEK_END_DATE) TABLESPACE DW_INDEXES PARALLEL PCTFREE 0 NOLOGGING COMPUTE STATISTICS;
    CREATE BITMAP INDEX RSB_FACT_FLOW_SD_IX03 ON RSB_FACT_FLOW_SD
    (CUSTOMER_SK) TABLESPACE DW_INDEXES PARALLEL PCTFREE 0 NOLOGGING COMPUTE STATISTICS;
    CREATE BITMAP INDEX RSB_FACT_FLOW_SD_IX04 ON RSB_FACT_FLOW_SD
    (CUSTOMER_ATTRIBUTE_SK) TABLESPACE DW_INDEXES PARALLEL PCTFREE 0 NOLOGGING COMPUTE STATISTICS;
    CREATE BITMAP INDEX RSB_FACT_FLOW_SD_IX05 ON RSB_FACT_FLOW_SD
    (MPR_SK) TABLESPACE DW_INDEXES PARALLEL PCTFREE 0 NOLOGGING COMPUTE STATISTICS;
    CREATE BITMAP INDEX RSB_FACT_FLOW_SD_IX06 ON RSB_FACT_FLOW_SD
    (MPR_PROFILE_SK) TABLESPACE DW_INDEXES PARALLEL PCTFREE 0 NOLOGGING COMPUTE STATISTICS;
    CREATE BITMAP INDEX RSB_FACT_FLOW_SD_IX07 ON RSB_FACT_FLOW_SD
    (SPECCOND_PROFILE_SK) TABLESPACE DW_INDEXES PARALLEL PCTFREE 0 NOLOGGING COMPUTE STATISTICS;
    CREATE BITMAP INDEX RSB_FACT_FLOW_SD_IX08 ON RSB_FACT_FLOW_SD
    (BRAND_SK) TABLESPACE DW_INDEXES PARALLEL PCTFREE 0 NOLOGGING COMPUTE STATISTICS;
    CREATE BITMAP INDEX RSB_FACT_FLOW_SD_IX09 ON RSB_FACT_FLOW_SD
    (FLOW_SK) TABLESPACE DW_INDEXES PARALLEL PCTFREE 0 NOLOGGING COMPUTE STATISTICS;
    CREATE BITMAP INDEX RSB_FACT_FLOW_SD_IX10 ON RSB_FACT_FLOW_SD
    (RECEIVED_DATE) TABLESPACE DW_INDEXES PARALLEL PCTFREE 0 NOLOGGING COMPUTE STATISTICS;
    CREATE BITMAP INDEX RSB_FACT_FLOW_SD_IX11 ON RSB_FACT_FLOW_SD
    (FLOW_DATE) TABLESPACE DW_INDEXES PARALLEL PCTFREE 0 NOLOGGING COMPUTE STATISTICS;
    CREATE BITMAP INDEX RSB_FACT_FLOW_SD_IX12 ON RSB_FACT_FLOW_SD
    (CUSTOMER_SEGMENT_SK) TABLESPACE DW_INDEXES PARALLEL PCTFREE 0 NOLOGGING COMPUTE STATISTICS;
    CREATE BITMAP INDEX RSB_FACT_FLOW_SD_IX13 ON RSB_FACT_FLOW_SD
    (BRAND_PARTNER_SK) TABLESPACE DW_INDEXES PARALLEL PCTFREE 0 NOLOGGING COMPUTE STATISTICS;
    If I drop the indexes on the table then the error goes away.
    Any ideas??
    Sheena

    ( SELECT 1
    FROM RSB_FACT_FLOW_SD A,
    RSB_DIM_FLOW B
    WHERE
    A.MPR_SK = FLOW.MPR_SK
    AND A.RECEIVED_DATE >= FLOW.RECEIVED_DATE =====>>>>
    AND B.FLOW_SK= A.FLOW_SK
    AND B.FLOW_ID= 'WAO2'
    AND A.REASON= '02CRO'
    Your sub query has the problem.
    You didn't list flow table in the subquery, therefore, you subquery, dont understand about the column.
    specify flow table in the subquery.
    Your outquery tables doesn't recognized in the sub query.
    Jaffar

  • Update fails, uninstalls Adobe with an Error 1303

    I had a employee report that he couldn't open PDF files.
    I go to his machine, and thought thats strange Adobe Reader X isn't installed.  I re-installed and didn't think much about it.
    About 10 minutes later he called again and it was missing again.
    I delved into the issue and found that when the Updater is running, and executing because I have it set to automatically install updates, that it fails with an error:
    error 1303 the installer has insufficient priviledges to access this directory: c:\program files(x86)\Common Files\Adobe\ARM\1.0.  The installation cannot continue.  Log on as an administrator or contact your system administrator.
    I've tried taking ownership of the Adobe folder under c:\programdata\, and the one located in c:\program files(x86)\Common Files and inherited the correct permissions.
    I've restarted the machine and the update always uninstalls Adobe, and then fails to install the update.
    I was thinking it was Kaspersky that was interfering but as best I can tell I disabled the policy and each component from Kaspersky and it still fails to apply the update.
    Any ideas?
    Also the user is an Administrator Account, I double checked.
    Message was edited by: Joshua1F

    Just chiming in to say that I'm seeing the same Adobe Reader update issue with a 64-bit Windows 7 machine (a ThinkPad T410s - also with the Nvidia+Intel switchable graphics setup).  I had tried uninstalling and re-installing, and the install then failed complaining about insufficient rights to the Adobe directory under c:\ProgramData...
    The KB947821 Windows patch mentioned earlier in this thread is the "System Update Readiness Tool for Windows 7 for x64-based Systems (KB947821) [May 2011]". Here's the description:
    This tool is being offered because an inconsistency was found in the Windows servicing store which may prevent the successful installation of future updates, service packs, and software.
    Installing it as I type...  OK... The Microsoft update complete successfully, but the Adobe Reader install failed again with the same error about c:\ProgramData\Adobe. I then re-applied the inheritable permissions from c:\programdata to the Adobe subdirectory and below...
    The Adobe Reader then Installed successfully, and I'm fairly optimisitic that future updates will go smoothly as well.
    Speaking of which, Adobe updates are too frequent and too visible. I get annoyed with how often Flash or Reader is getting some update or other... Ironically, I'm eager for another Reader Update now, to test this :-).

  • Get ORA-01031: insufficient privileges error, but only when using dbstart.

    I am getting ORA-01031: insufficient privileges error, but only when using dbstart. the listener starts but not the database. How come I can start it from SQL prompt but not from dbstart scripts as the oracle user?
    [oracle@mallard bin]$ ./dbstart
    Processing Database instance "gf44": log file /prod/oracle/10/startup.log
    [oracle@mallard bin]$
    Log file:
    Wed Aug 20 10:15:02 CDT 2008
    SQL*Plus: Release 10.2.0.1.0 - Production on Wed Aug 20 10:15:02 2008
    Copyright (c) 1982, 2005, Oracle. All rights reserved.
    SQL> ERROR:
    ORA-01031: insufficient privileges
    SQL> ORA-01031: insufficient privileges
    SQL>
    /prod/oracle/10/bin/dbstart: Database instance "gf44" warm started.
    >
    oratab file:
    gf44:/prod/oracle/10:Y
    dbstart file section:
    # See if it is a V6 or V7 database
    VERSION=undef
    if [ -f $ORACLE_HOME/bin/sqldba ] ; then
    SQLDBA=svrmgrl
    VERSION=`$ORACLE_HOME/bin/sqldba command=exit | awk '
    /SQL\*DBA: (Release|Version)/ {split($3, V, ".") ;
          print V[1]}'`
    case $VERSION in
    "6") ;;
    *) VERSION="internal" ;;
    esac
    else
    if [ -f $ORACLE_HOME/bin/svrmgrl ] ; then
    SQLDBA=svrmgrl
    VERSION="internal"
    else
    SQLDBA="sqlplus /nolog"
    fi
    fi
    Permissions of file:
    [oracle@mallard bin]$ ls -la dbstart
    -rwxrwxr-x 1 oracle oinstall 10407 Aug 19 12:27 dbstart
    [oracle@mallard bin]$
    User permissions:
    [root@mallard 10]# id oracle
    uid=503(oracle) gid=503(oinstall) groups=503(oinstall),504(dba)
    [root@mallard 10]#
    I can start the listener manually using "./lsnrctl start" and start the database manually from sql prompt using "SQL>startup" (as sysdba) with no problems. this only happens when using dbstart file. I am logged in as oracle user and all environment variables are set
    Thank you for any help you could provide.

    I have the same problem, but i don't want insert this string
    Connect sys/{password} as sysdbaI have deployed an Oracle 10g with os SunOS
    $ uname -a
    SunOS DB02 5.10 Generic_141444-09 sun4v sparc SUNW,Sun-Blade-T6320
    I can connect with sys/password, but I can't login with
    $ sqlplus /nolog
    SQL*Plus: Release 10.2.0.1.0 - Production on Thu Jan 7 15:19:50 2010
    Copyright (c) 1982, 2005, Oracle.  All rights reserved.
    SQL> connect / as sysdba
    ERROR:
    ORA-01031: insufficient privilegesthe the startup and dbshut don't work.
    Someone maybe help me?
    Thanks,
    Regards.
    Lain

  • TS3694 During my latest update it came back with an error 1603 - please advise....

    During my latest update it came back with an error 1603 - please advise....

    And what did the error message say?

  • Update statement getting ORA-00904 invalid identifier

    I am getting this ORA error when I try to conduct an update statement from a column value in one table to a like-named column in another table.
    For instance, in my select, shown below, this query runs like a champ, returning all of my records
    SELECT
    b.ID,
    b.ZIP, a.ZIP,
    a.NAME,
    a.LOCATION
    FROM TBL_ARCHIVE a
    INNER JOIN TBL_UAT b ON
    a.ID = b.ID
    WHERE
    b.ID > 470000  And b.ID <470100;However, if I try to run an update statement with any of the following, I get this error. It seems so strange to me that I'd get an error using the same columns in the update statement, but would return the desired results effectively from the select statement!
    one version of UPDATE
    UPDATE TBL_ARCHIVE a
    SET a.ZIP = TBL_UAT.ZIP
    WHERE TBL_UAT.ID = a.ID;and another
    UPDATE TBL_ARCHIVE
    SET a.ZIP  =
    (SELECT b.ZIP
    FROM TBL_UAT b
    WHERE b.ID <472500 And b.ID >471000)
    FROM TBL_ARCHIVE a
    WHERE a.ID = b.ID)
    WHERE ID IN
    (SELECT ID
    FROM TBL_UAT b
    WHERE b.ID  <472500 And b.ID >471000
    );^ - this one produces a SQL not properly ended. Error ORA-00933: SQL command not properly ended.
    I'm really unsure though, how what I thought was a fairly basic update statement wouldn't work. I'm using Oracle 11g but through either Toad or SQL Plus. I've gotten these same errors in both.
    Though MS Access runs slow as snails, I can manage to run the update statement successfully with it, a thousand records or so at a time. Problem is, I've got about 300K records needing updating.
    I've looked around for similar problems but haven't found one where someone wasn't either using a reserved word for a column, which I'm not, I don't believe, or a problem that really dealt with this error in the context of an update statement.
    But I'd welcome any enlightenment on this.

    rp0428 wrote:
    UPDATE TBL_ARCHIVE a
    SET a.ZIP = TBL_UAT.ZIP
    WHERE TBL_UAT.ID = a.ID;That isn't a valid query and neither is the other one.
    Please post the actual query you are using and the actual complete error message you are getting (everything about the error that is displayed).^^
    That is NOT a valid query?
    How else would you have an UPDATE statement created to set the value of a column in table A to the value of a (in this case, same named) column in table B?
    And keep them in order to update the records appropriately?
    I'll append the create statements momentarily.
    Thanks!
    CREATE TABLE TBL_UAT
    ( ID NUMBER(6),
    ZIP VARCHAR2(10 BYTE) ) and
    CREATE TABLE TBL_ARCHIVE
    ( ID NUMBER(6) NOT NULL, NAME VARCHAR2(50 BYTE),
    EMAIL VARCHAR2(50 BYTE),
    LOCATION VARCHAR2(50 BYTE),
    DEPARTMENT VARCHAR2(50 BYTE),
    PRIORITY VARCHAR2(50 BYTE),
    APPROVING_MGR_NAME VARCHAR2(50 BYTE),
    TYPE1 VARCHAR2(50 BYTE),
    TYPE2 VARCHAR2(50 BYTE),
    CONTACT_NAME VARCHAR2(50 BYTE),
    CONTACT_PHN_NO VARCHAR2(50 BYTE),
    LOAN_NUM VARCHAR2(50 BYTE),
    REF_ID VARCHAR2(50 BYTE),
    BORROWER_NAME VARCHAR2(50 BYTE),
    ADDRESS VARCHAR2(50 BYTE),
    CITY VARCHAR2(50 BYTE),
    ST VARCHAR2(50 BYTE),
    ZIP VARCHAR2(10 BYTE),
    SALE_DATE DATE,
    COMMENTS VARCHAR2(800 BYTE),
    TIME_REQ DATE,
    ACCTLOC VARCHAR2(50 BYTE),
    OTHER_ACCTLOC VARCHAR2(50 BYTE)) Hope this can be of assistance.
    Thanks, folks!
    Edited by: user515689 on Feb 7, 2012 11:59 AM

  • Getting ORA-00904 whle running a procedure!

    hi ,
    the following procedure is meant for getting the details which has name of the user tables alone along with number of columns,but am getting -ERROR IN BLOCK:::ORA-00904: "tablename": invalid identifier.
    DECLARE
    v_cols NUMBER:=0;
    cursor c is SELECT table_name FROM user_tables ORDER BY table_name;
    BEGIN
    FOR rec IN c
    LOOP
    v_cols:=0;
    EXECUTE IMMEDIATE 'select count(COLUMN_NAME) from all_col_comments where TABLE_NAME in ('||rec.table_name||') group by TABLE_NAME' INTO v_num_rows;
    DBMS_OUTPUT.PUT_LINE (RPAD (rec.table_name, 32) || LPAD (v_num_rows, 9));
    END LOOP;
    DBMS_OUTPUT.PUT_LINE ('-------------------End_of_Script-------------------');
    EXCEPTION
    WHEN OTHERS THEN
    DBMS_OUTPUT.PUT_LINE('ERROR IN BLOCK:::'||SQLERRM);
    END;
    if there anything needs to change in procedure ,let me know.

    DECLARE
           v_cols NUMBER:=0;
           cursor c is SELECT table_name FROM user_tables ORDER BY table_name;
    BEGIN
           FOR rec IN c
          LOOP
              v_cols:=0;
          EXECUTE IMMEDIATE 'select count(COLUMN_NAME) from all_col_comments where TABLE_NAME in ('''||rec.table_name||''') group by TABLE_NAME' INTO v_num_rows;      ------> Added '' before and After Table Name to allow Oracle to consider as String
              DBMS_OUTPUT.PUT_LINE (RPAD (rec.table_name, 32) || LPAD (v_num_rows, 9));
          END LOOP;
          DBMS_OUTPUT.PUT_LINE ('-------------------End_of_Script-------------------');
    EXCEPTION
    WHEN OTHERS THEN
    DBMS_OUTPUT.PUT_LINE('ERROR IN BLOCK:::'||SQLERRM);
    END;You can use below version using Parameter Binding (Untested!!!)
    DECLARE
           v_cols NUMBER:=0;
           cursor c is SELECT table_name FROM user_tables ORDER BY table_name;
    BEGIN
           FOR rec IN c
          LOOP
              v_cols:=0;
          EXECUTE IMMEDIATE 'select count(COLUMN_NAME) from all_col_comments where TABLE_NAME in (:1) group by TABLE_NAME' INTO v_num_rows using rec.table_name;
              DBMS_OUTPUT.PUT_LINE (RPAD (rec.table_name, 32) || LPAD (v_num_rows, 9));
          END LOOP;
          DBMS_OUTPUT.PUT_LINE ('-------------------End_of_Script-------------------');
    EXCEPTION
    WHEN OTHERS THEN
    DBMS_OUTPUT.PUT_LINE('ERROR IN BLOCK:::'||SQLERRM);
    END;

  • Getting ORA-00904 from various SPARQL statements

    Hi,
    I am currently working on a couple of Java services which offer access to semantic information using Jena. I have implemented two possible adapters so far, one "feeds" from an owl-file directly, one from an Oracle 11g (semantic technologies).
    In both cases, I use SPARQL SELECT and CONSTRUCT statements for my queries. Querying the owl-file-based adapter with these statements, everything works fine. querying the Oracle adapter, I often get the following stacktrace:
    Caused by: java.sql.SQLException: ORA-00904: "TYPE": ungültiger Bezeichner
         at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:74)
         at oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:131)
         at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:204)
         at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:455)
         at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:413)
         at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:1034)
         at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:194)
         at oracle.jdbc.driver.T4CPreparedStatement.executeForDescribe(T4CPreparedStatement.java:791)
         at oracle.jdbc.driver.T4CPreparedStatement.executeMaybeDescribe(T4CPreparedStatement.java:866)
         at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1186)
         at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3387)
         at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:3431)
         at oracle.jdbc.driver.OraclePreparedStatementWrapper.executeQuery(OraclePreparedStatementWrapper.java:1203)
         at oracle.spatial.rdf.client.jena.Oracle.executeQuery(Oracle.java:352)
         at oracle.spatial.rdf.client.jena.Oracle.executeQuery(Oracle.java:315)
         at oracle.spatial.rdf.client.jena.OracleSemQueryPlan.executeBindings(OracleSemQueryPlan.java:431)
         ... 65 more
    The SELECT statement used is:
    ==============
    PREFIX owl: <http://www.w3.org/2002/07/owl#>
    PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
    PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
    SELECT DISTINCT ?type ?label ?comment
    WHERE { <http://www.demo-uri.com/test.owl#demoInstance> rdf:type ?type .
    OPTIONAL { <http://www.demo-uri.com/test.owl#demoInstance> rdfs:label ?label .
    FILTER(langMatches(lang(?label),'de') || (!langMatches(lang(?label),'*'))) . }
    OPTIONAL { <http://www.demo-uri.com/test.owl#demoInstance> rdfs:comment ?comment .
    FILTER(langMatches(lang(?comment),'de') || (!langMatches(lang(?comment),'*'))) }
    ==============
    The generated SELECT clause is:
    SELECT type$RDFVTYP, type$RDFLTYP, type$RDFLANG, type$RDFCLOB, decode(type$RDFVTYP, 'BLN', ('_:'||substr(type,instr(type,'m',4)+1)), type) type
    FROM table(sdo_rdf_match('(<http://www.demo-uri.com/test.owl#demoInstance> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> ?type) ', sdo_rdf_models('DEMO_MODEL'), sdo_rdf_rulebases('OWLPRIME'), null, null, NULL,' '))
    I am really grateful for any advise! A simple statement like
    [...]WHERE { <http://www.demo-uri.com/test.owl#demoInstance> rdf:type ?type }
    works fine.
    Best,
    Damian

    Thanks for the reply.
    I have changed the statement according to your advice:
    PREFIX owl: <http://www.w3.org/2002/07/owl#>
    PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
    PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
    SELECT DISTINCT ?typ ?lbl ?cmnt
    WHERE { <http://www.demo-uri.com/test.owl#demoInstance> rdf:type ?typ .
    OPTIONAL { <http://www.demo-uri.com/test.owl#demoInstance> rdfs:label ?lbl .
    FILTER(langMatches(lang(?lbl),"de") || (!langMatches(lang(?lbl),"*"))) . }
    OPTIONAL { <http://www.demo-uri.com/test.owl#demoInstance> rdfs:comment ?cmnt .
    FILTER(langMatches(lang(?cmnt),"de") || (!langMatches(lang(?cmnt),"*"))) }}
    but still the same stacktrace :(
    Caused by: java.sql.SQLException: ORA-00904: "TYP": ungültiger Bezeichner
         at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:74)
         at oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:131)
         at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:204)
         at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:455)
         at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:413)
         at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:1034)
         at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:194)
         at oracle.jdbc.driver.T4CPreparedStatement.executeForDescribe(T4CPreparedStatement.java:791)
         at oracle.jdbc.driver.T4CPreparedStatement.executeMaybeDescribe(T4CPreparedStatement.java:866)
         at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1186)
         at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3387)
         at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:3431)
         at oracle.jdbc.driver.OraclePreparedStatementWrapper.executeQuery(OraclePreparedStatementWrapper.java:1203)
         at oracle.spatial.rdf.client.jena.Oracle.executeQuery(Oracle.java:352)
         at oracle.spatial.rdf.client.jena.Oracle.executeQuery(Oracle.java:315)
         at oracle.spatial.rdf.client.jena.OracleSemQueryPlan.executeBindings(OracleSemQueryPlan.java:431)
         ... 65 more
    Edited by: user13170651 on 22.09.2010 02:32

  • Nested table updation in FOR Cursor loop

    Hello,
    I have nested table as follows:
    SQL> desc fp
    Name Null? Type
    ORDER_NUM NOT NULL VARCHAR2(10)
    ORDER_TIE_NUM NOT NULL VARCHAR2(10)
    FACILITY NOT NULL VARCHAR2(10)
    ON_SHORTS NUMBER(2)
    ACTIVE_SHORTS NUMBER(2)
    PARTS DPM_TRANSFORM_CODE.FP_SLC_SHORT
    FIRST_SHORT DATE
    LAST_SHORT DATE
    SQL> desc DPM_TRANSFORM_CODE.FP_SLC_SHort
    DPM_TRANSFORM_CODE.FP_SLC_SHort TABLE OF DPM_TRANSFORM_CODE.FP_SHORT_INFO
    Name Null? Type
    PART_NUM VARCHAR2(7)
    AREA VARCHAR2(7)
    PART_QTY NUMBER(3)
    ON_SHORT_CNT NUMBER(4)
    OFF_SHORT_CNT NUMBER(4)
    FIRST_DATE DATE
    LAST_DATE DATE
    UPDATE TABLE(SELECT PARTS FROM DPM_REPORTING.FP WHERE ORDER_NUM = P.ORDER_NUM AND ORDER_TIE_NUM = P.ORDER_TIE_NUM) PARTS
    SET PARTS.OFF_SHORT_CNT = PARTS.OFF_SHORT_CNT + 1
    WHERE PARTS.last_date < SYSDATE - 2/24;
    This Update Statement is in FOR Cursor Loop
    where select statement for the cursor is
    "SELECT ORDER_NUM,ORDER_TIE_NUM,PARTS FROM DPM_REPORTING.FP WHERE FACILITY = 'PN1'"
    This select statement generates 20000 records & due to which the Update statement gets executed that many times inside FOR loop.The Procedure has become quite slow due to this.
    Please help.
    Thanks,
    Rekha

    You could do it all in one sql update statement, without any pl/sql or cursor or looping:
    UPDATE fp t1
    SET    t1.parts =
           CAST (MULTISET (SELECT part_num, area, part_qty, on_short_cnt,  
                                  CASE WHEN last_date < SYSDATE - 2/24
                                       THEN off_short_cnt + 1
                                       ELSE off_short_cnt
                                  END,  
                                  first_date, last_date
                           FROM   TABLE (SELECT parts
                                         FROM   fp
                                         WHERE  facility = 'PN1'
                                         AND    order_num = t1.order_num
                                         AND    order_tie_num = t1.order_tie_num))    
                 AS fp_slc_short)
    WHERE  t1.facility = 'PN1'
    /

  • Getting ORA-22922 with apex_collection.create_collection_from_query

    Hi,
    i'm getting ora-22922 nonexistent LOB value with
    apex_collection.create_collection_from_query('coll_name','select a,b,c from testtable','NO');
    what is going wrong?
    please help !!
    thx in advance !!!

    Hi Dila,
    unless you let us know what
    TESTTABLEexactly is, we probably can't help you.

  • Multi-row sub query returns  ORA-00904 :invalid identifier error

    I am creating a report from two tables that I am not joining. I want a single line for every row in table1 that meets a date range. Table2 can contain none or many rows for each recored in table1. I want to get up to two fields from table2.
    I was using a case statement to check if there was data and then an in-line query or subquery. Once again, the idea is to have a single line on the report for each table1 record.
    I get this error with the code below. It seems the nested multi-row subquery can not see the a.cr_mas_cr_no identifier.
    ORA-00904: "a"."cr_mas_cr_no": invalid identifier
    Any help is greatly appreciated,
    Sam
    select
    a.cr_mas_cr_no "CRNO", a.cr_mas_type "TYPE", a.cr_mas_status "CR Status",
    a.cr_mas_date_logged "Logged date", a.CR_REL_REQ_APP_DATE "RTP approved",a.CR_REL_REQ_RTP_DATE "RTP Date",
    a.cr_accepted_date "Complete", a.cr_mas_submitted_by "Requester",
    select doc_user FROM crrm_cr_documents WHERE doc_cr_number =a.cr_mas_cr_no and rownum = 1 and DOC_TYPE = 'BD' ) "Bus Design",
    (select doc_user FROM crrm_cr_documents WHERE doc_cr_number = a.cr_mas_cr_no and rownum = 1 and DOC_TYPE = 'TD' ) "Tech Design",
    (select doc_user FROM crrm_cr_documents WHERE doc_cr_number = a.cr_mas_cr_no and rownum = 1 and DOC_TYPE = 'TE' ) "User acceptance test",
    case
    when (select count(appr_user) from crrm_cr_approvals where appr_cr_no = a.cr_mas_cr_no and appr_type = 'RTP') > 0
    then (select appr_user from (select * from crrm_cr_approvals where appr_cr_no = a.cr_mas_cr_no and appr_type = 'RTP') where rownum = 1)
    end
    "RTP #1",
    case
    when (select count(appr_user) from crrm_cr_approvals where appr_cr_no = a.cr_mas_cr_no and appr_type = 'RTP') > 1
    then (select appr_user from (select * from crrm_cr_approvals where appr_cr_no = a.cr_mas_cr_no and appr_type = 'RTP') where rownum = 2)
    end
    "RTP #2",
    a.CR_REL_REQ_RTP_BY "Released by",
    a.CR_ACCEPTED_BY "Post RTP User Acceptance",
    a.cr_mas_title "Title", a.cr_mas_id "ID"
    from
    crrm_crmaster a
    where
    (a.CR_REL_REQ_RTP_DATE >= :P1109_BEGDATE and (a.CR_REL_REQ_RTP_DATE <= :P1109_ENDDATE) and
    (a.cr_mas_status = 'Complete' or (a.cr_mas_status = 'Release Approved'and a.CR_REL_REQ_APP_DATE < :P1109_ENDDATE))
    Message was edited by:
    slavanaway

    Iceman,
    Thanks for the reply I will try your suggestion.
    I will try and explain why I think two subqueries (an in-line query with a subquery?) are required. I will use the creation of the column RTP #1 as the example as the RTP #2 column is only different in the rownum selected.
    Looking only at the lines that fail, here is my analysis. (If I rem out the two case lines the query runs, I just don't get two columns of data I need.) I will only examine the first case as the second is changed to extract the second approval via the rownum = 2 criteria. The first statement checks there is at least one RTP approval stored for the request and then gets the user who approved the request if the test is true.
    case when
    (select count(appr_user) from crrm_cr_approvals where appr_cr_no =a.cr_mas_cr_no and appr_type = 'RTP') > 0
    then
    The above part works fine and the correct count of approvals is returned.
    (select appr_user from (select * from crrm_cr_approvals where appr_cr_no=a.cr_mas_cr_no and appr_type = 'RTP') where rownum = 1)
    end
    "RTP #1",
    I moved the parenthesis to the correct location. There can be multiple approvals for a given parent record. Some parent records need one, some need two approvals. If I replace
    (select appr_user from (select * from crrm_cr_approvals where appr_cr_no =a.cr_mas_cr_no and appr_type = 'RTP') where rownum = 1)
    with
    (select appr_user from approvals where appr_cr_no =a.cr_mas_cr_no and appr_type = 'RTP' and rownum = 1)
    The correct result is returned because it returns exactly one row as rownum=1 limits the query. When rownum = 2 then the query returns null as the rownum never gets to two as the rownum column is built via the set created by the second subquery.
    The subquery builds a set of approvals for a specific "cr_no" and appr_type of "RTP". the outer query then looks at the rownum of the second query
    Here is where I got the rownum information from;
    http://www.oracle.com/technology/oramag/oracle/06-sep/o56asktom.html
    So here is what I think is happening;
    1. Main query From and Where are processed. This should provide the "set" for the query
    2.The from subqueries for RTP #1 and RTP #2 should be able to access the a.cr_mas_cr_no field and build a set from the approvals table.
    3.The RTP #1/2 subquery (inline maybe a better description?) would then get the correct row from the from subquery.
    The error "invalid identifier" refers to the a.cr_mas_cr_no field. I assume it means it can not resolve the table alias inside the subquery.
    So maybe your grouping would help, I will try.
    Sam

  • ORA-00904 invalid identifier error

    Here are the steps to reproduce this. My DB version is 9i R2.
    1) create table xmlsun1 of xmltype;
    2) create table xmlsun2 as select * from xmlsun1;
    Two Tables of XML Type created successfully
    3) insert into xmlsun1 values(xmltype('<employees><employee id="35"><FirstName>Tom</FirstName><LastName>Kyte</LastName></employee></employees>'));
    4) insert into xmlsun2 values(xmltype('<employees><employee id="35"><FirstName>Tom</FirstName><LastName>Kyte</LastName></employee></employees>'));
    Now when i query, i can see one record in each tables.
    The problem is only when updation.
    5) update xmlsun1 x
    set value(x) = updatexml(value(x),'/employees/employee/@id','37')
    where existsnode(value(x),'/employees/employee[FirstName = "Tom"]') = 1;
    1 row updated
    6) update xmlsun2 x
    set value(x) = updatexml(value(x),'/employees/employee/@id','37')
    where existsnode(value(x),'/employees/employee[FirstName = "Tom"]') = 1;
    This updation fails with the error : ORA-01775: looping chain of synonyms
    I tried to change alias of xmlsun2 to y
    update xmlsun2 y
    set value(y) = updatexml(value(y),'/employees/employee/@id','37')
    where existsnode(value(y),'/employees/employee[FirstName = "Tom"]') = 1;
    I get an error saying that Y is an invalid identifier. Now, how can i update the table xmlsun2? I can't use the alias x nor any other alias.
    Thanks,
    Sundar

    I've filed bug 5560960 for this behavoir, which is still not what you are describing.. Do you have SYNONYMS defined somewhere in your example ?
    $ sqlplus scott/tiger @testcase3
    SQL*Plus: Release 9.2.0.6.0 - Production on Fri Sep 22 11:59:46 2006
    Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
    Connected to:
    Oracle9i Enterprise Edition Release 9.2.0.6.0 - Production
    With the Partitioning, OLAP and Oracle Data Mining options
    JServer Release 9.2.0.6.0 - Production
    SQL> drop table xmlsun1
    2 /
    Table dropped.
    SQL> create table xmlsun1 of xmltype
    2 /
    Table created.
    SQL> drop table xmlsun2
    2 /
    Table dropped.
    SQL> create table xmlsun2 as select * from xmlsun1
    2 /
    Table created.
    SQL> insert into xmlsun1 values( xmltype ('<employees><employee id="35"><FirstName>Tom</FirstName><LastName>Kyte</LastName></employee></employees>') )
    2 /
    1 row created.
    SQL> insert into xmlsun2 values( xmltype ('<employees><employee id="35"><FirstName>Tom</FirstName><LastName>Kyte</LastName></employee></employees>') )
    2 /
    1 row created.
    SQL> update xmlsun1 x
    2 set value(x) = updatexml(value(x),'/employees/employee/@id','37')
    3 where existsnode(value(x),'/employees/employee[FirstName = "Tom"]') = 1
    4 /
    1 row updated.
    SQL> update xmlsun2 x
    2 set value(x) = updatexml(value(x),'/employees/employee/@id','37')
    3 where existsnode(value(x),'/employees/employee[FirstName = "Tom"]') = 1
    4 /
    where existsnode(value(x),'/employees/employee[FirstName = "Tom"]') = 1
    ERROR at line 3:
    ORA-00904: "X": invalid identifier
    SQL> update xmlsun2 y
    2 set value(y) = updatexml(value(y),'/employees/employee/@id','37')
    3 where existsnode(value(y),'/employees/employee[FirstName = "Tom"]') = 1
    4 /
    where existsnode(value(y),'/employees/employee[FirstName = "Tom"]') = 1
    ERROR at line 3:
    ORA-00904: "Y": invalid identifier
    SQL>

  • Getting ORA-29279: SMTP permanent error: 553

    Error report:
    ORA-29279: SMTP permanent error: 553 Requested action not taken: mailbox name not allowed
    ORA-06512: at "SYS.UTL_SMTP", line 20
    ORA-06512: at "SYS.UTL_SMTP", line 98
    ORA-06512: at "SYS.UTL_SMTP", line 221
    ORA-06512: at "SYS.UTL_MAIL", line 397
    ORA-06512: at "SYS.UTL_MAIL", line 608
    ORA-06512: at line 2
    29279. 00000 - "SMTP permanent error: %s"*Cause: A SMTP permanent error occurred.
    *Action:   Correct the error and retry the SMTP operation..
    The mail server changed in our company and i have updated the smtp_out_server parameter in system to reflect the new ip with the port.
    But when i try testing the utl_mail package, i get this error message. It used to work fine with the old mail server. Nothing else has changed.
    Please advice.
    Thanks
    Kavita

    994008 wrote:
    Error report:
    ORA-29279: SMTP permanent error: 553 Requested action not taken: mailbox name not allowed
    ORA-06512: at "SYS.UTL_SMTP", line 20
    ORA-06512: at "SYS.UTL_SMTP", line 98
    ORA-06512: at "SYS.UTL_SMTP", line 221
    ORA-06512: at "SYS.UTL_MAIL", line 397
    ORA-06512: at "SYS.UTL_MAIL", line 608
    ORA-06512: at line 2
    29279. 00000 - "SMTP permanent error: %s"*Cause: A SMTP permanent error occurred.
    *Action:   Correct the error and retry the SMTP operation..
    The mail server changed in our company and i have updated the smtp_out_server parameter in system to reflect the new ip with the port.
    But when i try testing the utl_mail package, i get this error message. It used to work fine with the old mail server. Nothing else has changed.
    Please advice.
    Thanks
    Kavitawhile logged onto the DB then do as below
    telnet <new_mail_server> 25
    post results back here

Maybe you are looking for

  • Rating reset when connecting to iTunes

    I think the title says it all, I use the highest rating playlist a lot, I also set songs I want to remove to a one star rating while listening to later remove the songs. Now, this doesn't work, everything I've changed is back from where I started whe

  • Do payment types really work?

    I have three payment options on the checkout: 1/ Cheque 2/ EFT 3/ Paypal. Paypal works fine, cheque and eft payments record the orders as paid.  Why is this - they are offline payments made by the customer at some point in the future. I have tried us

  • How can i upgrade from os 10.5.8

    I need to upgrade from 10.5.8. What is the easiest way to do that?

  • Why apple password did not work with my Ipod Touch

    why my apple password did not work with my Ipod Touch?

  • Developing a portable application

    Is an API included with the J2ME library that will provide details on the device the application is running on? I developed an application with the main GUI using the Canvas class. I developed it using the Nokia emulator, and all functions and the di