Current_record_indicator invalid identifier

when i presser SHIFT+CNTRL+E i got this error msg
SELECT ROW_ID,ORDER_ID,ORDER_LINE_NUM,ORDERED_QUANTITY,PRODUCT_DESCRIPTION,SUGGESTED_PRICE,PRODUCT_ID,UNIT_OF_MEASURE,LAST_UPDATE_DATE,LAST_UPDATED_BY,CREATION_DATE,CREATED_BY,LAST_UPDATE_LOGIN,GL_ACCOUNT_CC_ID,ATTRIBUTE_CATEGORY,ATTRIBUTE1,ATTRIBUTE2,ATTRIBUTE3,ATTRIBUTE4,ATTRIBUTE5,ATTRIBUTE6,ATTRIBUTE7,ATTRIBUTE8,ATTRIBUTE9,ATTRIBUTE10,CURRENT_RECORD_INDICATOR FROM dem_order_lines_v WHERE (ORDER_ID=:1)
ORA-00904: "CURRENT_RECORD_INDICATOR": invalid identifier
when i am trying to query the records its showing this error ..??
even after making the current record indicator's database item property setting to no ..
why its fetching current_record_indicator while querying ??
Plzzz help

Does that column exist in the dem_order_lines_v table?
Open SQLPlus and describe dem_order_lines_v
Ora-904 occurs because the db cant find the column in your select list, perhaps because the column name is case sensitive, or perpaps it just doesnt exist. For example:
SQL> desc dual;
Name                                      Null?    Type
DUMMY                                              VARCHAR2(1)
SQL> select dummy from dual;
D
X
SQL> select bad_column_name from dual;
select bad_column_name from dual
ERROR at line 1:
ORA-00904: "BAD_COLUMN_NAME": invalid identifierHope it helps,
Greg

Similar Messages

  • Table creation and getting  invalid identifier

    Thank you so much Ed (and all who replied) to my previious post !!!!, You are all being extremely helpful,
    I actually have another issue... SHould I repost a new thread or continue on this one?
    Here is my issue.
    create table DonationEvent
    ( "EventID" NUMBER(1,1) Not Null,
    "EventNumber" NUMBER(1,1) Not Null,
    "Type" Char(30) Not Null,
    "OrganizerName" Char(30) Not Null,
    "Location" Char(30) Not Null,
    "Date" NUMBER(10,1) Not Null,
    "Duration" Char(30) Null,
    "DonationTotal" NUMBER(10,1) Not Null,
    Primary Key (EventID),
    Getting ORA-00904: : invalid identifier
    Also I am using Express Edition 10g, how can I get a context view to see the line where error is occuring?

    user8776250 wrote:
    Thank you so much Ed (and all who replied) to my previious post !!!!, You are all being extremely helpful,
    I actually have another issue... SHould I repost a new thread or continue on this one?
    Here is my issue.
    create table DonationEvent
    ( "EventID" NUMBER(1,1) Not Null,
    "EventNumber" NUMBER(1,1) Not Null,
    "Type" Char(30) Not Null,
    "OrganizerName" Char(30) Not Null,
    "Location" Char(30) Not Null,
    "Date" NUMBER(10,1) Not Null,
    "Duration" Char(30) Null,
    "DonationTotal" NUMBER(10,1) Not Null,
    Primary Key (EventID),
    Getting ORA-00904: : invalid identifier
    Also I am using Express Edition 10g, how can I get a context view to see the line where error is occuring?Does Express edition have sqlplus?
    SQL> set echo on
    SQL> @doit1
    SQL> create table DonationEvent
      2  ( EventID NUMBER(1,1) Not Null,
      3  EventNumber NUMBER(1,1) Not Null,
      4  Type Char(30) Not Null,
      5  OrganizerName Char(30) Not Null,
      6  Location Char(30) Not Null,
      7  Date NUMBER(10,1) Not Null,
      8  Duration Char(30) Null,
      9  DonationTotal NUMBER(10,1) Not Null,
    10  Primary Key (EventID),
    11  );
    Date NUMBER(10,1) Not Null,
    ERROR at line 7:
    ORA-00904: : invalid identifier
    SQL>And as SB said,
    1) In oracle you really, really, REALLY don't want mixed case object (column, table, etc) names. Lose the double quotes.
    2) don't use reserved words (like 'date') as object names.
    also
    3) there's no good reason to use CHAR instead of VARCHAR2
    4) If you want a date (indicated by your badly named column 'date', make the datatype DATE, not number
    5) you need to look at how your NUMBER columns are defined and ask yourself if that's what you really want. NUMBER(1,1) means one digit, with one digit in the decimal location. NUMBER(10,1) means a total of 10 digits, with one of them in the decimal location
    SQL> create table DonationEvent
      2  ( EventID NUMBER(1,1) Not Null primary key,
      3    DonationTotal NUMBER(10,1) Not Null
      4  );
    Table created.
    SQL> --
    SQL> insert into donationevent values (1.2, 1234567891);
    insert into donationevent values (1.2, 1234567891)
    ERROR at line 1:
    ORA-01438: value larger than specified precision allowed for this column
    SQL> insert into donationevent values ( .2, 1234567891);
    insert into donationevent values ( .2, 1234567891)
    ERROR at line 1:
    ORA-01438: value larger than specified precision allowed for this column
    SQL> insert into donationevent values ( .2, 123456789.1);
    1 row created.
    SQL> insert into donationevent values ( .3, 12345678.9);
    1 row created.
    SQL> --
    SQL> commit;
    Commit complete.
    SQL> --
    SQL> select * from donationevent;
       EVENTID DONATIONTOTAL
            .2     123456789
            .3    12345678.9
    2 rows selected.
    SQL>

  • 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

  • Report parameters being passed in URL - invalid identifier error

    Hi
    Id anyone aware of any format in which we should be passing values in the url to the report deployed on the server?
    A parameter that takes in the format 'e123','e234' - example for emp_id parameter.
    If we pass in this form, even a single value as 'e123' in the url to run the report -
    The value e123 is taken in single quotes and it displays the error
    REP-300: "e123": invalid identifier
    That is, it displays the error as if the string was entered in double quotes.

    Hi, Aaron.
    I tried what you said, and my code wouldn't parse correctly. Let me show you the whole module of PL/SQL that I'm dealing with here. I did not write this. This is something I'm maintaining and updating. The part that chokes is near the bottom.
    declare
    l_sql varchar2(4000) := 'select user_name,total from (select user_name,count(*) total from eba_ver2_cust_activity ' ;
    begin
    if :P23_START_DATE is not null and :P23_END_DATE is not null then
    l_sql := l_sql || ' where ACTIVITY_DATE between ''' || to_char(to_date(:P23_START_DATE,'dd-mon-yyyy'),'dd-mon-yyyy')
    || ''' and ' || '''' || to_char(to_date(:P23_END_DATE,'dd-mon-yyyy') ,'dd-mon-yyyy') || '''' ;
    elsif :P23_START_DATE is not null then
    l_sql := l_sql || ' where ACTIVITY_DATE >= ''' || to_char(to_date(:P23_START_DATE,'dd-mon-yyyy'),'dd-mon-yyyy') ||
    elsif :P23_END_DATE is not null then
    l_sql := l_sql || ' where ACTIVITY_DATE <= ''' || to_char(to_date(:P23_END_DATE,'dd-mon-yyyy'),'dd-mon-yyyy') || ''''
    end if;
    if :P23_ACTIVITY_TYPE != '%null%' and :P23_ACTIVITY_TYPE is not null then
    if :P23_START_DATE is not null or :P23_END_DATE is not null then
    l_sql := l_sql || ' and activity_type_id = ' || :P23_ACTIVITY_TYPE ;
    else
    l_sql := l_sql || ' where activity_type_id = ' || :P23_ACTIVITY_TYPE ;
    end if;
    end if;
    l_sql := l_sql || ' group by user_name )' ;
    return l_sql ;
    end ;
    I appreciate all the help. As for the job market for Apex programmers around here, I wouldn't know. I was a COBOL programmer for many years. I'm approaching retirement, and this will probably be my last IT job.
    Steve "the n00b" in Raleigh NC

  • 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

  • Invalid identifier results from an sql statement in php

    hello there, i'm trying to access data from an oracle 11g database via oci and php 5.3.8.
    i'm getting the ORA-00904 (invalid identifier) error when executing the following statement:
    $stid = oci_parse($conn, 'select * from table1 where column1 = "XYZ"');
    when i do this:
    $searchstring = "XYZ";
    $stid = oci_parse($conn, 'select * from table1 where column1 = '.$searchstring.'');
    i'm getting this error:
    ORA-00933: SQL command not properly ended
    column1 is varchar2, the entries are either letters and numbers (never only numbers) or empty.
    when i do this:
    $stid = oci_parse($conn, 'select * from table1');
    i'm getting the data and there are entries in column1 with XYZ.
    has anyone an idea, what i do wrong?
    regards j

    The PHP forum for questions like this is at http://www.oracle.com/technetwork/forums/php/index.html
    You really need to be using a bind variable here. Otherwise you will likely suffer from poor DB performance, and also open yourself to SQL Injection security attacks. Try:
    $stid = oci_parse($conn, 'select * from table1 where column1 = :bv');
    oci_bind_by_name($stid, ":bv", $searchstring);Regarding quoting of your example try:
    $searchstring = "XYZ";
    echo  'select * from table1 where column1 = '.$searchstring.'';Then run that SQL in SQL*Plus and watch it fail. What you need is given with:
    echo  'select * from table1 where column1 = \''.$searchstring.'\'';See the bottom of p 126 of The Underground PHP and Oracle Manual
    Note that with the bind variable example you didn't need quotes around :bv.

  • Invalid identifier error in executing a ref cursr

    I am getting ORA00904: "MARKETING": invalid identifier ... and it's driving me crazy!!
    here's my sql code...
    StrTitle varchar2(500);
    TYPE RefCurCusts IS REF CURSOR;
    rec_ref_custs RefCurCusts;
    strCusts varchar2(500);
    StrTitle := 'MARKETING';
    OPEN rec_ref_custs FOR
    'Select distinct b.account_number, b.marketing_rep_name, c.customer_name, a.meter, a.mappole, a.feeder, b.last_or_corp_name, b.house_number, b.street_direction, b.street_name, b.street_suffix, max(odate) over (partition by b.account_number) last_called, n.message_type, c.list_name     
    From srs.current_outage_calls o, tlm.customer_electric b, srs.notification_list n, SRS.NOTIFIABLE_CUSTOMERS_VW c, srs.est_customer_outages a
    Where c.SERVICE_ADDR_NUMBER = b.SERVICE_ADDR_NUMBER And substr(b.meter_number, 2, 6) = a.meter and b.service_point_end_date is null and o.meter(+)=a.meter and n.list_name=c.list_name and c.list_name = '||StrTitle;
                   LOOP
                        FETCH rec_ref_custs INTO strCusts;
                        EXIT WHEN rec_ref_custs%NOTFOUND;
                             StrBodyHTML:= StrBodyHTML || ', ' || strCusts;
                   END LOOP;
    CLOSE rec_ref_custs;     
    please help!
    Thanks

    Fuse_5a wrote:
    I am taking the value of StrTitle (I changed the name of it to strList in the below code) from a different select statement ... therefore, strList will be changing based on the results of the first query.
    this code is for an automailer that will run every minute!!
    here's more of my code to better explain it ...
    Any suggestions?
    OPEN rec_ref_list FOR
    'Select
    distinct c.list_name     
    From
    srs.current_outage_calls o,
    tlm.customer_electric  b,
    srs.notification_list n,
    SRS.NOTIFIABLE_CUSTOMERS_VW c,
    srs.est_customer_outages a
    Where
    c.SERVICE_ADDR_NUMBER = b.SERVICE_ADDR_NUMBER
    And substr(b.meter_number, 2, 6) = a.meter
    and b.service_point_end_date is null
    and o.meter(+)=a.meter
    and n.list_name=c.list_name';
    LOOP
    FETCH rec_ref_list INTO *strList*;
    EXIT WHEN rec_ref_list%NOTFOUND;
         OPEN rec_ref_custs FOR
    'Select
    b.account_number,
    b.marketing_rep_name,
    c.customer_name, a.meter,
    a.mappole, a.feeder,
    b.last_or_corp_name,
    b.house_number,
    b.street_direction,
    b.street_name,
    b.street_suffix,
    max(odate) over (partition by b.account_number) last_called,
    n.message_type,
    c.list_name     
    From
    srs.current_outage_calls o,
    tlm.customer_electric  b,
    srs.notification_list n,
    SRS.NOTIFIABLE_CUSTOMERS_VW c,
    srs.est_customer_outages a
    Where
    c.SERVICE_ADDR_NUMBER = b.SERVICE_ADDR_NUMBER
    And substr(b.meter_number, 2, 6) = a.mete
    and b.service_point_end_date is null
    and o.meter(+)=a.meter
    and n.list_name=c.list_name
    and c.list_name = :1' using *strList*;
           LOOP
               FETCH rec_ref_custs INTO strCusts;
               EXIT WHEN rec_ref_custs%NOTFOUND;
                   StrBodyHTML:= StrBodyHTML || ', ' || strList || ', ' || strCusts;
           END LOOP;
    CLOSE rec_ref_custs;     
    END LOOP;
    CLOSE rec_ref_list;     
    You have a variable, nothing more. You DO NOT need dynamic SQL here, just trust me (then go read about it and learn why ... it will serve your career well to do some reading).
    You don't need 2 cursors here, for lack of not wanting to try to decipher this in it's entirety i took a simple hack and utilized an IN clause.
    for loop_var in
       Select
          b.account_number,
          b.marketing_rep_name,
          c.customer_name, a.meter,
          a.mappole, a.feeder,
          b.last_or_corp_name,
          b.house_number,
           b.street_direction,
          b.street_name,
          b.street_suffix,
          max(odate) over (partition by b.account_number) last_called,
          n.message_type,
          c.list_name     
       From
          srs.current_outage_calls o,
          tlm.customer_electric  b,
          srs.notification_list n,
          SRS.NOTIFIABLE_CUSTOMERS_VW c,
          srs.est_customer_outages a
       Where
        c.SERVICE_ADDR_NUMBER = b.SERVICE_ADDR_NUMBER
       And substr(b.meter_number, 2, 6) = a.mete
       and b.service_point_end_date is null
       and o.meter(+)=a.meter
       and n.list_name=c.list_name
       and c.list_name in
          Select
             c.list_name     
          From
          srs.current_outage_calls o,
          tlm.customer_electric  b,
          srs.notification_list n,
          SRS.NOTIFIABLE_CUSTOMERS_VW c,
          srs.est_customer_outages a
          Where
          c.SERVICE_ADDR_NUMBER = b.SERVICE_ADDR_NUMBER
          And substr(b.meter_number, 2, 6) = a.meter
          and b.service_point_end_date is null
          and o.meter(+)=a.meter
          and n.list_name=c.list_name
    LOOP
       StrBodyHTML:= StrBodyHTML || ', ' || loop_var.<pick_a_column_from_select_list_above>;
    END LOOP;No ref cursors, less complex and 1 single SQL query ... much cleaner and efficient.

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

  • I am getting "Invalid Identifier" while running the below query

    Iam getting the error "Invalid Identifier, c_rank" while running the below query. Please help.
    select a.*, b.pog_description pog_description, b.start_date,
    row_number() over(partition by b.pog_description order by b.start_date) c_rank
    from temp_codi_dept_35 a, pog_master_msi b, pog_skus_msi c
    where a.sku = c.pog_sku
    and b.pog_id = c.pog_id
    and b.pog_dept = c.pog_dept
    and b.pog_number = c.pog_number
    and b.pog_level = c.pog_level
    and a.sku = 10263477
    and c_rank = 1;

    >
    Iam getting the error "Invalid Identifier, c_rank" while running the below query. Please help.
    select a.*, b.pog_description pog_description, b.start_date,
    row_number() over(partition by b.pog_description order by b.start_date) c_rank
    from temp_codi_dept_35 a, pog_master_msi b, pog_skus_msi c
    where a.sku = c.pog_sku
    and b.pog_id = c.pog_id
    and b.pog_dept = c.pog_dept
    and b.pog_number = c.pog_number
    and b.pog_level = c.pog_level
    and a.sku = 10263477
    and c_rank = 1;
    >
    You can't use 'c_rank' in the where clause because it doesn't exist; you are computing it in the SELECT clause.
    Remove the last condition and wrap your query in another one to select by 'c_rank'.

  • 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

Maybe you are looking for

  • Invoice document posting in single line

    Hi, We will be having multiple goods receipts on purchase order of single line item but vendor will give single invoice only with respect to all goods receipts posted. In MIRO screen, system show the invoice line items for each goods receipt, but we

  • Db tuning in standard edition

    Dear all, Recently we migrated our database from 10g rac to 11gr2 rac in solaris. 11g database is comparatively slow , though we've allocated enough resources (sga..).For example. we ran a sample program and compare the trace files of both the enviro

  • Deskjet 9800 doesn't recognize new color cartridge

    When my Deskjet 9800 printer reported that the color cartrridge was out of ink and I replaced it several months ago, I put in a replacement cartridge (#97) from a new package that I had in reserve.  The printer failed to recognize it, continuing to r

  • ITunes resets every few days

    Hi, I have a new Sony laptop which I have installed iTunes on. I have 105Gb of music which I put on iTunes with the "copy files to iTunes music folder" when I add them. Then I have created a few playlists etc. I have only had the laptop a week but th

  • Process Integration File adapter

    file adaptor in PI was able to accumulate several messages into one file? In other words, every 30 minutes or so, we will connect to any system to collect the documents. If I get there and find a list with 50 document, can I change the adaptor betwee