Oracle 10G R2: Cannot access a table whose name is a reserved keyword

Hello,
Oracle 10G R2 database being accessed using Oracle 10G thin driver in Java.
There is a table named GROUP in the db - GROUP is a reserved keyword of course.
When I execute the statement (after getting the database metadata object from a java.sql.Connection to the DB):
oracle.jdbc.OracleDatabaseMetaData.getIndexInfo(null, "MYDB", "GROUP", false, true)
I get:
Exception in thread "main" java.sql.SQLException: ORA-00903: invalid table name
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:288)
at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:743)
at oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:207)
at oracle.jdbc.driver.T4CStatement.executeForRows(T4CStatement.java:946)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1160)
at oracle.jdbc.driver.OracleStatement.executeUpdateInternal(OracleStatement.java:1606)
at oracle.jdbc.driver.OracleStatement.executeUpdate(OracleStatement.java:1571)
at oracle.jdbc.OracleDatabaseMetaData.getIndexInfo(OracleDatabaseMetaData.java:3485)
When I execute the statement:
oracle.jdbc.OracleDatabaseMetaData.getIndexInfo(null, "MYDB", "\"GROUP\"", false, true)
the result set is empty
What is the correct way for me to get the index info from the table named GROUP?
Thanks,
Sundeep

user5486925 wrote:
oracle.jdbc.OracleDatabaseMetaData.getIndexInfo(null, "MYDB", "\"GROUP\"", false, true)
the result set is empty
Which would suggest you are using the correct name as a quoted identifier. Presumably the code you are using works for other tables. But you might try variations in case.
You can also query the database directly to get the index information rather than using the metadata.
What is the correct way for me to get the index info from the table named GROUP?The correct way is to not use reserved words.

Similar Messages

  • Oracle 10g - issue with "DELETE from TABLE WHERE ID in (1,2,3)" (cfqueryparam used)

    Hello, everyone.
    I am having issues with running a DELETE statement on an Oracle 10g database.
    DELETE
    FROM tableA
    WHERE ID in (1,2,3)
    If there is only one ID for the IN clause, it works.  But if more than one ID is supplied, I get an "SQL command not properly ended" error message.  Here is the query as CF:
    DELETE
    FROM TRAINING
    WHERE userID = <cfqueryparam cfsqltype="CF_SQL_VARCHAR" value="#trim(form.userID)#">
         AND TRAINING_ID in <cfqueryparam value="#form.trainingIDs#" cfsqltype="CF_SQL_INTEGER" list="yes">
    Anyone work with Oracle that can help me with this?  I'm an experienced MS-SQL developer; Oracle is new to me.
    Thanks,
    ^_^

    Nevermind.. a co-worker just told me that I still have to use parenthesis around the values for the IN clause. 

  • How to perform a select op on a table whose name is contained by a variable

    I am using Oracle SQL*Plus client.
    declare
    tablename_var varchar(10); LOOK HERE
    date_var date;
    begin
    select sysdate
    into date_var
    from &tablename_var; LOOK HERE
    dbms_output.put_line('The system date is '||date_var);
    end;
    The above code prompts the user to enter a value for the variable tablename_var, once the user enters 'dual' on prompt... The system date is given as output.
    declare
    tablename_var varchar(10):='dual'; LOOK HERE
    date_var date;
    begin
    select sysdate
    into date_var
    from tablename_var; LOOK HERE
    dbms_output.put_line('The system date is '||date_var);
    end;
    This code fails and gives an error. I understand. Engine interprets it as... trying to perform a select operation on a variable, and says a table or a view is expected.
    Can someone please tell me what to do, to perform a select operation on a table whose name is contained by a variable, like above?

    Hi,
    Welcome to the forum!
    You need Dynamic SQL if the table- or column names are variables.
    Getting the current date isn't a good example; you could get that without a query simply by saying
    date_var := SYSDATE;Also, SELECT ... INTO will raise an error if the query does not return exactly 1 row.
    In the example below, let's get the latest entry_date from a given table:
    For example:
    declare
         tablename_var     varchar(10);
         date_var      date;
         sql_txt           VARCHAR2 (1000);
    begin
         tablename_var := 'table_x;
         sql_txt := 'select  MAX (entrydate)'
              || '  from  ' || tablename_var;
         dbms_output.put_line (sql_txt || ' = sql_txt');    -- Not essential, but recommended
         EXECUTE IMMEDIATE  sql_txt  INTO date_var;
         dbms_output.put_line ('The latest entry_date is ' || date_var);
    end;Dynamic SQL involves creating a string that contains the SQL statement. Displaying the string is purely optional, of course, but it's a very good idea when writing and de-bugging code. Remember to comment-out or delete the display before moving the code into Production.
    For an exercise, make the column name a variable, instead of the hard-coded entry_date.
    Edited by: Frank Kulash on Nov 5, 2009 9:20 AM

  • Deletion of entries from a table whose name is controlled by Z program.

    Hi all,
    I have to delete all entries in a custom table whose "Name" has a certain pattern say ZDBTAB01, ZDBTAB02, etc.
    I arrive at the table name through ABAP code. But the statement
    "DELETE FROM tab_name" doesnot work where tab_name is a variable.
    Can anyone suggest a function module to perform this action..??
    Thanks.
    Regards,
    Senthil G.

    data : v_tabname ..... value 'ZXXX'
    delete from (v_tabname).
    It should work. Are you getting any error message as such.

  • How to do a select from a table whose name is saved in a field?

    Hello,
    This is an abap report.
    I need to do a select from a table whose name is saved in a field of Z* table.
    Like this..
    SELECT * FROM znodos.
       SELECT * FROM znodos-tabla.   "znodos-tabla contain the Z* table name
           move zodos-tabla-txtmd to.....
       endselect.
    endselect.
    Is this possible??
    Thanks

    Hi Ilie Aleman 
    Give variable name in ().. Variable name refers to variable which contains table name
    SELECT * FROM (znodos-tabla).
    Regards,
    Mohaiyuddin
    Edited by: Mohaiyuddin Soniwala on Jan 22, 2008 5:18 PM

  • Read from a internal table whose name is decided in runtime

    Dear ABAPers
    I've an internal table's name in a variable, the name is populated in runtime (user_command->ls_selfield-tabname). Now that using the name (in the variable) i need to read a row from that particular internal table (which is populated into the variable). How can i do that.
    Regards
    Prabumanoharan

    hi see the coding and do the changes accordingly...
    report ztests .
    DATA:
      o_ref TYPE REF TO data.
    FIELD-SYMBOLS:
      <lt_table> TYPE STANDARD TABLE,
      <fs>       TYPE ANY,
      <field>    TYPE ANY,
      <field1>   TYPE ANY.
    PARAMETERS:
      p_tab       TYPE tabname default 'MARA', " Table name (eg: MARA)
      p_field(20) TYPE c default 'MATNR'.      " Field name (eg: MATNR)
    START-OF-SELECTION.
      CREATE DATA o_ref TYPE TABLE OF (p_tab).
      ASSIGN p_field TO <field1>.
      ASSIGN o_ref->* TO <lt_table>.
      SELECT *
        INTO TABLE <lt_table>
        FROM (p_tab).
      LOOP AT <lt_table> ASSIGNING <fs>.
        ASSIGN COMPONENT <field1> OF STRUCTURE <fs>
                      TO <field>.
        IF sy-subrc = 0.
          WRITE:/ <field>.
        ENDIF.
      ENDLOOP.

  • I want to make a business place in the table whose name is J_1BBRAN

    Hi Expert~
    I want to make a business place in the table
    The table's name is J_1BBRAN.
    where should i make that above? what['s transaction code?
    please help~
    Edited by: jake on Jan 7, 2009 1:20 AM
    Edited by: jake on Jan 7, 2009 1:21 AM
    Edited by: jake on Jan 7, 2009 1:44 AM

    Hi Jake,
    I'm working in ECC 6.0 and you can find this table by navegationg through SPRO :
    Cross-Application Components - General Application Functions - Nota fiscal - CNPJ Business Places - Define Business Places and Assign Business Places to Plants
    But the table name is : J_1BBRANCV  (Business Places)
    I think this is what you want.
    Att.
    Cássio Moreira

  • Oracle 10g - Insert in to Temporary Table - Record count mismatch between s

    We are trying insert records from a select query in to temporary table, some of the records is missing in the temporary table. The select statement is having multiple joins and union all which it little complex query. In simple terms the script contains 2 part 1st Part Insert in to temporary table 2nd part Select query with multiple joins, inline sub queries, unions and group by classes and conditions
    Eg. If we execute select statement alone it returns some count for example => 60000 After inserting into the temp table, in temp table the count is around 42000 why is the difference?
    It is simple bulk inserts... insert in to temp table select from xxx. also, there is no commit in between. The problem is all the records populated by the select statement are not inserted in to temp table. some records are not inserted.*
    Also, we had some other observation. It only happens in its 2nd execution and not its first run. Hope there might be some cache problem
    Even, we also did not believe that. We are wondering. In TOAD, we tested however at times it happens. In application jar file, after "insert in to temp select * from xxx" we take the i. record count of temp table and ii. record count of "select * from xxx" separately but both doesn't match. Match only at 1st time.
    Thank you in advance for your efforts and help.
    Shiva.

    The code looks like
    sql = "insert in to temptable select x,y,z,.... from xxx,abc,pqr..where...."; (logial but not real is very complex around 700 lines with multiple joins, inline sub queries, group by etc. )
    stmt = conn.createStatement();
    rCount= stmt.executeUpdate(sql);
    Actual issue is
    rCount = xxxx = Count(temptable) < count(select x,y,z,.... from xxx,abc,pqr..where....)
    why this diffference ? some records populated in the select but not inserted in to temp table
    Anyone can explain?

  • Flash.data.SQL : cannot access sqlite_master table ???

    Normally I find I can execute this query in sqlite and gives
    me all the database info.
    Am I missing something or being more than usually stupid ?
    Not a huge issue, but I was going to build a simple explorer
    just to get a feel for sqlite in AIR, and lack of that info makes
    it rather difficult!
    Also, I see a lot of help available for a database
    perspective in flexbuilder 3 beta. Is that a planned addition or
    just an unremoved aspect of the generic eclipse IDE it's built in?
    It would be a very nice feature to have built in, though I'm
    sure I could set it up myself with some googling.
    regards,
    Jim.

    Christophe Coenraets confirms this in his blog here :
    http://coenraets.org/blog/2007/06/sqlite-admin-application-for-air/

  • Delete a user from a table whose name is a foreign key in other tables

    Dear All;
    I am trying to figure out an easy way to do this. I just recently took someone application who utilized 500 tables. I am trying to delete a user from a table called member_table. However, I am having problems doing so because the user name is a foreign key in other tables which has a relationship with this member_table. I really can't naviagte through all 500 different tables and start deleting the user from each table . hence, I would like to figure out a way to delete the user from the member_table without getting the error message
    ORA - 02292 "Integrity Constraint (....) violated child record found

    Unless you want to find and re-create all of the FK's that point to that field so you can make them ON DELETE CASCADE (note it is the FK not the PK that has that attribute), you will need to either delete that member id from each of the child tables individually or update each one individually to either null or some valid value in member_table before you can delete the id from member_table.
    You can find all of the tables, and the corresponding column_name that have an FK relationship to memeber_table with the following:
    SELECT c.table_name, col.column_name
    FROM user_constraints c, user_cons_columns col
    WHERE c.constraint_name = col.constraint_name and
          c.r_constraint_name = (SELECT constraint_name
                                 FROM user_constraints
                                 WHERE table_name = 'MEMBER_TABLE' and
                                       constraint_type = 'P') and
         c.constraint_type = 'R';If there are a lot of these, you could use something similar to generate the set of delete/update statements that would be needed.
    John

  • Oracle Streams b/w MS-Access 2007 and Oracle 10g.

    Can we set up Oracle Streams between MS-Access 2007 and Oracle 10g? Ms-Access as source and Oracle 10g as destination database. If so, can any one please give me little heads up with supported doc's or any source of info.

    Help Help....!!!

  • Where the tables will occur in oracle 10g

    hi,
    I am learning Oracle 10g.. i have created tables and stored some records in that table... but i can't find the storage location(folder) of that table. So, anyone expert in Oracle 10g, please help me to find this....

    Hi!
    Your tables are always stored in Tablespaces, if you omit the tablespace clause in your create table statement, they will go to your default tablespace.
    You can find this tablespace using
    select default_tablespace from dba_users where username='your username';
    using this tablespace name you can find out the datafiles of that tablespace using
    select file_name from dba_data_files where tablespace_name='the tablespace_name from above';
    Then you would know where your tables are stored.
    Regards,
    PP

  • What is the version of grant alter table, drop table to user in Oracle 10g?

    Hi,
    Oracle support "grant alter table and drop table" before, but I get the "invalid privilege" error in Oracle 10g. Oracle 10g have the "DROP ANY TABLE" and "Alter any table". Is these two means can drop and alter tables belonging to other users? How do I grant the total control (CRUD) of tables in the owner's schema to the owner in Oracle10g?
    Thanks,
    Jiang

    CREATE TABLE privilege grants complete control on owner's tables :
    SYS@db102 SQL> create user test01 identified by test01;
    User created.
    SYS@db102 SQL> grant create session, create table to test01;
    Grant succeeded.
    SYS@db102 SQL> alter user test01 quota unlimited on users;
    User altered.
    SYS@db102 SQL> conn test01/test01
    Connected.
    TEST01@db102 SQL> create table test(a number);
    Table created.
    TEST01@db102 SQL> alter table test add(b varchar2(100));
    Table altered.
    TEST01@db102 SQL> drop table test purge;
    Table dropped.
    TEST01@db102 SQL>                                                      

  • Transform columns in row for a table in Oracle 10g

    Hi,
    I am using Oracle 10g.
    There is a table (example) EMPLOYEE, with following structure
    IDUSER YEAR1 YEAR2 YEAR3
    12345 value1 value2 value3
    99999 value7 value6 value5
    and I need display :
    IDUSER YEAR
    12345 value1
    12345 value2
    12345 value3
    99999 value7
    99999 value6
    99999 value5
    How can I do this with without unpivot?
    Thanks

    Hi,
    Welcome to the forum!
    One way to unpivot in any version of Orace is to cross-join your table with another table (or resut set, in ths case) that has as many rows as you need toroduce from each row of your original table.
    Here's an example:
    WITH     cntr     AS
         SELECT     LEVEL     AS n
         FROM     dual
         CONNECT BY     LEVEL <= 3
    SELECT     e.iduser
    ,     CASE  c.n
             WHEN  1  THEN  year1
             WHEN  2  THEN  year2
             WHEN  3  THEN  year3
         END     AS uear
    FROM         cntr      c
    CROSS JOIN  employee  e
    I hope this answers your question.
    If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only), and the results you want from that data.
    Explain, using specific examples, how you get those results from that data.
    Always say what version of Oracle you're using (e.g. 11.2.0.2.0).
    See the forum FAQ {message:id=9360002}
    Edited by: Frank Kulash on Apr 11, 2013 6:47 AM

  • Archiving Best Practices / How To Guide for Oracle 10g - need urgently

    Hi,
    I apologize if this is a silly question. But i need a step by step archiving guide for Oracle 10g and cannot find any reference document. I am in a rather remote part of S.E. Asia & can't seem to find DBA's with the requisite experience to do the job properly. I have had 1 database lock up this week at a big telecoms provider and another one at a major bank is about to go. I can easily add LUNS & re-structure mirrors etc at the Unix level [ i am a Unix engineer ]
    but i know that is not the long run solution. I am sure the 2 databases i am concerned about have never been archived properly.
    This is the sort of thing DBA's must do all the time. Can someone point me to the proper documentation so i can do a proper job and archive a few years data out of these databases. I do not want to do a hack job. At least i can clone the databases and practise on the clones first before i actually do production.
    -thanks very much
    -gregoire
    [email protected]

    I'm not so sure this is a general database question, as it would be specific to an application and implementation, and as the technology has changed, the database options to support it has too.
    So for example, if you have bought the partitioning option, there may be some sensible procedure for partitioning off older data.
    Things may depend on whether you are talking about an OLTP, a DW, a DSS, or mixed systems.
    DBA's do it all the time because the requirements are different everywhere. Simply deleting a lot of data after copying the old data to another table (as some older systems do) may just wind up giving you performance problems scanning swiss-cheesed data.
    Some places may not archive at all, if they've separated out OLTP from reporting. If all the OLTP stuff is accessed through indices, all the older stuff just sits there. The reporting DB may only have what is needed to be reported on, or be on a standby db where range scans are sufficient to ignore old data. There there's exadata, which has it's own strengths.
    Best Practices have to be on similar enough systems, otherwise they are a self-contradiction.
    Get yourself someone who understands your requirements and can evaluate the actual problem. No apology needed, it is not a silly question. But what is silly is assuming what the problem is with no evidence.

Maybe you are looking for