Invalid identifier ORA-00904

Hello.

This error

Error starting at line 1 in command:
select consulta_ingrediente('Sal','Miguel Goyanes') from dual
Error at Command Line:1 Column:7
Error report:
SQL Error: ORA-00904: "CONSULTA_INGREDIENTE": invalid identifier
00904. 00000 -  "%s: invalid identifier"
*Cause:    
*Action:
The procedure is:
create or replace
PROCEDURE consulta_ingrediente(produto IN INGREDIENTE.PRODUTO%TYPE, user_name IN UTILIZADOR.U_NOME%TYPE) IS
     CURSOR consulta IS
        SELECT energia_kcal, total_hc_disponiveis,proteina,gordura_total FROM INGREDIENTE
        WHERE PRODUTO = produto;
     
privilegios UTILIZADOR.U_PRIVILEGIOS%TYPE;

calorias ingrediente.energia_kcal%TYPE;
hidratos_carbono ingrediente.total_hc_disponiveis%TYPE;
proteinas ingrediente.proteina%TYPE;
gordura ingrediente.gordura_total%TYPE;

BEGIN
     SELECT utilizador.U_PRIVILEGIOS INTO privilegios
     FROM utilizador
     WHERE utilizador.U_NOME = user_name;     
     
  OPEN consulta;
     IF privilegios = 0 THEN
          FETCH consulta INTO calorias, hidratos_carbono, proteinas, gordura;
    CLOSE consulta;
     END IF;
END;
Why I get this error?

Published by: 898791 on 10/Dec/2011 09:05

You can try to execute consulta_ingrediente ('Sal', 'Miguel Goyanes');

Tags: Database

Similar Questions

  • SQL Error: Invalid identifier ORA-00904

    Hello

    The Version of SQL Developer: 11g

    Two tables: nav_vendors (source), vendor (destination)

    Both having 16 'Same' columns (data will differ for some records of... for some data records are same to check the process DML works according to the need).

    I'm trying to insert update and delete using merge operation

    I m getting error below whenever I tried to merge them. All column names are the same in the table.

    SQL error: ORA-00904: "S". "" COMPANY_CODE ": invalid identifier

    SQL:

    MERGE INTO s source

    USING (nvl (d.VENDOR, s.VENDOR) selection of the SELLER,

    NVL (d.Name, s.Name) NAME.

    NVL (d.NAME3, s.NAME3) Name3,

    NVL (d.ADDRESS1, s.ADDRESS1) address1.

    NVL (d.DISTRICT, s.DISTRICT) DISTRICT.

    NVL (d.CITY, s.CITY), CITY,

    NVL (d.Country, s.Country) COUNTRIES.

    NVL (d.Postcode, s.Postcode) ZIP Code,

    NVL (d.TELEPHONE, s.TELEPHONE), PHONE,.

    NVL (d.Fax, s.Fax) FAX.

    NVL (d.contact, s.contact) CONTACT.

    NVL (d.URL, s.URL) URL.

    NVL (d.email, s.email) EMAIL.

    NVL (d.DELIVERY_TOLERANCE, s.DELIVERY_TOLERANCE) DELIVERY_TOLERANCE.

    NVL (d.EXCLUDE_REWORK_TEXT, s.EXCLUDE_REWORK_TEXT) EXCLUDE_REWORK_TEXT.

    NVL (d.COMPANY_CODE, s.COMPANY_CODE) COMPANY_CODE.

    (case

    When ((d.VENDOR = s.VENDOR)

    and (d.NAME = s.NAME)

    and (d.NAME3 = s.NAME3)

    and (d.ADDRESS1 = s.ADDRESS1)

    and (d.DISTRICT = s.DISTRICT)

    and (d.CITY = s.CITY)

    and (d.COUNTRY = s.COUNTRY)

    and (d.POSTCODE = s.POSTCODE)

    and (d.TELEPHONE = s.TELEPHONE)

    and (d.FAX = s.FAX)

    and (d.CONTACT = s.CONTACT)

    and (d.URL = s.URL)

    and (d.EMAIL = s.EMAIL)

    and (d.DELIVERY_TOLERANCE = s.DELIVERY_TOLERANCE)

    and (d.EXCLUDE_REWORK_TEXT = s.EXCLUDE_REWORK_TEXT)

    and (d.COMPANY_CODE = s.COMPANY_CODE))

    then "correspondence".

    When d.COMPANY_CODE is null

    then 'DELETE '.

    When s.COMPANY_CODE is null

    then "INSERT."

    on the other

    "no match."

    chck end)

    of s nav_vendorz

    full outer join of the seller d

    On(d.COMPANY_CODE=s.COMPANY_CODE)

    ) d

    (S.COMPANY_CODE = d.COMPANY_CODE AND (in d.chck ("not matched", 'match', 'DELETE')))

    WHEN MATCHED THEN

    ->UPDATE SET s.company_code = d.company_code <-error line

    WHERE in d.chck ("not matched", "DELETE")

    DELETE WHERE d.chck = 'DELETE '.

    WHEN NOT MATCHED THEN

    INSERT (VENDOR, NAME, ADDRESS1, NAME3, NEIGHBORHOOD, CITY, COUNTRY, CODE POSTAL, PHONE, FAX, CONTACT, URL, EMAIL, DELIVERY_TOLERANCE, EXCLUDE_REWORK_TEXT, COMPANY_CODE)

    VALUES

    (d.VENDOR, d.NAME, d.NAME3, d.ADDRESS1, d.DISTRICT, d.CITY, d.COUNTRY, d.POSTCODE, d.TELEPHONE, d.FAX, d.CONTACT, d.URL, d.EMAIL, d.DELIVERY_TOLERANCE,d.EXCLUDE_REWORK_TEXT,d.COMPANY_CODE);/

    (1) use different alias names

    (2) do not try to update a column that is used to 'ON' clause.

  • ORA-00904: invalid identifier

    Hi all

    I'm getting ORA-00904: "SNO_T": invalid identifier will be done in this example. Please let me know where I have error.

    create table t4(name varchar2(22),sno number);
    
    
    insert into t4 values('suman2',2);
    insert into t4 values('suman',1);
    
    create or replace type t4_t as object(
     name_t  varchar2(22),
     sno_t   number
     );
    
    
    create or replace type t4_m is table of t4_t;
    
    
    /
    declare
     l_toys t4_m;
     l1     pls_integer;
    begin
     select t4_t(name_t,sno_t)  
      bulk collect into l_toys
      from t4;
    -- DBMS_OUTPUT.PUT_line(l_toys.count);
    
     select count(*) into l1 from t4;
    
    
    DBMS_OUTPUT.PUT_line(l1);
    
    
    end;
    
    Error report -
    ORA-06550: line 5, column 21:
    PL/SQL: ORA-00904: "SNO_T": invalid identifier
    ORA-06550: line 5, column 2:
    PL/SQL: SQL Statement ignored
    06550. 00000 -  "line %s, column %s:\n%s"
    *Cause:    Usually a PL/SQL compilation error.
    *Action:
    

    Select t4_t (name_t, sno_t)

    bulk collect into l_toys

    T4;

    the columns in your table are called name and sno, so you must use these names in your select statement

    t4_t is the manufacturer that expects two values (a string and a number) and having built an object, you will be able to access the object by using object_name.sno_t, but do not all by building this...

    HTH

  • Why this error ORA-00904: invalid identifier

    Hi all
    Please advice me what is wronge with this
    ORA-00904: "NONE": invalid identifier


    create or replace trigger test_table2
    before inserting
    on Ta
    for each line
    declare
    v2_none_con varchar2 (20);
    v2_none_con2 varchar2 (20);
    I have number (10);
    TYPE v2_EmpCurTyp IS REF CURSOR;
    v2_emp_cursor v2_EmpCurTyp;
    v2_stmt_str VARCHAR2 (200);
    RECORD IS of TYPE v2_employee_type (v_rowid varchar (100));
    v2_emp_content v2_employee_type;
    Start

    v2_none_con2: = 'NONE ';

    v2_stmt_str: = 'select rowid from t1 where name =' v2_none_con2;
    I: = 0;
    V2_emp_cursor OPEN FOR v2_stmt_str;
    LOOP FETCH v2_emp_cursor INTO v2_emp_content;
    EXIT WHEN v2_emp_cursor % NOTFOUND;
    dbms_output.put_line (v2_emp_content.v_rowid);
    i: = i + 1;
    v2_none_con: = 'NO ' | TO_CHAR (i);

    END LOOP;
    end;




    SQL > /.
    Insert in your values (10, 'W')
    *
    ERROR on line 1:
    ORA-00904: "NONE": invalid identifier
    ORA-06512: in the 'END. TEST_TABLE2', line 15
    ORA-04088: error during execution of trigger ' FINAL. TEST_TABLE2'


    SQL >

    First of all:

    v2_stmt_str: = 'select rowid from t1 where name =' v2_none_con2;

    I would give you compilation errors. I guess the real code is:

    v2_stmt_str: = 'select rowid from t1 where name =' | v2_none_con2;

    Now that the text of the statement would be? V2_none_con2 is 'NONE', dynamic SQL would be:

    Select rowid from t1 where name = NONE

    It is obvious, it will trigger ORA-00904 (except a column named NONE t1). What you want is:

    Select rowid from t1 where name ='' NONE

    So change:

    v2_stmt_str: = 'select rowid from t1 where name =' | v2_none_con2;

    TO

    v2_stmt_str: = ' select rowid from t1, whose name =="' | v2_none_con2 | '''';

    SY.

  • HELP-immediate execution in PL/SQL has received the error ORA-00904: invalid identifier

    What is the problem with the following codes from PL/SQL (actually it comes to Oracle Metalink Note: 313175.1):
    ===========
    declare
    cursor c1 is select * from $ semantic;
    v_statement VARCHAR2 (255);
    v_nc number (10);
    v_nt number (10);
    Start
    immediate execution
    "select count (*) from $ semantics" in v_nc;
    immediate execution
    ' select count (distinct s_table_name) of semantics$ "in v_nt;
    dbms_output.put_line
    ('Edit' | v_nc |) 'columns ' | v_nt | "tables");
    to r1 c1 loop
    v_statement: = 'ALTER TABLE ' | R1.s_owner | '.' || R1.s_table_name;
    v_statement: = v_statement | «change (' |)» R1.s_column_name | ' ';
    v_statement: = v_statement | R1.s_data_type | ' (' | r1.s_char_length;)
    v_statement: = v_statement | ' CHAR))';
    immediately run v_statement;
    end loop;
    dbms_output.put_line ('Done');
    end;
    /
    =====
    Executed once the codes as sysdba against 10gr 2 database, I got this error:
    From build to select columns to change
    Editing columns 4428 35249
    declare
    *
    ERROR on line 1:
    ORA-00904: invalid identifier
    ORA-06512: at line 22

    I see nothing wrong with the line of "immediate execution". I appreciate your help!

    Thank you.

    Hello
    Try to print the offending instruction using exception, I used small test cases by changing the pl/sql block, you may need to change to respond to all other types of data in this table.

    CREATE TABLE semantics$
    AS
       SELECT USER AS owner,
              table_name,
              data_type AS s_data_type,
              column_name,
              data_length AS s_char_length
       FROM cols
       WHERE table_name = 'MY_OBJECTS';
    
    DECLARE
       CURSOR c1
       IS
          SELECT *
          FROM semantics$;
    
       v_statement   VARCHAR2 (255);
       v_nc          NUMBER (10);
       v_nt          NUMBER (10);
    BEGIN
       EXECUTE IMMEDIATE 'select count(*) from semantics$' INTO v_nc;
    
       EXECUTE IMMEDIATE 'select count(distinct table_name) from semantics$'
          INTO v_nt;
    
       DBMS_OUTPUT.put_line(   'ALTERing '
                            || v_nc
                            || ' columns in '
                            || v_nt
                            || ' tables');
    
       FOR r1 IN c1
       LOOP
          v_statement   := 'ALTER TABLE ' || r1.owner || '.' || r1.table_name;
          v_statement   := v_statement || ' modify (' || r1.column_name || ' ';
          v_statement   :=
             v_statement || r1.s_data_type || '(' || r1.s_char_length;
    
          IF (r1.s_data_type = 'NUMBER')
          THEN
             v_statement   := v_statement || '))';
          ELSE
             v_statement   := v_statement || ' CHAR))';
          END IF;
    
          DBMS_OUTPUT.put_line (v_statement);
    
          -- EXECUTE IMMEDIATE v_statement;
       END LOOP;
    
       DBMS_OUTPUT.put_line ('Done');
    EXCEPTION
       WHEN OTHERS
       THEN
          DBMS_OUTPUT.put_line ('Statement = ' || v_statement);
          DBMS_OUTPUT.put_line (SUBSTR (SQLERRM, 1, 200));
          RAISE;
    END;
    

    _ Output

    ALTERing 13 columns in 1 tables
    ALTER TABLE MY_OBJECTS modify (OWNER VARCHAR2(30 CHAR))
    ALTER TABLE MY_OBJECTS modify (OBJECT_NAME VARCHAR2(30 CHAR))
    ALTER TABLE MY_OBJECTS modify (SUBOBJECT_NAME VARCHAR2(30 CHAR))
    ALTER TABLE MY_OBJECTS modify (OBJECT_ID NUMBER(22))
    ALTER TABLE MY_OBJECTS modify (DATA_OBJECT_ID NUMBER(22))
    ALTER TABLE MY_OBJECTS modify (OBJECT_TYPE VARCHAR2(19 CHAR))
    ALTER TABLE MY_OBJECTS modify (CREATED DATE(7 CHAR))
    ALTER TABLE MY_OBJECTS modify (LAST_DDL_TIME DATE(7 CHAR))
    ALTER TABLE MY_OBJECTS modify (TIMESTAMP VARCHAR2(19 CHAR))
    ALTER TABLE MY_OBJECTS modify (STATUS VARCHAR2(7 CHAR))
    ALTER TABLE MY_OBJECTS modify (TEMPORARY VARCHAR2(1 CHAR))
    ALTER TABLE MY_OBJECTS modify (GENERATED VARCHAR2(1 CHAR))
    ALTER TABLE MY_OBJECTS modify (SECONDARY VARCHAR2(1 CHAR))
    Done
    

    Concerning

    Published by: OrionNet on January 5, 2009 23:53

    Published by: OrionNet on January 5, 2009 23:55

  • ISSUES giving invalid identifier

    Hello

    Under query me gives error invalid identifier.

    Can someone please make an eyeball and let me know any correction on the underside of sql?

    SELECT case_id

    OF form_product A

    WHERE ud_text_12 LIKE '% % '.

    AND THERE ARE

    (

    SELECT case_id

    OF form_product B

    WHERE ud_text_12 LIKE ' % of DRUGS. "

    )

    AND A.CASE_ID = B.CASE_ID

    SQL error: ORA-00904: "B". "" CASE_ID ": invalid identifier

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

    * Cause:

    * Action:

    Thank you

    Ann

    I guess you mean:

    SELECT case_id

    OF form_product A

    WHERE ud_text_12 LIKE '% % '.

    AND THERE ARE

    (

    SELECT case_id

    OF form_product B

    WHERE ud_text_12 LIKE '% DRUG' AND A.CASE_ID = B.CASE_ID

    )

  • HELP: instr() error - invalid identifier

    Hello

    Query is attack on this line:

    instr(hntl.note_text, "Critical and/or Actionable") != 0
    

    Error:

    ORA-00904: "criticism and/or action": invalid identifier

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

    note_text column is of type varchar (2000)

    How can I make this work?

    Hello

    In Oracle SQL, string literals are enclosed in single quotes, not double - quote.  You probably want to

    ... instr (hntl.note_text, "Criticism and/or Actionable")! = 0

    Note that SQL differs from SQL * more in this regard.  In SQL * Plus, - single and double quotes are often used interchangeably.  In SQL, they always have a different meaning.

    In Oracle SQL, quotation marks are used in identifiers (such as table names or column) which are not conform to the normal rules of naming.  For example, the column names cannot usually contain special characters such as spaces or slashes (' / ').  If you really want to have a column that is named

    Criticism or action

    you will then need to with the spaces and the bar slash, surround it with quotation marks.  That's exactly what the system thought you were doing: he thought you were trying to refer to a column called 'Critical and/or usable' and, when he couldn't find a column with this name, it gave you an error indicating that the column name was not fair.

  • Invalid identified

    Hi all

    I try to convert my query using the emp table.

    Query

    SELECT empno, ename, JOB,

    (SELECT (CASE sal WHEN > 3000 THEN 999)

    Sal OTHER

    filteredsal end)

    Of

    (

    SELECT sal

    Of inner_emp of the emp

    WHERE inner_emp.empno = outer_emp.empno

    SSS))

    Of outer_emp emp;

    I get the error message

    Error message

    ORA-00904: "OUTER_EMP." "' EMPNO ': invalid identifier

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

    * Cause:

    * Action:

    Error on line: column 9:44

    Please help me. I know that outer_emp.empno is out of scope, but how to solve this problem...


    Hello

    This page has a lot of different questions / answers.  Which do you not understand?  You can be more specific, we can be more helpful.  Post a question like "Whn Tome Kyte said... does that mean...?  If so, why it does not work...?  I expect this request to produce... because... »

    The main question and answer, which are relevant to this topic, is that a subquery can be coprrelated to its immediate parent application; No grandparent or distant ancestor.  We will format your query so that it is easier to see:

    SELECT ename, empno, job - it's level 1

    ,      (                                -- Begin Level 2

    SELECT (CASE

    WHEN sal_prev > 2000

    THEN 999

    Of OTHER sal_prev

    END

    ) AS filteredsal

    OF (-start level 3)

    SELECT LAG (sal, 1, 0) OVER (ORDER BY sal) AS sal_prev, sal

    Of inner_emp of the emp

    WHERE inner_emp.empno = outer_emp.empno - this causes the error

    ) - End of level 3

    )                                -- End Level 2

    AS -sss, there is level 1

    The outer_emp emp - is always level 1

    ;

    Tom Kyte said that at level N expressions referenece to the columns of the tables to N-tier and N - 1 only, not level N-2 or an earlier version.  In your code, the statement that caused the error is level 3. You can reference a table friom level 3-1 = 2 at this point, but not outer_emp, which is level 1.

  • Subselect query returns "invalid identifier", but the nested query return lines

    I don't think it's a general SQL question.

    Select * from persons where person_id in)

    Select person_id with people whose name = 'Obama' - subquery

    ) and age > 18;

    When I run the subquery, I get:

    ORA-00904: "PERSON_ID": invalid identifier

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

    * Cause:

    * Action:

    Error on line: column 5: 8

    This is because the table people do not have the person_id field.

    But when I run the nested together query it returns all the lines in people with the AGE greater than 18.

    How is he succeeds when the subquery is obviously wrong?

    363f652b-263D-4418-933F-74a1d0a41b4c wrote:

    I don't think it's a general SQL question.

    Select * from persons where person_id in)

    Select person_id with people whose name = 'Obama' - subquery

    ) and age > 18;

    When I run the subquery, I get:

    ORA-00904: "PERSON_ID": invalid identifier

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

    * Cause:

    * Action:

    Error on line: column 5: 8

    This is because the table people do not have the person_id field.

    But when I run the nested together query it returns all the lines in people with the AGE greater than 18.

    How is he succeeds when the subquery is obviously wrong?

    Yes - this is a general SQL question and ask often enough.

    Correlated subqueries depend on the inner query, be able to see and access to the columns of the outer query. Normally see you referenced in the WHERE clause of the subquery and not in the SELECT clause, but the reference is valid in both places. This works because the columns of the tables in the main query are accessible in the subquery. "Person_id" is probably a column in the table 'people '.

    Which can be a cause of problems 'odd' when the column (in your case "person_id") is more of a table.

    Use an alias in the subquery in the subquery and you will find that it will not succeed.

    See these two articles AskTom where he addresses this specific issue

    http://asktom.Oracle.com/pls/Apex/f?p=100:11:0:P11_QUESTION_ID:3317493900346468494

    http://asktom.Oracle.com/pls/Apex/f?p=100:11:0:P11_QUESTION_ID:155200640564

  • Invalid identifier in the procedure

    Hi all

    I have an example of how I'm trying to pass two arguments.

    Unfortunately, when I do that, I get the below error:
    ORA-00904: "V_END_DATE": invalid identifier
    ORA-06512: at "PROCEXAMPLE", line 10
    ORA-06512: at line 2

    Before I remove the rest of my hair, is - it possible to let me know what goes wrong? I know what means the error but I don't see where I have, I got an invalid identifier. Even on line 10. : P


    ARGUMENTS TO PASS TO THE PROCEDURE
    BEGIN
        procExample (   p_start_date => '01/01/2011', 
                            p_end_date => '07/01/2011') ;
    END  
    ;
    PROCEDURE
    {
    CREATE OR REPLACE PROCEDURE procExample (p_start_date in varchar2, p_end_date in varchar2) is
    date of v_start_date;
    date of v_end_date;

    Start
    v_start_date: = to_date(p_start_date,'dd/mm/yyyy');
    v_end_date: = to_date(p_end_date,'dd/mm/yyyy');

    EXECUTE IMMEDIATE ' CREATE TABLE test_a AS
    SELECT v_start_date, v_end_date FROM DUAL';
    end procExample;
    }

    Hello

    When you use EXECUTE IMMEDIATE, you pass a string to the database must be executed in the database engine, where nothing is known about local variables in your procedure, such as v_start_date. There are ways to pass variables in an EXECUTE IMMEDIATE statement, but not in the context of the deifinitions column. About the closest thing you can do is:

    CREATE OR REPLACE PROCEDURE procExample ( p_start_date IN VARCHAR2
                                            , p_end_date   IN VARCHAR2
                             )
    IS
        sql_txt         VARCHAR2 (500);
    begin
        sql_txt := 'CREATE TABLE test_a '
                 || 'AS '
             || 'SELECT  TO_DATE (''' || p_start_date || ''', ''dd/mm/yyyy'') AS dt_1 '
             || ',       TO_DATE (''' || p_end_date   || ''', ''dd/mm/yyyy'') AS dt_2 '
             || 'FROM     dual';
    
        dbms_output.put_line (sql_txt || ' = sql_txt');     -- For debugging
    
        EXECUTE IMMEDIATE sql_txt;
    end procExample;
    /
    SHOW ERRORS
    

    Creating tables in procedures is not usually a good idea. Why do you need to do this in PL/SQL?

    Since you know that the columns are DATEs, you can simply create the table with two columns DATE and not use CREATE TABLE As. It would be less prone, although you would need to separate INSERT statements.
    Don't forget to provide names for the columns.

    Whenever you write dynamic SQL code, it is a good idea to put all the text in a variable, so that you can view before you run, for debugging purposes. After the test is finished, you can comment or remove the call to dbms_output.put_line.

  • ORA-00904: "DATA". "" AM ": invalid identifier

    Hello
    I am facing upwards a situation I can't find why is the error ora-00904 appears.
    I wrote the request as follows:

    (A)

    with data as
      (
      select uc.* 
        from user_computer uc
         where computer_name like '%'||:perioxi||'%'
      )
      select uc.* 
        from user_computer uc
        where exists (select 1
                       from data
                       where data.am = uc.am)
         and exists (select 1
                          from v_misthotoi_orga
                          where uc.am = v_misthotoi_orga.matr) 
    

    Where the utilisateur_ordinateur is a table, and the v_misthotoi_orga is a db view (a view that is based on another view that is based on a table that is accessed through a dblink).
    A query runs without error.

    (B)

    with data as
      (
      select uc.* 
        from user_computer uc
         where computer_name like '%'||:perioxi||'%'
      )
      select uc.* 
        from user_computer uc
        where exists (select 1
                       from data
                       where data.am = uc.am)                       <.... THE DATACOLUMN DATA.AM IS USED, WITHOUT ERROR                
         and exists (select 1
                          from v_misthotoi_orga
                          where data.am = v_misthotoi_orga.matr)    <.....THIS IS WHERE THE ERROR IS LOCATED (DATA.AM)
    

    The above query (application B) stops with error: ORA-00904: "DATA". "" AM ": invalid identifier.

    You can identify the cause of the error, since the datacolumn 'am' in 'data' datasource is used twice in query B.
    In the first instance without any error in the second with the error.

    Note: Oracle db v.2
    Thank you
    SIM

    Hey Sim,

    Change

    select 1
    from v_misthotoi_orga
    where data.am = v_misthotoi_orga.matr
    

    TO

    select 1
    from v_misthotoi_orga,
           data  
    
    where data.am = v_misthotoi_orga.matr
    

    In this query, Oracle knows no data unless you specify in the From clause that he should use.

    HTH,

    Stefan

  • ORA-00904: "ORA_ROWSCN": invalid identifier

    Get this error when trying to open tables in SQL Developer and data display.

    ORA-00904: "ORA_ROWSCN": invalid identifier

    Found a very old thread talking about this error, and now it's happening with me with SQL Developer Version on a Mac/Yosemite 4.1.1.19.

    https://community.Oracle.com/thread/1019844

    It happened for awhile and I didn't say anything because I can run a select statement * and get all the data I need. But it is bit boring so wonder if it's a bug that's resurfaced? Anyone else seeing this? Apparently not, because there seems to be no recent discussions on this subject, but maybe I'm not find them.

    Earl

    References to the built-in ORA_ROWSCN function should not return the message "invalid identifier" when connected to Oracle 10 g R1 or higher.  When you connect to a pre - 10 g R1, uncheck the box use ORA_ROWSCN for DataEditor insert and update statements in Tools > Preferences > Database > Object Viewerr.

    Edit:

    Oracle 10 g or higher, tables with a policy defined on them will know it: ORA-00904: 'ORA_ROWSCN': invalid makes unusable 2.1.0.63 output

    Edit2:

    More information, if you wish: using ora_rowscn on a table FGAC: bug?

  • ORA-00904: "YYYY": invalid identifier using impdp

    Hello

    I am trying to import a part of a table to another table on the remote database using impdp:

    Impdp directory of centrumadmin/centrumadmin = network_link DUMP_LOG_DIRECTORY LOGFILE = backup_2014_01.log = REF2ISKNE = 'AUD$ _BACKUP' content TABLES = QUERY DATA_ONLY =------"WHERE \" NTIMESTAMP # "> to_date\ (January 2, 2014","DD-MM-YYYY '------") "------"; "

    But still get this error:

    Start "CENTRUMADMIN". "' SYS_IMPORT_TABLE_01 ': centrumadmin / * directory = network_link DUMP_LOG_DIRECTORY LOGFILE = backup_2014_01.log = REF2ISKNE TABLES = AUD$ happy _BACKUP = DATA_ONLY QUERY =" WHERE NTIMESTAMP # > to_date (02-2014, MM-YYYY) ""

    Current estimation using BLOCKS method...

    Processing object type TABLE_EXPORT/TABLE/TABLE_DATA

    Total estimation using BLOCKS method: 4,473 GB

    ORA-31693: Data Table object 'CENTRUMADMIN '. "" AUD$ _BACKUP "could not load/unload and being ignored because of the error:

    ORA-00904: "YYYY": invalid identifier

    Work "CENTRUMADMIN". "" SYS_IMPORT_TABLE_01 "completed with error (s 1) to Wed Feb 11 09:32:15 2015 elapsed 0 00:00:03

    Any ideas? If I change the date format YYYY-MM-DD or the other, always error is in the last part: ORA-00904: "DD": invalid identifier.

    Thank you.

    Honza

    Hi Mika,

    have you played around with some double 'or triple?

    as

    to_date\ ("02/01/2014","DD-MM-YYYY"------)-«;»

    concerning

    Kay

  • ORA-00904: "PCT_DB_TIME": invalid identifier

    Hello

    on 11.2.0.4 on Win 2008

    I got when running:

    SQL > SELECT EVENT, n.WAIT_CLASS,.

    TIME_WAITED_MICRO, ROUND(TIME_WAITED_MICRO*100/S.DBTIME,1) 2 PCT_DB_TIME

    3. IN V$ SYSTEM_EVENT E, V$ EVENT_NAME N,.

    4 (SELECT the DBTIME OF the V VALUE $ SYS_TIME_MODEL WHERE STAT_NAME = 'DB time') S

    5. WHERE E.EVENT_ID = N.EVENT_ID

    6 AND N.WAIT_CLASS NOT IN ('inactive', ' E/s system') and PCT_DB_TIME <>0

    7 ORDER BY PCT_DB_TIME ASC;

    AND N.WAIT_CLASS NOT IN ('inactive', ' E/s system') and PCT_DB_TIME <>0

    *

    ERROR on line 6:

    ORA-00904: "PCT_DB_TIME": invalid identifier

    Thanks for the help.

    This is an invalid identifier because you cannot use a column assigned in the application to the location alias WHERE clause or ORDER BY in the same query.  You have two options to rewrite this query:

    SELECT EVENT, n.WAIT_CLASS,
    TIME_WAITED_MICRO, ROUND(TIME_WAITED_MICRO*100/S.DBTIME,1) PCT_DB_TIME
    V $ SYSTEM_EVENT E, V$ EVENT_NAME N,.
    (SELECT the DBTIME VALUE OF V$ SYS_TIME_MODEL WHERE STAT_NAME = "DB time") S
    WHERE E.EVENT_ID = N.EVENT_ID
    AND N.WAIT_CLASS NOT IN ('Idle', ' E/s system') and ROUND(TIME_WAITED_MICRO*100/S.DBTIME,1) <> 0
    ORDER BY ROUND(TIME_WAITED_MICRO*100/S.DBTIME,1) ASC;

    and

    SELECT * from
    (SELECT EVENT, n.WAIT_CLASS,
    TIME_WAITED_MICRO, ROUND(TIME_WAITED_MICRO*100/S.DBTIME,1) PCT_DB_TIME
    V $ SYSTEM_EVENT E, V$ EVENT_NAME N,.
    (SELECT the DBTIME VALUE OF V$ SYS_TIME_MODEL WHERE STAT_NAME = "DB time") S
    WHERE E.EVENT_ID = N.EVENT_ID
    AND N.WAIT_CLASS NOT IN ('Idle', ' E/s system'))
    where PCT_DB_TIME <> 0
    ORDER BY PCT_DB_TIME ASC;

    Both work.

    David Fitzjarrell

  • ORA 00904: invalid identifier "JAN".

    Hello

    I have the rest of the table.

    ===========================================

    create table ATT_ATTENDANCESHEET as

    (

    Select 1 empid, to_date('21/01/2014','dd/mm/yyyy') prdate, 240 reg, 0 unpaid all double union

    Select 2, to_date (January 21, 2014 ', ' dd/mm/yyyy'), 200 reg, 0 unpaid all double union

    Select 3, to_date (January 21, 2014 ', ' dd/mm/yyyy'), 240 reg, 0 unpaid all double union

    Select option 4, to_date (January 21, 2014 ', ' dd/mm/yyyy'), 480 reg, 0 unpaid all double union

    Select 5, to_date (January 21, 2014 ', ' dd/mm/yyyy'), 240 reg, unpaid double 0

    );

    =================================================

    I want to remove rows from table ATT_ATTENDANCESHEET.

    If the parameter passed empids, lines for employees would be eliminated.

    If empids is null, all records between the given period will be deleted.

    I created after the procedure to that effect.

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

    CREATE or replace FUNCTION deleteAttendanceDetails (startdate DATE, enddate DATE, empids varchar2) RETURN NUMBER as


    n number;

    condition varchar2 (200);

    vsql varchar2 (2000);

    BEGIN

    IF empids is not null

    THEN

    condition: condition = |' and empid in ('| empids |') ' ;

    END IF;

    vsql: =' delete from ATT_ATTENDANCESHEET where prdate between ' | StartDate | 'and' | EndDate | condition;

    EXECUTE IMMEDIATE (vsql);

    return n;

    END;

    /

    The empids parameter contains the employee IDS separated by commas.

    for example

    "1,2,3,4"

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

    But when I call this function using

    Select deleteAttendanceDetails (to_date('25/01/2014','dd/mm/yyyy'), to_date (' 01/31/2014 ',' dd/mm/yyyy'), ") double;

    I get the following error

    ORA 00904: invalid identifier "JAN".

    ORA-06512: at.. .line 21

    I use oracle 10g.

    Help, please

    Do not use dynamic sql. It's more trouble that it's worth.

    Your error comes from the fact that you convert a date to a string, implicitly and then come back.

    In addition, your example doesn't have a field of prddate... so I added that, in my test table so that it works.

    Try something like that, entirely avoid dynamic sql:

    CREATE or replace FUNCTION deleteAttendanceDetails (
                                  startdate DATE,
                                  enddate DATE,
                                  empids varchar2
                               )
       RETURN NUMBER
    as
       n number;
    BEGIN
       delete from ATT_ATTENDANCESHEET
          where ( empid IS NULL
                OR empid in ( select regexp_substr ( empids, '[^,]+', 1, level) empid
                             from dual connect by level <= (LENGTH(empids) - LENGTH(REPLACE(empids, ',')) + 1)
                          )
                )
            and prdate between nvl(startdate, to_date('01-jan-1900','dd-mon-yyyy'))
                           and nvl(enddate  , to_date('01-jan-5000','dd-mon-yyyy'));
    
      return n;  -- what is "n" ?
    END;
    /
    

    Not really sure what you want to do with "n"... you have nothing in your code... so I did the same

Maybe you are looking for