ORA-00904: "AD"."USABLE_TOTAL_MB": invalid identifier

Hi,
The following statment is run successfuly :
SELECT name , type,
           DECODE (TYPE,
                 'EXTERN', 1,
              'NORMAL', 2,
              'HIGH', 3) redundency,
              TOTAL_MB ,
              REQUIRED_MIRROR_FREE_MB ,
              USABLE_FILE_MB ,
              free_mb,
              (total_mb-REQUIRED_MIRROR_FREE_MB)/(DECODE (TYPE,'EXTERN', 1,'NORMAL', 2, 'HIGH', 3)) as "usable_total_mb" 
   FROM v$asm_diskgroup ad;
NAME                           TYPE   REDUNDENCY   TOTAL_MB REQUIRED_MIRROR_FREE_MB USABLE_FILE_MB    FREE_MB usable_total_mb
DATA_DM01                      NORMAL          2   15593472                 5197824        1404732    8007288         5197824
....When i am trying to select from this stament i am getting an error from line 5
SQL> select ad.name,
  2              ad.type,
  3              ad.TOTAL_MB,
  4                     ad.usable_total_mb,
  5                     100 - (ad.usable_file_mb/ad.usable_total_mb)*100      <<<--- Problem line
  6    FROM (SELECT name , type,
  7                 DECODE (TYPE,
  8                        'EXTERN', 1,
  9                        'NORMAL', 2,
10                        'HIGH', 3) redundency,
11                 TOTAL_MB ,
12                        REQUIRED_MIRROR_FREE_MB ,
13                        USABLE_FILE_MB ,
14                        free_mb,
15                        (total_mb-REQUIRED_MIRROR_FREE_MB)/(DECODE (TYPE,'EXTERN', 1,'NORMAL', 2, 'HIGH', 3)) as "usable_total_mb"         
16          FROM v$asm_diskgroup ad);
                        100 - (ad.usable_file_mb/ad.usable_total_mb)*100
ERROR at line 5:
ORA-00904: "AD"."USABLE_TOTAL_MB": invalid identifierPlease advice what is wrong

put the sub query alias AD outside the bracket (line 16)
SQL> select ad.name,
  2              ad.type,
  3              ad.TOTAL_MB,
  4                     ad.usable_total_mb,
  5                     100 - (ad.usable_file_mb/ad.usable_total_mb)*100      <<<--- Problem line
  6    FROM (SELECT name , type,
  7                 DECODE (TYPE,
  8                        'EXTERN', 1,
  9                        'NORMAL', 2,
10                        'HIGH', 3) redundency,
11                 TOTAL_MB ,
12                        REQUIRED_MIRROR_FREE_MB ,
13                        USABLE_FILE_MB ,
14                        free_mb,
15                        (total_mb-REQUIRED_MIRROR_FREE_MB)/(DECODE (TYPE,'EXTERN', 1,'NORMAL', 2, 'HIGH', 3)) as "usable_total_mb"         
16          FROM v$asm_diskgroup) ad;
                        100 - (ad.usable_file_mb/ad.usable_total_mb)*100Edited by: user503635 on Apr 6, 2013 5:35 AM

Similar Messages

  • ORA-00904 - invalid identifier when adding new column to the report query

    Hi,
    I am trying to add a new field to an existing bespoke report query. When I click on ok, I get the following error
    message: "ORA-00904: <field name> : invalid identifier ==> <field_name>
    Any ideas what is causing this problem? Version of the report builder is : 6.0.8 and is connected to a 10.2 db.
    Any help appreciated.
    Many Thanks,
    Praveen
    Edited by: praveenrn on May 21, 2009 2:38 PM

    What is the field name ? Maybe a reserved word ? Change to "my_new_variable" to check...
    Cheers,
    Jens Rettig

  • Invalide identifier error, when use subselect

    Hi all,
    I got "ORA-0094: sp.spriden_pidm invalid identifier "error when runing the following query.
    select (select t.name from
    (select rownum row_number, s.spriden_last_name name
    from spriden s
    where s.spriden_pidm = sp.spriden_pidm) t
    where t.row_number = 1) last_name
    from spriden sp
    where sp.spriden_pidm = 70105;
    Any one has an idea why this is happening?
    Thanks

    Unless I am missing something here, this looks like a straight pivot query to me.
    SQL> with my_test AS (SELECT 1 id, 'June' contact_name FROM dual UNION ALL
      2                   SELECT 1, 'Email' FROM dual UNION ALL
      3                   SELECT 1, 'Mark' FROM dual UNION ALL
      4                   SELECT 2, 'Tom' FROM dual),
      5       my_test_2 AS (SELECT 1 id, trunc(sysdate) act_date FROM dual UNION ALL
      6                     SELECT 1, trunc(sysdate-1) FROM dual UNION ALL
      7                     SELECT 2, trunc(sysdate-1) FROM dual)
      8  SELECT id, act_date,
      9         MAX(DECODE(rn, 1, contact_name)) nc1,
    10         MAX(DECODE(rn, 2, contact_name)) nc2,
    11         MAX(DECODE(rn, 3, contact_name)) nc3
    12  FROM (SELECT m.id, contact_name, act_date,
    13               ROW_NUMBER() OVER (PARTITION BY m.id
    14                                  ORDER BY contact_name) rn
    15        FROM my_test m, my_test_2 m2
    16        WHERE m.id = m2.id and
    17              m2.act_date = trunc(sysdate-1))
    18  GROUP BY id, act_date;
            ID ACT_DATE    NC1   NC2   NC3
             1 11-Sep-2008 Email June  Mark
             2 11-Sep-2008 TomAssuming that you have a known maximum number of possible values in my_test for a given id this should work. You may need to use something other than the contact_name in the order by in the row_number function if you require the values in specific columns, but given your sample data, I have no idea what that might be.
    John

  • PL/SQL: ORA-00904: invalid identifier (DG4ODBC 11.2.0.2 & MySQL)

    I have a PL/SQL script processing information between Oracle database and MySQL database. My script ran perfectly with DG4ODBC 11.1.0.7. Then we upgraded Oracle to 10.2.0 and DG4ODBC 11.2.0.2. Now if I run my script from Solaris command line like ./myscript.shl, I get the following errors:
    PL/SQL: ORA-00904: "cmswhit_moodle1"."mdl_grade_grades"."finalgrade": invalid identifier
    PL/SQL: ORA-00904: "cmswhit_moodle1"."mdl_question_states"."attempt": invalid identifier
    The strange thing is if I run the same query by cut and paste into sqlplus from command line, the query works perfectly without any problems.
    What is the cause of this problem?
    Any help would be greatly appreciated.
    Jeffrey

    Hi Klaus,
    The problem was solved after I updated MySQL ODBC to a new version from 5.1.8 to 5.1.13.
    Summary of the problem and its solution:
    The Problem: It appears that dg4odbc 11.2.0.2 requires a newer version of MyODBC. Previously I used MyODBC 5.1.8 which ran into problems with dg4odbc 11.20.0.2.
    The Solution: After I updated MyODBC to 5.1.13, my PL/SQL scripts all work.
    I need to point out that with MyODBC 5.1.8, I can run queries and updates from SQL*Plus console, but now PL/SQL scripts.
    I'll close this thread.
    Once again, thank you and happy holidays.
    Jeffrey

  • Discoverer report :ORA -00904 Invalid Identifier

    Hi ,
    we are using an apps mode EUL (version4i) ,
    in the business area "Account Receivables"--->Customer Transaction Lines Folder,
    when we pull up any item from this folder to create a report, it shows a
    "ORA-00904 Invalid Identifier " error
    how to fix it , whether the Item might be Deleted in view definition of this folder,
    just a refresh of the folder is enough ?
    thanks in advance

    Hi,
    Refreshing the folder should be your first step.
    Rod West

  • Exception: java.sql.SQLException: ORA-00904: "SEQ_NAME": invalid identifier

    Hi everyone,
    we are facing the below issue when trying to schedule a BI report.
    Error Details:
    +oracle.apps.xdo.servlet.scheduler.ProcessingException: Exception [TOPLINK-4002] (Oracle TopLink - 11g Release 1 (11.1.1.0.0) (Build 080319)): oracle.toplink.exceptions.DatabaseException+
    Internal Exception: java.sql.SQLException: ORA-00904: "SEQ_NAME": invalid identifier
    Error Code: 904
    Call: UPDATE SEQUENCE SET SEQ_COUNT = SEQ_COUNT 50 WHERE SEQ_NAME = 'JOB_ID_SEQ'+
    Query: DataModifyQuery()
    +     at oracle.apps.xdo.servlet.scheduler.toplink.ToplinkDataHandler.insertJob(ToplinkDataHandler.java:830)+
    +     at oracle.apps.xdo.servlet.ui.scheduler.SchedulerServlet.scheduleJob(SchedulerServlet.java:1896)+
    +     at oracle.apps.xdo.servlet.ui.scheduler.SchedulerServlet.doPost(SchedulerServlet.java:293)+
    +     at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)+
    +     at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)+
    +     at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:64)+
    +     at oracle.apps.xdo.servlet.security.SecurityFilter.doFilter(SecurityFilter.java:94)+
    +     at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:621)+
    +     at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:368)+
    +     at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:866)+
    +     at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:448)+
    +     at com.evermind.server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:216)+
    +     at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:117)+
    +     at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:110)+
    +     at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)+
    +     at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)+
    +     at java.lang.Thread.run(Thread.java:595)+
    +Caused by: Exception [TOPLINK-4002] (Oracle TopLink - 11g Release 1 (11.1.1.0.0) (Build 080319)): oracle.toplink.exceptions.DatabaseException+
    Internal Exception: java.sql.SQLException: ORA-00904: "SEQ_NAME": invalid identifier
    Error Code: 904
    Call: UPDATE SEQUENCE SET SEQ_COUNT = SEQ_COUNT 50 WHERE SEQ_NAME = 'JOB_ID_SEQ'+
    Query: DataModifyQuery()
    +     at oracle.toplink.exceptions.DatabaseException.sqlException(DatabaseException.java:296)+
    +     at oracle.toplink.internal.databaseaccess.DatabaseAccessor.executeDirectNoSelect(DatabaseAccessor.java:724)+
    +     at oracle.toplink.internal.databaseaccess.DatabaseAccessor.executeNoSelect(DatabaseAccessor.java:790)+
    +     at oracle.toplink.internal.databaseaccess.DatabaseAccessor.basicExecuteCall(DatabaseAccessor.java:524)+
    +     at oracle.toplink.internal.databaseaccess.DatabaseAccessor.executeCall(DatabaseAccessor.java:467)+
    +     at oracle.toplink.internal.sessions.AbstractSession.executeCall(AbstractSession.java:795)+
    +     at oracle.toplink.internal.queryframework.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:193)+
    +     at oracle.toplink.internal.queryframework.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:179)+
    +     at oracle.toplink.internal.queryframework.DatasourceCallQueryMechanism.executeNoSelectCall(DatasourceCallQueryMechanism.java:222)+
    +     at oracle.toplink.internal.queryframework.DatasourceCallQueryMechanism.executeNoSelect(DatasourceCallQueryMechanism.java:202)+
    +     at oracle.toplink.queryframework.DataModifyQuery.executeDatabaseQuery(DataModifyQuery.java:55)+
    +     at oracle.toplink.queryframework.DatabaseQuery.execute(DatabaseQuery.java:671)+
    +     at oracle.toplink.internal.sessions.AbstractSession.internalExecuteQuery(AbstractSession.java:2260)+
    +     at oracle.toplink.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1074)+
    +     at oracle.toplink.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1058)+
    +     at oracle.toplink.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1032)+
    +     at oracle.toplink.sequencing.QuerySequence.update(QuerySequence.java:319)+
    +     at oracle.toplink.sequencing.QuerySequence.updateAndSelectSequence(QuerySequence.java:258)+
    +     at oracle.toplink.sequencing.StandardSequence.getGeneratedVector(StandardSequence.java:62)+
    +     at oracle.toplink.sequencing.DefaultSequence.getGeneratedVector(DefaultSequence.java:144)+
    +     at oracle.toplink.sequencing.Sequence.getGeneratedVector(Sequence.java:256)+
    +     at oracle.toplink.internal.sequencing.SequencingManager$Preallocation_Transaction_NoAccessor_State.getNextValue(SequencingManager.java:444)+
    +     at oracle.toplink.internal.sequencing.SequencingManager.getNextValue(SequencingManager.java:873)+
    +     at oracle.toplink.internal.sequencing.ClientSessionSequencing.getNextValue(ClientSessionSequencing.java:75)+
    +     at oracle.toplink.internal.descriptors.ObjectBuilder.assignSequenceNumber(ObjectBuilder.java:234)+
    +     at oracle.toplink.internal.sessions.UnitOfWorkImpl.assignSequenceNumbers(UnitOfWorkImpl.java:419)+
    +     at oracle.toplink.internal.sessions.UnitOfWorkImpl.calculateChanges(UnitOfWorkImpl.java:497)+
    +     at oracle.toplink.internal.sessions.UnitOfWorkImpl.commitToDatabaseWithChangeSet(UnitOfWorkImpl.java:1407)+
    +     at oracle.toplink.internal.sessions.UnitOfWorkImpl.commitRootUnitOfWork(UnitOfWorkImpl.java:1167)+
    +     at oracle.toplink.internal.sessions.UnitOfWorkImpl.commit(UnitOfWorkImpl.java:939)+
    +     at oracle.apps.xdo.servlet.scheduler.toplink.ToplinkDataHandler.insertJob(ToplinkDataHandler.java:815)+
    +     ... 16 more+
    Caused by: java.sql.SQLException: ORA-00904: "SEQ_NAME": invalid identifier
    +     at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:138)+
    +     at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:316)+
    +     at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:282)+
    +     at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:639)+
    +     at oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:113)+
    +     at oracle.jdbc.driver.T4CStatement.execute_for_rows(T4CStatement.java:561)+
    +     at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1161)+
    +     at oracle.jdbc.driver.OracleStatement.executeUpdate(OracleStatement.java:1585)+
    +     at oracle.toplink.internal.databaseaccess.DatabaseAccessor.executeDirectNoSelect(DatabaseAccessor.java:713)+
    +     ... 45 more+
    Found a thread related to this but there it was explained that the error was occuring when trying to notify regarding output through email. In our case, issue is occuring just during scheduling itslef.
    Also I haved checked the following schedular tables in my database.
    SQL> select table_name from all_tables where table_name like 'S_NQ%'
    +2 /+
    TABLE_NAME
    S_NQ_ERR_MSG
    S_NQ_INSTANCE
    S_NQ_JOB_PARAM
    S_NQ_JOB
    SQL> select SEQ_NAME.CURRVAL FROM DUAL;
    select SEQ_NAME.CURRVAL FROM DUAL
    *+
    ERROR at line 1:
    ORA-02289: sequence does not exist
    Please help me out in solving this as I have tried almost all possible solutions.
    Thanks,
    Sri Harsha.
    Edited by: user10545574 on Dec 20, 2009 10:24 PM

    Hello,
    In the delivery email configuration server page (under BI Publisher Admin Tab), the username / password to enter is the one defined on the email server itself. It is the user that will be user to send the emails when scedhuling a report.
    It may not be Administrator/ Administrator (not a user defined with OBI admin tool) but the username/password defined on the email server itself.
    Moreover, to properly configure the BI Publisher Scheduler, it is a prerequistes to create bipsched user on Oracle DB and install the schema tables in Oracle DB (by clicking on Install Schema button after defining database connection under Admin / Scheduler Configuration tab)
    From the error your are getting 'SEQ_NAME unknown..., it appears that the tables are not created'.
    Hope this helps and good luck
    Matthieu

  • Error ORA-00904  invalid identifier

    There are so many different employee rates colums in the employee table .
    e.g)
    emp_rate_1 column has all different salaries(10,20,30)
    emp_rate_2 column has all different salaries(20,30,40)
    If I do pick up one rate , it works fine as below
    select
         SUM(emp_rate_1) as emp_rate_1
                   from employee_t
    result $60
    but i have to summarize all different rate amount using loop. before looping method,
    I tried as simple like below
    declare
    V_emp_rate_1_ID number;
    begin
    V_emp_rate_1_ID :=1;
    select
         SUM(emp_rate_||trim(V_emp_rate_1_ID)) as emp_rate_1
                   from employee_t ;
    end;
    I have an error message;
    PL/SQL: ORA-00904: "emp_rate_": invalid identifier
    ORA-06550: line 5, column 1:
    PL/SQL: SQL Statement ignored
    06550. 00000 - "line %s, column %s:\n%s"
    *Cause:    Usually a PL/SQL compilation error.
    *Action:
    how can I put dynamic column into Sum() in the query?
    or would you give me your advice to solve the solution.

    Not clear whether you are trying to get two sums (one for each column) or one sum that totals both columns)
    select
    SUM(emp_rate_1) as emp_rate_1
    from employee_t
    result $60But you can do all three with one query
    select
    SUM(emp_rate_1) as emp_rate_1, sum(emp_rate_2) as emp_rate_2, sum (emp_rate_1 + emp_rate_2) as sum_both
    from employee_t

  • Dynamic SQL Issue ORA-00904:invalid identifier error

    Here is my SP
    create or replace procedure srini_ref_cursor_test(p_county_code IN VARCHAR2,
    p_ref_cur out PK_FR_TYPES.cursor_type) is
    query_str varchar2(5000);
    begin
    query_str := 'SELECT * FROM dw_county where county_name = :P ';
    open p_ref_cur for query_str USING p_county_code;
    insert into srini_query_str_test values (query_str);
    commit;
    end srini_ref_cursor_test;
    When I pass the p_county_code = Adams working find.
    create or replace procedure srini_ref_cursor_test(p_county_code IN VARCHAR2,
    p_ref_cur out PK_FR_TYPES.cursor_type) is
    query_str varchar2(5000);
    begin
    query_str := 'SELECT * FROM dw_county where county_name in ('||p_county_code||')';
    open p_ref_cur for query_str;
    insert into srini_query_str_test values (query_str);
    commit;
    end srini_ref_cursor_test;
    When I pass the p_county_code = Adams for above SP I got the following error
    ORA-00904: "ADAMS": invalid identifier error
    With out Bind variables how Can I pass the Char type values in Dynamic SQL ?
    I would like to pass multipule values to p_county_code like 'Adams','Ashley' etc
    How Can I do this ?
    Thank for great help.
    Srini

    How do I write the Dynamic SQL for
    SELECT * FROM DW_COUNTY WHERE COUNTY_NAME LIKE 'Ad%'
    The usual way...
    hr@ORA10G>
    hr@ORA10G> var str varchar2(1000);
    hr@ORA10G> var cr refcursor;
    hr@ORA10G>
    hr@ORA10G> exec :str := 'select * from employees where first_name like ''A%''';
    PL/SQL procedure successfully completed.
    hr@ORA10G> -- note the escape character for each single quote
    hr@ORA10G> print str
    STR
    select * from employees where first_name like 'A%'
    hr@ORA10G>
    hr@ORA10G> exec open :cr for :str;
    PL/SQL procedure successfully completed.
    hr@ORA10G> print cr
    EMPLOYEE_ID FIRST_NAME           LAST_NAME                 EMAIL                     PHONE_NUMBER      HIRE_DATE JOB_ID    SALARY COMMISSION_PCT MANAGER_ID DEPARTMENT_ID
            103 Alexander            Hunold                    AHUNOLD                   590.423.4567         03-JAN-90 IT_PROG          9000                       102            60
            115 Alexander            Khoo                      AKHOO                     515.127.4562         18-MAY-95 PU_CLERK         3100                       114            30
            121 Adam                 Fripp                     AFRIPP                    650.123.2234         10-APR-97 ST_MAN           8200                       100            50
            147 Alberto              Errazuriz                 AERRAZUR                  011.44.1344.429278   10-MAR-97 SA_MAN          12000             .3        100            80
            158 Allan                McEwen                    AMCEWEN                   011.44.1345.829268   01-AUG-96 SA_REP           9000            .35        146            80
            167 Amit                 Banda                     ABANDA                    011.44.1346.729268   21-APR-00 SA_REP           6200             .1        147            80
            175 Alyssa               Hutton                    AHUTTON                   011.44.1644.429266   19-MAR-97 SA_REP           8800            .25        149            80
            185 Alexis               Bull                      ABULL                     650.509.2876         20-FEB-97 SH_CLERK         4100                       121            50
            187 Anthony              Cabrio                    ACABRIO                   650.509.4876         07-FEB-99 SH_CLERK         3000                       121            50
            196 Alana                Walsh                     AWALSH                    650.507.9811         24-APR-98 SH_CLERK         3100                       124            50
    10 rows selected.
    hr@ORA10G>
    hr@ORA10G>pratz

  • 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>

  • Dynamic SQL Error -ORA-00904: invalid identifier

    Hello!
    I'm really hoping I can get some fast help on this. In the interest of honesty, this is for a university oracle programming assignment. I've searched everywhere I can for the answer and haven't had any luck.
    Anyway, the problem in a nutshell. I have to write a package to write a text file. The formatting information for the file is held in a table, which has columns to define the various characteristics like justification, padding character and field value.
    RECORDTYPE FIELDNAME FIELDVALUE FIELDSIZE FIELDORDER PADDINGCHAR JUSTIFICATION DATASOURCE
    7 CreditTotal v_credit 10 5 '0' LPAD PROGRAM
    7 RecordType '7' 1 1 ' ' RPAD HARDCODE
    I can build the whole file except this footer. the FieldValue "v_credit" references a variable that has the calculated total of the credit amounts for the file. There are also "v_debit", and "(v_credit-v_debt)" entries.
    My question seems simple... How can I use this VARCHAR2 value from the table, and have it reference the variable within a Dynamic SQL string? If I use the textvalue of the column in the SQL string it gives me the invalid identifier error when it hits the EXECUTE IMMEDIATE statement. There is another row for the header which has "to_char(sysdate,'DDMMYYYY')" in it, and that runs fine. I'm assuming because they are native SQL statements and variables.
    I have tried encapsulating the v_credit in "s, and using dynamica bind variables but had the same problem passing the names to the USING clause.
    The SQL string created by the procedure is: SELECT LPAD(v_credit,10,'0' ) FROM dual
    The full error is:
    ORA-00904: "V_CREDIT": invalid identifier
    ORA-06512: at "BWOOD.PKG_BRIAN", line 108
    ORA-06512: at line 2
    Line 108 is the EXECUTE IMMEDIATE statement
    I would really appreciate someones help! I'm happy to post the procedure I've written, with the caveat that it's sloppy student work and needs cleaning up of all the experimental commented attempts:)
    Edited by: user5426606 on 20-May-2009 03:34 - Added a few more facts.

    Thank you for the fast replies. I'll post a short chunk of code to demonstrate.
    The actual procedure is quite a bit longer, but this should give you the idea.
    PROCEDURE build_dbfile (p_settlement_date IN DATE, p_settlement_key IN VARCHAR2, p_type IN VARCHAR2) AS
    v_sqlString    VARCHAR2(4000) := 'SELECT ';
    v_rectype     NUMBER := 7;
    v_line           LONG;
    v_debit        NUMBER := 0;
    v_credit       NUMBER := 0;
    v_nrRecords    NUMBER := 0;
      CURSOR c_settlement IS... -- to select records for data rows
    -- cursor to select the rows with the file formatting and data info
      CURSOR c_header IS   SELECT   NVL(fieldvalue,fieldname) db_field, <---- selects the data column
                                                   fieldsize,
                                                   NVL(paddingchar, ''' ''') paddingchar,
                                                   NVL(justification,'LPAD') justification,
                                                  datasource
                                      FROM     FSS_DESKBANK_REF
                                      WHERE    recordtype = r_rec_types.recordtype
                                      ORDER BY recordType, fieldorder;
    -- SELECT to get the SUM of datarows for v_credit
      SELECT      SUM(transactionamount)
      INTO      v_credit...
    -- SELECT to get the SUM of datarows for v_debit
      SELECT      SUM(transactionamount)
      INTO      v_debit....
    FOR r_head IN c_header LOOP
    v_sqlString := v_sqlString  || r_head.justification|| '('
                                         || r_head.db_field ||','
                                         || r_head.fieldsize || ','
                                         || r_head.paddingchar || ')';
    v_sqlString := v_sqlString || ' FROM ' || v_tbl_name;
    DBMS_OUTPUT.PUT_LINE('SQL --> '||v_sqlString);
    EXECUTE IMMEDIATE v_sqlString INTO v_line;
    END LOOP;
    DBMS_OUTPUT.PUT_LINE(v_line);
    END build_dbfile;So the loop goes through the table rows, grabs each data value and formatting column, and builds the sql string, which is then passed to the execute statement. The issue is the ones where the datarow contains a reference to v_credit, and the error is generated. ie r_head.db_field contains the string "v_credit"
    Satish, the sql does look like that in the string, but the string is built from the table, not hardcoded. ie v_sqlString = "SELECT LPAD(v_credit,10,'0' ) FROM dual" when it is passed to the EXECUTE IMMEDIATE.
    Edited by: user5426606 on 20-May-2009 05:19

  • IR: ORA-20001: get_dbms_sql_cursor error ORA-00904: : invalid identifier

    Hi everyone,
    has anyone else had this error which has been driving me round the bend during the last three days?
    I have an interactive report which used to work fine.
    Now it happens (when the page loads/a filter is en- or disabled) that - from time to time, but unpredictable - I receive
    ORA-20001: get_dbms_sql_cursor error ORA-00904: : invalid identifier
    The report is based on a table function.
    I will try to set up a testcase and post the link here, but so far I haven't managed to force the error to occur.
    But maybe someone else has already bumped into this kind of error? I would be grateful for any hints!
    Best regards,
    Sabine
    Application Express 4.1.0.00.32
    Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production

    Hi Jari,
    I changed the type definition (the return type of the table function) and extended the select list in the source of the IR.
    I do not use 'select *' but reference every column explicitly. So APEX easked me whether to add the new column.
    I also tried deleting in recreating the region, but no luck.
    Any more ideas?
    Best regards,
    Sabine

  • ORA-00904: "CUSTOMER"."SOURCE_FILE_INDICATOR": invalid identifier

    The following SELECT throws an error (ORA-00904: "CUSTOMER"."SOURCE_FILE_INDICATOR": invalid identifier) in Informatica. If you run the query on database there is no issue. I am using the id OBIEDWUSER to run this query.
    SELECT CUSTOMER.RECNO, CUSTOMER.STORENUMBER, CUSTOMER.CUSTOMERID, CUSTOMER.MDMCUSTOMERID, CUSTOMER.FIRSTNAME, CUSTOMER.LASTNAME, CUSTOMER.STREETADDRESS1, CUSTOMER.STREETADDRESS2, CUSTOMER.CITY, CUSTOMER.STATE, CUSTOMER.ZIP, CUSTOMER.COUNTRY, CUSTOMER.ALTERNATIVEPHONE, CUSTOMER.CELLPHONE, CUSTOMER.HOMEPHONE, CUSTOMER.WORKPHONE, CUSTOMER.EMAILADDRESS, CUSTOMER.BIRTHDATE, CUSTOMER.CMNT, CUSTOMER.JOBTITLE, CUSTOMER.GENDER, CUSTOMER.MARITALSTATUS, CUSTOMER.STATUS, CUSTOMER.ATTRITIONSCORE, CUSTOMER.LIFETIMEVALUE, CUSTOMER.PROSPECTDECILES, CUSTOMER.LISTNAME, CUSTOMER.ADDRESSLONGITUDE, CUSTOMER.ADDRESSLATITUDE, CUSTOMER.INACTIVETYPE, CUSTOMER.POPUTYPE, CUSTOMER.SATDATE, CUSTOMER.CUSTOMERTYPE, CUSTOMER.SOURCEFILENAME, CUSTOMER.RECORDADDED, CUSTOMER.SIEBELSTOREID, CUSTOMER.TM, CUSTOMER.DM, CUSTOMER.EMAIL, CUSTOMER.MOBILE, CUSTOMER.CBC_ITEM, CUSTOMER.CBC_AMOUNT, CUSTOMER.MIDDLENAME, CUSTOMER.ADDRESSNAME, CUSTOMER.HARD_FLG, CUSTOMER.LEGAL_FLG, CUSTOMER.SKIP_FLG, CUSTOMER.STOLEN_FLG, CUSTOMER.DECEASED_FLG, CUSTOMER.DNC_FLG, CUSTOMER.DNC_DT, CUSTOMER.DNM_FLG, CUSTOMER.DNM_DT, CUSTOMER.ROUTE50_FLG, CUSTOMER.CORP_LEASE_FLG, CUSTOMER.TREATMENT_CHNL, CUSTOMER.CAMP_LAUNCH_DT, CUSTOMER.LAST_LEAD_EFF_DT, CUSTOMER.LAST_CONTACT_DT, CUSTOMER.LAST_CONTACT_RESULT, CUSTOMER.LAST_CONTROL_DT, CUSTOMER.PRSP_MDM_ID, CUSTOMER.INTEGRATION_ID, CUSTOMER.CUSTOMER_CD, CUSTOMER.STORE_TYPE, CUSTOMER.SOURCE_FILE_INDICATOR FROM CUSTOMER WHERE CUSTOMER.RECORDADDED >= SYSDATE -14
    When i check the table CUSTOMER, it is actually a synonym created as follows:
    CREATE OR REPLACE SYNONYM "OBIEDWUSER"."CUSTOMER" FOR "MIDDLEWARE"."CUSTOMER_V";
    This means it is drawing data from view CUSTOMER_V. If i run a select on view CUSTOMER_V, the field SOURCE_FILE_INDICATOR is present in the view.
    The base table for MIDDLEWARE.CUSTOMER_V is MIDDLEWARE.CUSTOMER. With user OBIEDWUSER, when i run a select on the base table MIDDLEWARE.CUSTOMER, it get the error that table does not exist.
    What can be the issue here? Help is most appreciated :-)

    Thanks Martin,
    It is your comment that gave me the idea to increase log level in Informatica (which gave me the solution)

  • Composer error: ORA-00904: "L"."CLID$$OWN": invalid identifier

    Does anybody know how to detect & solve this issue?
    I've read about thie Bug No 7372334 and checked the CLG$ tables and all them have the CLID$$OWN column.
    Any clue?
    Details from webtogo:
    MGP History User (Cycle ID: 23021 User: MVERNASCHIA)
         Page Refreshed          Jun 30, 2009 2:36:20 PM
    Summary
         Apply Pub Item Count          5
         Apply Record Count          0
         Has Apply Conflicts          NO
         Has Apply Errors          NO
         Apply Duration (seconds)          0
         Compose Pub Item Count          65
         Compose Record Count          101
         Has Compose Errors          YES
         Compose Duration (seconds)          2.328
    Details
    Applied Record     Counts:
    Insert Count     = 0
    Update Count     = 0
    Delete Count     = 0
    Applied PubItems:
    RASTRO
    IR_LOG_ERROR
    UM
    IR_CONFIG
    IR_SEQUENCIA
    Composed PubItems
    (<PubItem Name>, <Duration     in Milli Seconds>):
    TAB_PRECOS_VIG,16
    BONIF_TIPOS,16
    BIOS_VIEW_DET,15
    PROF,16
    MAQ_EFIC,0
    LOG_TAB_DADOS,31
    OPERAGR_REC,31
    BIOS_TREE_COD,16
    OS_MAQ_TAL,47
    HISTORIA,47
    DD_PLANTA,0
    ATIV_RECOMPILA,0
    TROVEL,15
    ESTIMA,32
    ALIM_MIGRA,15
    TALHAO_UNID,31
    CONF_ATABPRECO,16
    RECURSOS_DISP,0
    OS_PLANTIO_DET,31
    USINAS,16
    PLANTIO_TRANSP,16
    RI_RIEGO_RESUMEN,15
    REPORTE_FILTXT,0
    OPERAGR,16
    H_FROFRE,31
    DD_IDI,16
    CONFIG_PROCESSO,15
    DD_USR_SIA,0
    OPERAGR_TP_OS,47
    OS_CJOP_OP,47
    BIOS_REL_LOG,62
    DATA_ABAST,32
    A_PAGAR_PRG,15
    ALIM_PR_COMED,63
    PROD_ALMOXAGR,15
    OSREQ,16
    EVENTO_DATA,16
    SETOR,15
    LOG_TALHAO,47
    BIOS_TREE_REL,31
    TAL_SEQ_PLANEJ,16
    OPROD_DISP,16
    OPER_COMIS,15
    CUL_CURVA_PROD,16
    DD_VERSAO,16
    PLUVIO_TAL,31
    CUSTO_ESTADO,15
    VIVE_LOTES,63
    TAL_VERSION,0
    CD_PLA_TAL,16
    H_FRENTE_S,15
    OS_APLPROD,31
    CUSINFO,16
    LOTE,31
    CA_ANALISIS_TAL,141
    OS_APLPROD_DET,141
    OS_MAQ_RESUMO,140
    OS_TAL,110
    LAB_PROG_REC,0
    OPERAGR_CULT,31
    PLANTA_CULT,31
    OPERAGR_TAL,16
    COMIS_PRG,15
    REL_AGEND_REAL,16
    OS_ESTADO,16
    Compose Error:
    java.sql.SQLException: ORA-00904: "L"."CLID$$OWN": invalid identifier
         at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:138)
         at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:316)
         at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:282)
         at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:639)
         at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:185)
         at oracle.jdbc.driver.T4CPreparedStatement.execute_for_rows(T4CPreparedStatement.java:633)
         at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1161)
         at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3001)
         at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:3074)
         at oracle.lite.sync.Subscription.execPrepUpdate(Unknown Source)
         at oracle.lite.sync.Subscription.bindPstmGetResult(Unknown Source)
         at oracle.lite.sync.MyCompose.doCompose(Unknown Source)
         at oracle.lite.sync.SharedCompose.doCompose(Unknown Source)
         at oracle.lite.sync.MyCompose.doCompose(Unknown Source)
         at oracle.lite.sync.Consolidator$O8Server.fastPush(Unknown Source)
         at oracle.lite.sync.MGP$MGPG.run(Unknown Source)
         at java.lang.Thread.run(Thread.java:595)

    Hi,
    Thanks Jo23 for the information, but I checked the SDK version and it is correct.
    You said the name of the column is CLID$$CS but the error occurs on the CLID$$OWN column and this column exists on the tables.
    Following is the command that fails as a sample:
    UPDATE MOBILEADMIN."CMP$VW_TAL_HIST" m
    SET DMLTYPE$$ = 'I', SEQNO$$ = 4104675, DTYPE$$ = NULL, RID$$ = NULL
    WHERE CLID$$CS = ?
    AND EXISTS
    (SELECT 'A'
    FROM (SELECT DISTINCT NNAPRD.VW_TAL_HIST."SAFRA",
    VW_TAL_HIST."LOTE",
    VW_TAL_HIST."SETOR",
    VW_TAL_HIST."FAZ",
    VW_TAL_HIST."TAL",
    VW_TAL_HIST."BLOCO",
    VW_TAL_HIST."CB",
    VW_TAL_HIST."DISTANCIA",
    VW_TAL_HIST."AREA_A",
    VW_TAL_HIST."AREA_P",
    VW_TAL_HIST."AREA_MEC",
    VW_TAL_HIST."AREA_MAN",
    VW_TAL_HIST."AREA_INUTIL",
    VW_TAL_HIST."AREA_CARREADOR",
    VW_TAL_HIST."AREA_COL",
    VW_TAL_HIST."KM_ASFALTO",
    VW_TAL_HIST."KM_ESTRADA",
    VW_TAL_HIST."KM_CARREADOR",
    VW_TAL_HIST."PRIMCORTE",
    VW_TAL_HIST."DATA_PLANTIO",
    VW_TAL_HIST."DATA_PRECOL",
    VW_TAL_HIST."TCC_EST",
    VW_TAL_HIST."PCC_EST",
    VW_TAL_HIST."AR_EST",
    VW_TAL_HIST."BRIX_EST",
    VW_TAL_HIST."FIBRA_EST",
    VW_TAL_HIST."COLHIDO",
    VW_TAL_HIST."DATA_ULTCOL",
    VW_TAL_HIST."DATA_ANOA",
    VW_TAL_HIST."SEM_ULTCOL",
    VW_TAL_HIST."TCC_ULTC",
    VW_TAL_HIST."PCC_ULTC",
    VW_TAL_HIST."AR_ULTC",
    VW_TAL_HIST."BRIX_ULTC",
    VW_TAL_HIST."FIBRA_ULTC",
    VW_TAL_HIST."MATURADOR",
    VW_TAL_HIST."CODMAT",
    VW_TAL_HIST."DATAMAT",
    VW_TAL_HIST."VINHACA",
    VW_TAL_HIST."TIPO_COL",
    VW_TAL_HIST."VARIEDADE",
    VW_TAL_HIST."ESTAGIO",
    VW_TAL_HIST."NCORTES",
    VW_TAL_HIST."SOLO",
    VW_TAL_HIST."FERTILIDADE",
    VW_TAL_HIST."TEXTURA",
    VW_TAL_HIST."TOPOGRAFIA",
    VW_TAL_HIST."PROPRIEDADE",
    VW_TAL_HIST."CULTURA",
    VW_TAL_HIST."ENTRA",
    VW_TAL_HIST."FILTRA",
    VW_TAL_HIST."ALTITUDE",
    VW_TAL_HIST."LATITUDE",
    VW_TAL_HIST."LONGITUDE",
    VW_TAL_HIST."SEM_PROGCOL",
    VW_TAL_HIST."PCC_PROGCOL",
    VW_TAL_HIST."YAFUE",
    VW_TAL_HIST."PERIODO",
    VW_TAL_HIST."UMI_EST",
    VW_TAL_HIST."UMI_ULTC",
    VW_TAL_HIST."REFORMA",
    VW_TAL_HIST."REFORMAF",
    VW_TAL_HIST."ESPACO_L",
    VW_TAL_HIST."DECLIVIDADE",
    VW_TAL_HIST."AREA_MUDA",
    VW_TAL_HIST."TON_MUDA",
    VW_TAL_HIST."MUNICIPIO",
    VW_TAL_HIST."MES_PCOL",
    VW_TAL_HIST."FXTCH",
    VW_TAL_HIST."FXDIST",
    VW_TAL_HIST."FXPCC",
    VW_TAL_HIST."FXAGUA",
    VW_TAL_HIST."PBS",
    VW_TAL_HIST."PBU",
    VW_TAL_HIST."LREF",
    VW_TAL_HIST."LSAC",
    VW_TAL_HIST."HQ",
    VW_TAL_HIST."FECHADA",
    VW_TAL_HIST."MAGICO",
    VW_TAL_HIST."DIFACESSO",
    VW_TAL_HIST."LSP",
    VW_TAL_HIST."DENS",
    VW_TAL_HIST."INFILTRA",
    VW_TAL_HIST."LIP",
    VW_TAL_HIST."CAPSULA",
    VW_TAL_HIST."PLANO",
    VW_TAL_HIST."EST_FIS",
    VW_TAL_HIST."FAIXA",
    VW_TAL_HIST."F_ADUBO",
    VW_TAL_HIST."F_PRAGA",
    VW_TAL_HIST."F_ERVA",
    VW_TAL_HIST."F_DOENCA",
    VW_TAL_HIST."ULTOPER",
    VW_TAL_HIST."DATAOPER",
    VW_TAL_HIST."STATUS_FOR",
    VW_TAL_HIST."RI_UDREC",
    VW_TAL_HIST."RI_UDREA",
    VW_TAL_HIST."PREVCOR",
    VW_TAL_HIST."M3AGUA",
    VW_TAL_HIST."ACOL",
    VW_TAL_HIST."GUIA",
    VW_TAL_HIST."SUBBLOQUE",
    VW_TAL_HIST."PH_EST",
    VW_TAL_HIST."PUR_EST",
    VW_TAL_HIST."AREA_CULT",
    VW_TAL_HIST."TCC_INICIO",
    VW_TAL_HIST."DATAREF",
    VW_TAL_HIST."ATR_EST",
    VW_TAL_HIST."ATR_ULTC",
    VW_TAL_HIST."TCC_EST_BRUTO",
    VW_TAL_HIST."TCC_ULTC_BRUTO",
    VW_TAL_HIST."QUEMA_POBLA",
    VW_TAL_HIST."QUEMA_CARRE",
    VW_TAL_HIST."QUEMA_LELEC",
    VW_TAL_HIST."QUEMA_AEROP",
    VW_TAL_HIST."QUEMA_ORGAN",
    VW_TAL_HIST."QUEMA_MONUM",
    VW_TAL_HIST."QUEMA_EDIFI",
    VW_TAL_HIST."AQUEMA_POBLA",
    VW_TAL_HIST."AQUEMA_CARRE",
    VW_TAL_HIST."AQUEMA_LELEC",
    VW_TAL_HIST."AQUEMA_AEROP",
    VW_TAL_HIST."AQUEMA_ORGAN",
    VW_TAL_HIST."AQUEMA_MONUM",
    VW_TAL_HIST."AQUEMA_EDIFI",
    VW_TAL_HIST."QUEMA_DIRVENTO",
    VW_TAL_HIST."DATA_ACOL",
    VW_TAL_HIST."DOSEMAT",
    VW_TAL_HIST."APLICA_MAT",
    VW_TAL_HIST."EDAD_ULTCOL",
    VW_TAL_HIST."TON_MOL",
    VW_TAL_HIST."DESTINO",
    VW_TAL_HIST."ULTIMA_LAB",
    VW_TAL_HIST."ULTIMA_LAB_DATA",
    VW_TAL_HIST."DATA_START",
    VW_TAL_HIST."TON_EST",
    VW_TAL_HIST."TON_EST_INI",
    VW_TAL_HIST."VISITA_ULT",
    VW_TAL_HIST."VISITA_DIAS",
    VW_TAL_HIST."VISITA_RESP",
    VW_TAL_HIST."AREA_MUDAREAL",
    VW_TAL_HIST."AMB_PRODUCAO",
    VW_TAL_HIST."FXPRECIP",
    VW_TAL_HIST."FXINSOL",
    VW_TAL_HIST."FXEVAP",
    VW_TAL_HIST."COLHIDO_TEMP",
    VW_TAL_HIST."AREA_COL_TEMP",
    VW_TAL_HIST."VISITA_TAB",
    VW_TAL_HIST."TESTEMUNHA",
    VW_TAL_HIST."TON_MOL_BRUTO",
    VW_TAL_HIST."CICLO",
    VW_TAL_HIST."MOTIVO",
    VW_TAL_HIST."ANA1",
    VW_TAL_HIST."ANA2",
    VW_TAL_HIST."ANA3",
    VW_TAL_HIST."ANA4",
    VW_TAL_HIST."ANA5",
    VW_TAL_HIST."ANA6",
    VW_TAL_HIST."ANA7",
    VW_TAL_HIST."ANA8",
    VW_TAL_HIST."ANA9",
    VW_TAL_HIST."ANA10",
    VW_TAL_HIST."ANA11",
    VW_TAL_HIST."ANA12",
    VW_TAL_HIST."ANA13",
    VW_TAL_HIST."ANA14",
    VW_TAL_HIST."ANA15",
    VW_TAL_HIST."ANA16",
    VW_TAL_HIST."ANA17",
    VW_TAL_HIST."ANA18",
    VW_TAL_HIST."ANA19",
    VW_TAL_HIST."ANA20",
    VW_TAL_HIST."ANA21",
    VW_TAL_HIST."ANA22",
    VW_TAL_HIST."ANA23",
    VW_TAL_HIST."ANA24",
    VW_TAL_HIST."ANA25",
    VW_TAL_HIST."ANA26",
    VW_TAL_HIST."ANA27",
    VW_TAL_HIST."ANA28",
    VW_TAL_HIST."ANA29",
    VW_TAL_HIST."ANA30",
    VW_TAL_HIST."ANA31",
    VW_TAL_HIST."ANA32",
    VW_TAL_HIST."ANA33",
    VW_TAL_HIST."ANA34",
    VW_TAL_HIST."ANA35",
    VW_TAL_HIST."ANA36",
    VW_TAL_HIST."ANA37",
    VW_TAL_HIST."ANA38",
    VW_TAL_HIST."ANA39",
    VW_TAL_HIST."ANA40",
    VW_TAL_HIST."ANA41",
    VW_TAL_HIST."ANA42",
    VW_TAL_HIST."ANA43",
    VW_TAL_HIST."ANA44",
    VW_TAL_HIST."ANA45",
    VW_TAL_HIST."ANA46",
    VW_TAL_HIST."ANA47",
    VW_TAL_HIST."ANA48",
    VW_TAL_HIST."ANA49",
    VW_TAL_HIST."ANA50",
    VW_TAL_HIST."ANA51",
    VW_TAL_HIST."ANA52",
    VW_TAL_HIST."ANA53",
    VW_TAL_HIST."ANA54",
    VW_TAL_HIST."ANA55",
    VW_TAL_HIST."ANA56",
    VW_TAL_HIST."ANA57",
    VW_TAL_HIST."ANA58",
    VW_TAL_HIST."ANA59",
    VW_TAL_HIST."ANA60",
    VW_TAL_HIST."ANA61",
    VW_TAL_HIST."ANA62",
    VW_TAL_HIST."ANA63",
    VW_TAL_HIST."ANA64",
    VW_TAL_HIST."ANA65",
    VW_TAL_HIST."ANA66",
    VW_TAL_HIST."ANA67",
    VW_TAL_HIST."ANA68",
    VW_TAL_HIST."ANA69",
    VW_TAL_HIST."ANA70",
    VW_TAL_HIST."ANA71",
    VW_TAL_HIST."ANA72",
    VW_TAL_HIST."ANA73",
    VW_TAL_HIST."ANA74",
    VW_TAL_HIST."ANA75",
    VW_TAL_HIST."AREA_EX",
    VW_TAL_HIST."ALTURA",
    VW_TAL_HIST."NOME",
    VW_TAL_HIST."COD_UNICO",
    VW_TAL_HIST."FASE_FENOL",
    VW_TAL_HIST."NR_VALVULAS",
    VW_TAL_HIST."NR_RUAS",
    VW_TAL_HIST."ANA1_EST",
    VW_TAL_HIST."ANA2_EST",
    VW_TAL_HIST."ANA3_EST",
    VW_TAL_HIST."ANA4_EST",
    VW_TAL_HIST."ANA5_EST",
    VW_TAL_HIST."ANA6_EST",
    VW_TAL_HIST."ANA7_EST",
    VW_TAL_HIST."ANA8_EST",
    VW_TAL_HIST."ANA9_EST",
    VW_TAL_HIST."ANA10_EST",
    VW_TAL_HIST."ANA11_EST",
    VW_TAL_HIST."ANA12_EST",
    VW_TAL_HIST."ANA13_EST",
    VW_TAL_HIST."ANA14_EST",
    VW_TAL_HIST."ANA15_EST",
    VW_TAL_HIST."ANA16_EST",
    VW_TAL_HIST."ANA17_EST",
    VW_TAL_HIST."ANA18_EST",
    VW_TAL_HIST."ANA19_EST",
    VW_TAL_HIST."ANA20_EST",
    VW_TAL_HIST."ANA21_EST",
    VW_TAL_HIST."ANA22_EST",
    VW_TAL_HIST."ANA23_EST",
    VW_TAL_HIST."ANA24_EST",
    VW_TAL_HIST."ANA25_EST",
    VW_TAL_HIST."ANA26_EST",
    VW_TAL_HIST."ANA27_EST",
    VW_TAL_HIST."ANA28_EST",
    VW_TAL_HIST."ANA29_EST",
    VW_TAL_HIST."ANA30_EST",
    VW_TAL_HIST."ANA31_EST",
    VW_TAL_HIST."ANA32_EST",
    VW_TAL_HIST."ANA33_EST",
    VW_TAL_HIST."ANA34_EST",
    VW_TAL_HIST."ANA35_EST",
    VW_TAL_HIST."ANA36_EST",
    VW_TAL_HIST."ANA37_EST",
    VW_TAL_HIST."ANA38_EST",
    VW_TAL_HIST."ANA39_EST",
    VW_TAL_HIST."ANA40_EST",
    VW_TAL_HIST."ANA41_EST",
    VW_TAL_HIST."ANA42_EST",
    VW_TAL_HIST."ANA43_EST",
    VW_TAL_HIST."ANA44_EST",
    VW_TAL_HIST."ANA45_EST",
    VW_TAL_HIST."ANA46_EST",
    VW_TAL_HIST."ANA47_EST",
    VW_TAL_HIST."ANA48_EST",
    VW_TAL_HIST."ANA49_EST",
    VW_TAL_HIST."ANA50_EST",
    VW_TAL_HIST."ANA51_EST",
    VW_TAL_HIST."ANA52_EST",
    VW_TAL_HIST."ANA53_EST",
    VW_TAL_HIST."ANA54_EST",
    VW_TAL_HIST."ANA55_EST",
    VW_TAL_HIST."ANA56_EST",
    VW_TAL_HIST."ANA57_EST",
    VW_TAL_HIST."ANA58_EST",
    VW_TAL_HIST."ANA59_EST",
    VW_TAL_HIST."ANA60_EST",
    VW_TAL_HIST."ANA61_EST",
    VW_TAL_HIST."ANA62_EST",
    VW_TAL_HIST."ANA63_EST",
    VW_TAL_HIST."ANA64_EST",
    VW_TAL_HIST."ANA65_EST",
    VW_TAL_HIST."ANA66_EST",
    VW_TAL_HIST."ANA67_EST",
    VW_TAL_HIST."ANA68_EST",
    VW_TAL_HIST."ANA69_EST",
    VW_TAL_HIST."ANA70_EST",
    VW_TAL_HIST."ANA71_EST",
    VW_TAL_HIST."ANA72_EST",
    VW_TAL_HIST."ANA73_EST",
    VW_TAL_HIST."ANA74_EST",
    VW_TAL_HIST."ANA75_EST",
    VW_TAL_HIST."DATA_AGOSTE",
    VW_TAL_HIST."PLUVIO",
    VW_TAL_HIST."EVAPOR",
    VW_TAL_HIST."DATA_URIEGO",
    VW_TAL_HIST."PERC_RIEGO",
    VW_TAL_HIST."RIE_HACER",
    VW_TAL_HIST."RIE_EDAD_MIN",
    VW_TAL_HIST."RIE_EDAD_MAX",
    VW_TAL_HIST."RIE_INI",
    VW_TAL_HIST."RIE_FIN",
    VW_TAL_HIST."RIE_LAS",
    VW_TAL_HIST."RIE_DATA_LAS",
    VW_TAL_HIST."NR_MAXPLRUAS",
    VW_TAL_HIST."MESC_PROGCOL",
    VW_TAL_HIST."EDAD_PROGCOL",
    VW_TAL_HIST."RALEIO",
    VW_TAL_HIST."TPPLANTIO",
    VW_TAL_HIST."EXCEL_LINHA",
    VW_TAL_HIST."EXCEL_COLUNA",
    VW_TAL_HIST."OTM_MESC_PROGCOL",
    VW_TAL_HIST."OTM_EDAD_PROGCOL",
    VW_TAL_HIST."OTM_DATA_PROGCOL",
    VW_TAL_HIST."ULTIMA_LAB_OS",
    VW_TAL_HIST."KG_FRUTO_PLANTA",
    VW_TAL_HIST."AREA_COL_ULTC",
    VW_TAL_HIST."DATA_ENC",
    VW_TAL_HIST."ULTIMA_CJ_LAB",
    VW_TAL_HIST."CLASSIF_PRECOL",
    VW_TAL_HIST."NOTA_PRECOL",
    VW_TAL_HIST."EDMIN",
    VW_TAL_HIST."EDMAX",
    VW_TAL_HIST."FCMIN",
    VW_TAL_HIST."FCMAX",
    VW_TAL_HIST."TCHM_EST",
    VW_TAL_HIST."TON_PROXIMA_COS",
    VW_TAL_HIST."EDAD_PROXIMA_COS",
    VW_TAL_HIST."TON_REFUGO",
    VW_TAL_HIST."PUR_ULTC",
    VW_TAL_HIST."ENC_INFO",
    VW_TAL_HIST."DT_FASE_FENOL",
    VW_TAL_HIST."AREA_PRESERVACAO",
    VW_TAL_HIST."AREA_RESERVA",
    VW_TAL_HIST."POSTO",
    VW_TAL_HIST."PH_ULTC",
    VW_TAL_HIST."DATA_BISADO",
    VW_TAL_HIST."COD_USU_BISA",
    VW_TAL_HIST."ID_CONTROLE",
    VW_TAL_HIST."PCALDO_EST",
    VW_TAL_HIST."PLANTAS",
    VW_TAL_HIST."TIPO_CULT",
    VW_TAL_HIST."ANA76",
    VW_TAL_HIST."ANA77",
    VW_TAL_HIST."ANA78",
    VW_TAL_HIST."ANA79",
    VW_TAL_HIST."ANA80",
    VW_TAL_HIST."ANA81",
    VW_TAL_HIST."ANA82",
    VW_TAL_HIST."ANA83",
    VW_TAL_HIST."ANA84",
    VW_TAL_HIST."ANA85",
    VW_TAL_HIST."ANA86",
    VW_TAL_HIST."ANA87",
    VW_TAL_HIST."ANA88",
    VW_TAL_HIST."ANA89",
    VW_TAL_HIST."ANA90",
    VW_TAL_HIST."ANA91",
    VW_TAL_HIST."ANA92",
    VW_TAL_HIST."ANA93",
    VW_TAL_HIST."ANA94",
    VW_TAL_HIST."ANA95",
    VW_TAL_HIST."ANA96",
    VW_TAL_HIST."ANA97",
    VW_TAL_HIST."ANA98",
    VW_TAL_HIST."ANA99",
    VW_TAL_HIST."ANA100",
    VW_TAL_HIST."ANA76_EST",
    VW_TAL_HIST."ANA77_EST",
    VW_TAL_HIST."ANA78_EST",
    VW_TAL_HIST."ANA79_EST",
    VW_TAL_HIST."ANA80_EST",
    VW_TAL_HIST."ANA81_EST",
    VW_TAL_HIST."ANA82_EST",
    VW_TAL_HIST."ANA83_EST",
    VW_TAL_HIST."ANA84_EST",
    VW_TAL_HIST."ANA85_EST",
    VW_TAL_HIST."ANA86_EST",
    VW_TAL_HIST."ANA87_EST",
    VW_TAL_HIST."ANA88_EST",
    VW_TAL_HIST."ANA89_EST",
    VW_TAL_HIST."ANA90_EST",
    VW_TAL_HIST."ANA91_EST",
    VW_TAL_HIST."ANA92_EST",
    VW_TAL_HIST."ANA93_EST",
    VW_TAL_HIST."ANA94_EST",
    VW_TAL_HIST."ANA95_EST",
    VW_TAL_HIST."ANA96_EST",
    VW_TAL_HIST."ANA97_EST",
    VW_TAL_HIST."ANA98_EST",
    VW_TAL_HIST."ANA99_EST",
    VW_TAL_HIST."ANA100_EST",
    VW_TAL_HIST."COR_GIS",
    VW_TAL_HIST."TON_OUTRAS",
    VW_TAL_HIST."AREA_OUTRAS",
    VW_TAL_HIST."MAPA",
    VW_TAL_HIST."AGOSTE_EST",
    VW_TAL_HIST."BISADO",
    VW_TAL_HIST."VIVEIRO",
    VW_TAL_HIST."SEMANAS_APAR",
    VW_TAL_HIST."PESO_FRUTO",
    VW_TAL_HIST."COD_VIVE",
    VW_TAL_HIST."DENSIDADE",
    VW_TAL_HIST."TEM_CURVA_PROD",
    VW_TAL_HIST."DATA_REAL_INI_COL",
    VW_TAL_HIST."ULT_LIB_COD",
    VW_TAL_HIST."ULT_LIB_AREA",
    VW_TAL_HIST."ULT_LIB_TCH",
    VW_TAL_HIST."NR_COL_S1",
    VW_TAL_HIST."NR_COL_S2",
    VW_TAL_HIST."NR_COL_S3",
    VW_TAL_HIST."NR_COL_S4",
    VW_TAL_HIST."FILEIRA_PLANTA",
    VW_TAL_HIST."ESPACO_PLANTA",
    VW_TAL_HIST."RESPONSAVEL",
    VW_TAL_HIST."CO_CCUSTO",
    VW_TAL_HIST."DS_COMENTARIO",
    VW_TAL_HIST."CD_ALMOXAGR",
    VW_TAL_HIST."NR_COMEDOURO",
    VW_TAL_HIST."TIPOTAL",
    VW_TAL_HIST."LARVAS",
    VW_TAL_HIST."SOLO_SERIE",
    VW_TAL_HIST."SOLO_ORDEM",
    VW_TAL_HIST."TEXTURAS_CLAS",
    VW_TAL_HIST."PORC_RACOES",
    VW_TAL_HIST."RACOES",
    VW_TAL_HIST."ID_GRP",
    VW_TAL_HIST."TURMA",
    VW_TAL_HIST."QT_DIAS_MADURA"
    FROM NNAPRD.VW_TAL_HIST,
    (SELECT DISTINCT USERID, LOGIN, SETOR
    FROM (SELECT C.ID_USR USERID,
    C.DS_LOGIN LOGIN,
    A.SETOR SETOR
    FROM NNAPRD.DD_GRP_SIA_SET A,
    NNAPRD.DD_GRP_USR B,
    NNAPRD.DD_USR C
    WHERE A.GRUPO_USR = B.ID_GRP
    AND B.ID_USR = C.ID_USR
    UNION ALL
    SELECT E.ID_USR USERID,
    E.DS_LOGIN,
    D.SETOR SETOR
    FROM NNAPRD.DD_USR_SIA_SET D, NNAPRD.DD_USR E
    WHERE D.USUARIO = E.ID_USR)) VW_SEG_SET,
    (SELECT DISTINCT USERID, LOGIN, FAZENDA
    FROM (SELECT C.ID_USR USERID,
    C.DS_LOGIN LOGIN,
    A.FAZENDA FAZENDA
    FROM NNAPRD.DD_GRP_SIA_FAZ A,
    NNAPRD.DD_GRP_USR B,
    NNAPRD.DD_USR C
    WHERE A.GRUPO_USR = B.ID_GRP
    AND B.ID_USR = C.ID_USR
    UNION ALL
    SELECT E.ID_USR USERID,
    E.DS_LOGIN,
    D.FAZENDA FAZENDA
    FROM NNAPRD.DD_USR_SIA_FAZ D, NNAPRD.DD_USR E
    WHERE D.USUARIO = E.ID_USR)) VW_SEG_FAZ
    WHERE NNAPRD.VW_TAL_HIST.SETOR = VW_SEG_SET.SETOR
    AND NNAPRD.VW_TAL_HIST.FAZ = VW_SEG_FAZ.FAZENDA
    AND VW_SEG_FAZ.LOGIN = ?) s,
    "NNAPRD"."CLG$HISTORIA" li
    WHERE li.DMLTYPE$$ = 'I'
    AND s."SETOR" = m."SETOR"
    AND s."FAZ" = m."FAZ"
    AND s."LOTE" = m."LOTE"
    AND s."TAL" = m."TAL"
    AND li."DATA_ULTCOL" = s."DATA_ULTCOL"
    AND li."FAZ" = s."FAZ"
    AND li."LOTE" = s."LOTE"
    AND li."SETOR" = s."SETOR"
    AND li."TAL" = s."TAL"
    AND (l.CLID$$OWN IS NULL OR
    l.CLID$$OWN != CONS_EXT.GET_CURR_CLIENT))
    Regards,

  • Database Link Error ORA-00904: "function_name": invalid identifier

    Hi Everyone,
    We are using Oracle9i Enterprise Edition Release 9.2.0.6.0 - 64bit Production.
    We have production and reporting databases. We have a link from reporting to production that we use to create tables on the reporting database by selecting from tables and/or views on the productions database.
    We have to problem selecting from any view or table unless the query uses a stored function on the production database. Then we get the ORA-00904: "function_name": invalid identifier error even though the user that uses the link is created on both databases and the user hase execute privileges on the function.
    Has anyone else ever had this problem or have any suggestions?
    Any help would be greatly appreciated.
    Thanks!
    Ken

    Hi
    Post an example.
    Ott Karesz
    http://www.trendo-kft.hu

Maybe you are looking for