How to update table which has column name as Oracle keyword?

Hi All,
Somebody has created one table which has column name as "OPTION", now i am trying update this table column value and its throwing an error. "Invalid Identifier".
Could you please help me in this?
Thanks in advance.
Regards,
Ganesh Patil

check this :
batch@DOLN1> create table "from" ("select" varchar2(10));
Table created.
batch@DOLN1> desc "from";
Name                                                                                                  Null?    Type
select                                                                                                         VARCHAR2(10)
batch@DOLN1> update "from" set "select" = 'hello World';
0 rows updated.
batch@DOLN1> insert into "from" values('hello World');
insert into "from" values('hello World')
ERROR at line 1:
ORA-12899: value too large for column "TCM_BATCH"."from"."select" (actual: 11, maximum: 10)
batch@DOLN1> update "from" set "select" = 'hello';
0 rows updated.
batch@DOLN1> insert into "from" values('hello');
1 row created.
batch@DOLN1> commit;
Commit complete.
batch@DOLN1> update "from" set "select" = 'World' where "select" = 'hello';
1 row updated.
batch@DOLN1> select * from "from";
select
World

Similar Messages

  • How to find tables which has more than 1000 Partitions

    Hi All,
    Is there any other way to find out the tables which has more than 1000 Partitions ?
    Apart from SAP report RSDD_MSSQL_CUBEANALYZE. Because this report is not working for me as job getting cancel again and again with ABAP dump DBIF_DSQL2_SQL.I already check SAP Note 1309838, but itu2019s not applicable for us because we are on highest support package level SAP_BW 701 SP06.
    Thanks,
    Harshal

    If you are running SQL Server as your database platform run this query:
    select o.object_id,o.name,p.Partition_count from sys.objects o
    inner join
    (select object_id,count(distinct partition_number) as Partition_count
    from sys.partitions
    group by object_id)
    p
    on o.object_id = p.object_id
    where o.type = 'U'
    order by p.Partition_count desc

  • How to find table which has no index?

    Hi,
    How to find a table which has no index?
    Please provide the query to find the above.
    Thanks
    Jafar

    select owner,
           table_name
      from dba_tables dt
    where not exists(select 'x'
                        from dba_indexes di
                       where dt.owner=di.table_owner
                         and dt.table_name = di.table_name)

  • Create a table which has columns from another table in other schema

    Hi All
    I need to create a table which is table driven i.e., the columns of that table need to be inserted from another table in a different schema...Can any one help me with this??

    create table newtab (--column spec here--) as
    Select --columns here-- from otherschema.tablename;max

  • Need to know base table and base column name for Oracle view columns

    I am trying to load metadata for some views and that requires me to know what the final table and column name would be corresponding to the view column.
    For example, if I have a view x_v that is select a,b from x_v2; and x_v2 is a view that is select a,b,c from x;
    I need to get the following information.
    View View Col Base Table Base Col
    X_V A X A
    X_V B X B
    and so on.
    Is it possible to get this programmatically using any SYS schema tables or Dependency tables?
    I tried an indirect approach wherein I lock tables using LOCK TABLE or FOR UPDATE OF. But I'm not too sure if I can go down to the level of individual view columns.
    Can you help me with this?

    Thanks. I was looking at some indirect approaches.
    I came up with this script that does it faster than dependencies but thats just for tables and not column mapping.
    declare
    cursor bt(cp_sid number) is
    select u.name uname, o.name oname
    from sys.obj$ o, sys.user$ u
    where o.obj# in (select id1
    from v$lock
    where sid=cp_sid)
    and u.user# =o.owner#;
    cursor c_sid is
    select sid
    from v$session
    where audsid =userenv('sessionid');
    l_sid number;
    l_view varchar2(100):= 'PER_PEOPLE_V';
    l_schema varchar2(10):= 'APPS';
    begin
    open c_sid;
    fetch c_sid into l_sid;
    close c_sid;
    dbms_output.put_line('SID: '||l_sid);
    execute immediate 'lock table '||l_schema||'.'||l_view||' in row share mode nowait';
    for i in bt(l_sid) loop
    dbms_output.put_line(i.uname||'.'||i.oname);
    execute immediate 'alter table '||i.uname||'.'||i.oname||' disable table lock';
    execute immediate 'alter table '||i.uname||'.'||i.oname||' enable table lock';
    end loop;
    end;
    It basically uses locks on views to verify locks on the base tables.
    Just wondering, can we use FOR UPDATE OF statements to get to the columns?

  • To select table which has TAB as data column with in

    Hi All
    I have a table which has column type defined as TAB type. When I try selecting the table in PL/SQL developer, I got below error.
    What should I do? Even SQL* Plus shows the same error!
    SQL> select *
      2  from my_tab_cap
      3  /
    from my_tab_cap
    ERROR at line 2:
    ORA-00904: : invalid identifierThanks in advance.
    Message was edited by:
    guru paran
    Changed the table name.

    You probably want to help us out with all your ddl:
    create table tab2 (my_tab_col my_type ) nested table my_tab_col store as my_tab;
    create type my_type as table of varchar2(100);
    declare
    v_type my_type := my_type();
    begin
    v_type.extend(4);
    v_type(1) := 'I like table types1';
    v_type(2) := 'I like table types2';
    v_type(3) := 'I like table types3';
    v_type(4) := 'I like table types4';
    insert into tab2(my_tab_col) values (v_type);
    end;
    select * from tab2;
    MY_TAB_COL                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
    VARCHAR(I like table types1,I like table types2,I like table types3,I like table types4)     

  • INSERTING DATA INTO A SQL SERVER 2005 TABLE, WHICH HAS A IDENTITY COLUMN

    Hi All,
    I have to insert the data into a SQL SERVER 2005 Database table.
    I am able to insert the data into a normal SQL Server table.
    When I am trying to insert the data into a SQL Server table, which has a identity column (i.e. auto increment column in Oracle) I am getting error saying that can't insert value explicitly when IDENTITY_INSERT is set to OFF.
    Had anybody tried this??
    There are some SRs on this issue, Oracle agreed that it is a bug. I am wondering if there is any workaround from any one of you (refer Insert in MS-SQL database table with IDENTITY COLUMN
    Thanks
    V Kumar

    Even I had raised a SR on this in October 2008. But didn't get any solution for a long time, finally I had removed the identity column from the table. I can't to that now :).
    I am using 10.1.3.3.0 and MS SQL SERVER 2005, They said it is working for MS SQL SERVER TABLE, if the identity column is not a primary key and asked me to refer to note 744735.1.
    I had followed that note, but still it is not working for me.
    But my requirement is it should work for a MS SQL SERVER 2005 table, which has identity column as primary key.
    Thanks
    V Kumar

  • How to update zero to a column value when record does not exist in table but should display the column value when it exists in table?

    Hello Everyone,
    How to update zero to a column value when record does not exist in table  but should display the column value when it exists in table
    Regards
    Regards Gautam S

    As per my understanding...
    You Would like to see this 
    Code:
    SELECT COALESCE(Salary,0) from Employee;
    Regards
    Shivaprasad S
    Please mark as answer if helpful
    Shiv

  • Where statement on two different tables with same column name

    Hello,
    I have 2 financial tables:
    tblincome, tblexpenses
    in each table I have column name "monthPayed" (have values of all the months of the year).
    I would like to create a balance view table that will show me the financial status for the Q1 (for example).
    I have a column totalIncome and totalExpended respectively.
    I've create a view table that shows me the financial balance at the moment but I want it to be devide to Quarters of the year...
    Regards

     
    Please post DDL, so that people do not have to guess what the keys, constraints, Declarative Referential Integrity, data types, etc. in your schema are. Learn how to follow ISO-11179 data element naming conventions and formatting rules. Temporal data should
    use ISO-8601 formats. Code should be in Standard SQL as much as possible and not local dialect. 
    This is minimal polite behavior on SQL forums. Where is the code you already tried? Or are you so lazy, so rude or so privileged that you did not do anything for yourself? 
    In fact that silly “tbl-” prefix is so bad that it has a name! It is called Tibbling and Phil Factor even wrote a humor article on bad programmers that use it. 
    Your narrative is vague; it sounds like this is the DDL: 
    CREATE TABLE Incomes
    (payment_month CHAR(10) NOT NULL PRIMARY KEY,
     income_amt DECIMAL(12,2) NOT NULL
      CHECK (income_amt > 0.00),
    CREATE TABLE Expenses
    (payment_month CHAR(10) NOT NULL PRIMARY KEY,
     expense_amt DECIMAL(12,2) NOT NULL
      CHECK (expense_amt > 0.00),
    >> in each table I have column name "monthPayed" (have values of all the months of the year). <<
    I hope not! 2014 has not gotten to September, November or December yet! And the ISO-11179 data element name should be “payment_month”; but it is still wrong! An expense is not a payment! An income is not a payment! 
    >> I would like to create a balance view table that will show me the financial status for the Q1 (for example). <<
    Report Period Table
    Since SQL is a database language, we prefer to do look ups and not calculations. They can be optimized while temporal math messes up optimization. A useful idiom is a report period calendar that everyone uses so there is no way to get disagreements in the DML.
    The report period table gives a name to a range of dates that is common to the entire enterprise. 
    CREATE TABLE Something_Report_Periods
    (something_report_name CHAR(10) NOT NULL PRIMARY KEY
       CHECK (something_report_name LIKE <pattern>),
     something_report_start_date DATE NOT NULL,
     something_report_end_date DATE NOT NULL,
      CONSTRAINT date_ordering
        CHECK (something_report_start_date <= something_report_end_date),
    etc);
    These report periods can overlap or have gaps. I like the MySQL convention of using double zeroes for months and years, That is 'yyyy-mm-00' for a month within a year and 'yyyy-00-00' for the whole year. The advantages are that it will sort with the ISO-8601
    data format required by Standard SQL and it is language independent. The pattern for validation is '[12][0-9][0-9][0-9]-00-00' and '[12][0-9][0-9][0-9]-[01][0-9]-00'
    Now figure it out for yourself, show us what effort you put into this, then we will help you. 
    --CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
    in Sets / Trees and Hierarchies in SQL

  • How to Select data using same column name from 3 remote database

    Hi,
    Can anyone help me on how to get data with same column names from 3 remote database and a single alias.
    Ex.
    SELECT *
    a.name, b.status, SUM(b.qty) qantity, MAX(b.date) date_as_of
    FROM
    *((table1@remotedatabase1, table1@remotedatabase2, table1@remotedatabase3)a,*
    *(table1@remotedatabase1, table1@remotedatabase2, table1@remotedatabase3)b)*
    WHERE b.dept = 'finance'
    AND a.position = 'admin'
    AND a.latest = 'Y' AND (b.status <> 'TRM') AND b.qty > 0;
    GROUP BY a.name, b.status ;
    NOTE: the bold statements is just an example of what I want to do but I always gets an error beacause of ambiguous columns.
    Thanks in advnce. :)
    Edited by: user12994685 on Jan 4, 2011 9:42 PM

    user12994685 wrote:
    Can anyone help me on how to get data with same column names from 3 remote database and a single alias.Invalid. This does not make sense and breaks all scope resolution rules. And whether this is in a single database, or uses tables across databases, is irrelevant.
    Each object must be uniquely identified. So you cannot do this:
    select * from (table1@remotedatabase1, table1@remotedatabase2, table1@remotedatabase3) a3 objects cannot share the same alias. Example:
    SQL> select * from (dual, dual) d;
    select * from (dual, dual) d
    ERROR at line 1:
    ORA-00907: missing right parenthesisYou need to combine the objects - using a join or union or similar. So it will need to be done as follows:
    SQL> select * from (select * from dual d1, dual d2) d;
    select * from (select * from dual d1, dual d2) d
    ERROR at line 1:
    ORA-00918: column ambiguously definedHowever, we need to have unique column names in a SQL projection - so the join of the tables need to project a unique set of columns. Thus:
    SQL> select * from (select d1.dummy as dummy1, d2.dummy as dummy2 from dual d1, dual d2) d;
    DUM DUM
    X   X
    SQL> I suggest that you look closely at what scope is and how it applies in the SQL language - and ignore whether the objects referenced are local or remote as it has no impact to fundamentals of scope resolution.

  • How to allow space in the column names

    Hi
    My program reads data from an excel file which has columns named "Fiscal Year" and "current period". I can read data from the file as below...
    select * from the_file
    But it does not allow me, if I write the following sql statement.
    select distinct fiscal Year, current period from the_file
    I need to get distinct values from these two columns and the order in which these columns will appear in excel file is not fixed.
    I tried
    select distinct 'fiscal Year', 'current period' from the_file
    But it did not work
    Please help as how can I specify these columns that has a space in its name.
    Thanks

    Have you tried Double quotes as in:
    select distinct "fiscal Year", "current period" from the_file;

  • Need to make a copy/clone of a table which has sdo_geometry data type

    Folks,
    We are running Oracle 11gr1 on Suse Linux platform.
    We have a requirement, where we need to make a copy of a table, in the same database but in a difference schema, the source table has about 130 millions rows and also has the sdo_getometry data type.
    I tried materialized view, but MV does not support sdo_geometry data type.
    According to one of my DBAs, doing it via data pump , will take few days, which is not acceptable.
    Is there a way, we can make a copy of this table in the same db ?
    Thanks
    Ashish

    Siva,
    This is not for backup purpose.
    Here is the background information on this requirement.
    I need to have a static copy of a table, which has spatial column, sdo_geometry in it.
    So we can run another application against this table, just read-only, since we need static data, data in the source table changes quite often.
    One of my DBA suggested to have another instance/database, to keep the copy of the source table, I thought idea of having another database just to keep a copy of a table is an over kill.
    That is why I had asked this question and you had provided a viable solution.
    Then we need to refresh this table , with the data (changes) from the source table, maybe once in 2- 3 weeks.
    I tried creating a Materialized view, but it does not support Spatial columns.
    So now I am trying to figure out, the most efficient way to refresh the clone table from the source table.
    Regards,
    Ashish

  • How to rename the column name in oracle 8i?

    hi,
    Does anyone know how to rename the column name in oracle 8i?My method was drop the relationship key first then delete the old column,finally add the new column.
    Thanks for your replay.
    jing

    There is no facilty to rename a column name in Oracle 8i. This is possible from Oracle 9.2 version onwards.
    For you task one example given below.
    Example:-
    Already existed table is ITEMS
    columns in ITEMS are ITID, ITEMNAME.
    But instead of ITID I want ITEMID.
    Solution:-
    step 1 :- create table items_dup
    as select itid itemid, itemname from items;
    step 2 :- drop table items;
    step 3 :- rename items_dup to items;
    Result:-
    ITEMS table contains columns ITEMID, ITEMNAME

  • Deleting from multiple tables where few tables have same column name

    Hi,
    I am new to PL/SQL and need some help. I need to delete data older then X years from some 35 odd tables in my schema and out of those tables 25 tables have same column name on which i can have my "where" clause and rest 10 table have different table names. I am doing something like this :
    declare
    table_list UTL_FILE.FILE_TYPE;
    string_line VARCHAR2(1000);
    tables_count number:=0;
    table_name VARCHAR2(400);
    column_name VARCHAR2(400);
    BEGIN
    table_list := UTL_FILE.FOPEN('ORALOAD','test7.txt','R');
    DBMS_OUTPUT.PUT_LINE(table_list);
    LOOP
    UTL_FILE.GET_LINE(table_list,string_line);
    table_name := substr(string_line,1, instr(string_line,'|')-1);
    column_name := substr(string_line, instr(string_line,'|')+1);
    DBMS_OUTPUT.PUT_LINE(table_name);
    DBMS_OUTPUT.PUT_LINE(column_name);
    IF column_name = 'SUBMISSION_TIME' THEN
    delete from :table_name where to_date(:column_name)<(sysdate-(365*7));
    ELSE
    delete from || table_name || where ( || to_date(column_name) || ) <(sysdate-(365*7));
    END IF;
    END LOOP;
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    UTL_FILE.FCLOSE(table_list);
    DBMS_OUTPUT.PUT_LINE('Number of Tables processed is : ' || tables_count);
    UTL_FILE.FCLOSE(table_list);
    END;
    WHERE the text file "text7.txt" contains list of table name and column names separated by a pipe line. But when I execute the above proc it gives error "invalid table name".
    Can something like this be done or is there any other way to execute this task of deletion from 35 tables.
    Thanks.

    Thanks for replies. I don't know what I am doing wrong but still not getting this damn thing work...This is the proc i am running now :
    declare
    table_list UTL_FILE.FILE_TYPE;
    string_line VARCHAR2(1000);
    tables_count number:=0;
    table_name VARCHAR2(4000);
    column_name VARCHAR2(4000);
    code_text VARCHAR2(2000);
    BEGIN
    table_list := UTL_FILE.FOPEN('ORALOAD','test7.txt','R');
    LOOP
    UTL_FILE.GET_LINE(table_list,string_line);
    table_name := substr(string_line,1, instr(string_line,'|')-1);
    column_name := substr(string_line, instr(string_line,'|')+1);
    IF column_name = 'SUBMISSION_TIME' THEN
    DBMS_OUTPUT.PUT_LINE('do nothing');
    ELSE
    code_text:= 'begin delete from'|| (table_name) ||'where to_date' || (column_name) || '<(sysdate-(365*7))';
    Execute Immediate code_text;
    END IF;
    END LOOP;
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    UTL_FILE.FCLOSE(table_list);
    DBMS_OUTPUT.PUT_LINE('Number of Tables processed is : ' || tables_count);
    UTL_FILE.FCLOSE(table_list);
    END;
    But it gives following error :
    " ORA-06550: line 1, column 51:
    PL/SQL: ORA-00933: SQL command not properly ended
    ORA-06550: line 1, column 7:
    PL/SQL: SQL Statement ignored
    ORA-06550: line 1, column 68:
    PLS-00103: Encountered the symbol "end-of-file" when expecting one of the following:
    ORA-06512: at line 22 "

  • Many to many join table with different column names

    Hi have a joint table with different column names as foreign keys in the joining
    tables...
    e.g. i have a many to many reltnshp btwn Table A and Table B ..and join table
    C
    both have a column called pk.
    and the join table C has columns call fk1 and fk2
    does cmd require the same column name in the join table as in the joining table?
    are there any workarounds?
    thanks

    HI,
    No, the foreign key column names in the join table do not have to match the primary
    key names in the joined tables.
    -thorick

Maybe you are looking for

  • How can i download InDesign CS6 and not CC from your website?

    how can i download InDesign CS6 and not CC from your website?

  • Java in xi

    hi, what topics of java i should be familiar with if i have to work in the area of java mapping, UDFs and adpater engines.

  • Indesign_ cs4 &  photoshop_cs5 compatible with Windows 7 64-bit OS?

    Am buying a new computer, probably a Lenovo with Windows 7 64-bit OS.  Want to know if I will be able to use  indesign_ cs4 &  photoshop_cs5 on it. They were originally installed on Windows XP.

  • PO Amendment Data

    Hi everybody, When PO (Purchase Order) amendment is done, e.g. deli. date change, price change, incoterm change, item deletion etc., So can you Please tell me that these changes get store where exactly? Or how to see these changes So that we can use

  • Dataguard for EBS db

    Any good links on how to configure dataguard for 11i EBS database? Please also specify the general issues/points to note while configuring it? Is grid control recommended with dataguard setup? Sami Malik