Mixed case in column & table name

Hi,
How can tell SQL to use mixed case for column & table name?
For example:
create table PerNode (netId number, nodeId number);
select netId, nodeId from PerNode;
The above statements automatically made to upper case. But I wanted to retain the case sensitiveness in the column & table names.
I know a way by including the names in double quote in the case will make this to retain the case.
But I don't want to give all the time the column & table names within double quote.
What I wanted to know is that is there any ALTER kind of statement will make the SQL to use the case I use in the name of the column & table.
I greatly appreciate your advice.
Thanks,
--JK                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                

Oracle column names and table names are case insensitive unless you enclose them in quotes.
Unless you want to have two tables, one called PerNode and one called pernode or some such, I'm not sure what benefit case sensitivity would have. One can certainly use mixed case SQL statements in stored procedures and ad-hoc SQL for readability-- only in the Oracle internals is everything changed to upper case.
Justin
Distributed Database Consulting, Inc.
www.ddbcinc.com/askDDBC

Similar Messages

  • Finding column,table names in a schema with search data

    Hi All,
    I want to list all the columns,tables in a schema with any search value.
    Ex: Take an example of EMP table, if I search with 'MARTIN', result should be ename (column name) , emp(table name).
    Can you please help me on this regard to write a query.
    Regards,
    Rajasekhar

    SQL> set line 1000
    SQL> VAR val VARCHAR2(30)
    SQL> execute :val:='SMITH';
    PL/SQL procedure successfully completed.
    SQL> SELECT   DISTINCT
      2               SUBSTR(:val, 1, 11) "Searchword",
      3               SUBSTR(table_name, 1, 14) "Table",
      4               SUBSTR(t.COLUMN_VALUE.getstringval(), 1, 50) "Column/Value"
      5  FROM     cols,
      6               table(XMLSEQUENCE(DBMS_XMLGEN.getxmltype(   'select '
      7                                                        || column_name
      8                                                        || ' from '
      9                                                        || table_name
    10                                                       || ' where (UPPER('''
    11                                                       || :val
    12                                                       || ''')=UPPER('
    13                                                       || column_name
    14                                                       || '))').EXTRACT('ROWSET/ROW/*'))) t
    15  WHERE    table_name IN ('EMP', 'DEPT','EMPLOYEES') --limiting the table names, you can omit this.
    16  ORDER BY "Table";
    Searchword                                   Table                                                    Column/Value
    SMITH                                        EMP                                                      <ENAME>SMITH</ENAME>
    SMITH                                        EMPLOYEES                                                <LAST_NAME>Smith</LAST_NAME>

  • Mixed case table/col names and JDeveloper?

    I am thinking of trying to use mixed case table/column names in my Oracle 8i database.
    My hope is to achieve table/column names consistent with Java conventions (which I am happy with).
    Would this work with Jdeveloper 3.1? 3.2?
    Will JDeveloper/BC4J then generate mixed case names?
    Will I cause my self lots of pain and suffering? (I don't consider having to enter a correct mixed case name a pain; I do consider always having to quote it and/or use TOUPPER, etc. a bit of pain)
    Thanks
    R.Parr
    Temporal Arts
    null

    I do consider always having to quote it and/or use TOUPPER, etc. a bit of pain)<<<JDEV isn't as much the issue. If you have simple applications and don't intend to change things over time, or create lots of interfaces, or support multiple development tools against the same database, mixed cases seem to work fine.
    To give yourself an idea of how cumbersome things will be, go in and
    create "myTable" ( "myField" varchar2(20) );
    now DESC ribe the table,
    select myField from it.
    Putting doublequotes around things all the time gets very irritating. Remember it is also for having special characters and embedded spaces... and I don't know of any PL/SQL SET ( other than the opposite: SQLCASE that forces just about everything to uppercase ).
    Oh, and then you get to encounter fun things like ODBC and JDBC drivers that may or may not like it. Or if you MOVE/EXPORT the data around, your target may or may not be happy.
    Working at several diversified, large organization with MANY database products/targets, I've become very disenchanted with making mixed case attributes and table names!
    All tools should support mixed case correctly. Reality has returned a mixed case of results. grin or not, as the case may be.
    null

  • Generating mixed case for table and column names

    I trying to get table definition from Oracle 9i database into my toplink workbench
    (version 9.0.3), the column names and table names are capitilized by
    default, how do I change this to be mixed case? Thanks

    I'm not sure why you want them changed. The Oracle database by default is case insensitive, which in essence means it converts everything to upper case when a case is not specified (which can be done by wrapping it in quotes). Unfortunately, Java strings are case sensitive. This means that if you try searching resultsets for "TableName" when the database driver is returning "TABLENAME", you will run into problems. It is probably better to have your project match your database as closely as possible to avoid any issues later on.
    That said, I don't know of a way to automatically have the workbench use mixed case names - it uses the strings as they are returned from the database. I believe you will need to manually change the table names if you want them to be different than what you have imported.
    Best Regards,
    Chris

  • BUG: Export DDL and Data fails for mixed case table/column names

    Hi there,
    I have found a bug in SQL Developer. See details below.
    Description:
    When "Export DDL and Data) function is used on a table/columns not named in UPPERCASE, sql generated by SQL Developer is invalid.
    Steps to reproduce:
    - open SQL Developer, connect to DB
    - make a table named "lowerCase" (in double quotes, so it won't be automatically changed to capital letters)
    - you may also add some columns, for example "lowerCol1", "UpCol2", ALLUPCOL3
    - add some data rows to the table
    - choose Tools -> Export DDL and Data
    - check exporting of tables and data, on "filter" tabs choose your "lowerCase" table
    - press "Apply"
    Error:
    Generated SQL contains invalid INSERTs: mixed-case table and columns are referenced without obligatory double quotes, which yields an error when generated script is executed (see below, relevant line is underlined)
    -- DDL for Table lowerCase
    CREATE TABLE "DBO_HT"."lowerCase"
    (     "lowerCol1" VARCHAR2(100),
         "UpCol2" VARCHAR2(100),
         "ALLUPCOL3" VARCHAR2(100)
    -- DATA FOR TABLE lowerCase
    -- FILTER = none used
    -- INSERTING into lowerCase
    Insert into lowerCase (lowerCol1,UpCol2,ALLUPCOL3) values ('lc','uc','auc');
    -- END DATA FOR TABLE lowerCase
    Remarks
    SQL Developer: version 1.2.1, build MAIN-32.13
    Oracle DBs: 9.2 & Express
    OS: Windows 2000 Professional
    If you need any more details/testing, let me know. I'd really appreciate a quick patch for this issue...
    Alternatively, do you know of any other simple way of copying a single database (it's called a schema in Oracle, right?) from one computer to another? Possibly something so simple like detaching->copying->reattaching mdf (data) files in SQL Server... I thought that this "Export DDL&Data" function will do, but as you can see I couldn't use it.
    I just need a simple solution that works - one operation on source to stuff, get the resulting files to other computer and one operation to have it running there... I think that such scenario is very basic, yet I just can't achieve it and I am simply not allowed to spend more time on it (read: our test project fails, my company rejects my "lobbying" and stays with MSSQL :/ )
    Thanks a lot & bye

    Thanks for your reply.
    ad. 1)
    You're right. I just wanted to give some very short feedback on my experiences with SQL Developer, so I didn't think starting new threads would be necessary, but as I was writing it became much bigger than I initially planned - sorry about that. I will make proper threads as soon as possible. Having "Edit post" button on this forum would also be useful.
    ad. 2)
    Generally, you're right - in most cases it's true that "switching DBMS is a major commitment" and "you will produce terrible code" if you don't learn the new one.
    However, I think that you miss one part of market here - the market that I think Express is also targeted on. I'd call it a "fire&forget databases" market; MySQL comes to mind as possibly most common solution here. It's the rather small systems, possibly web-accessed, whose data-throughput requirements are rather modest; the point is to store data at all, and not necesarily in fastest way, because given the amount of data that is used, even on low-end hardware it will work well enough. What's important here is its general ease of use - how easy is to set up such system, connect and access data, develop a software using it, how much maintenance is needed, how easy this maintenance is, how easy are the most common development tasks as creating a DB, moving a DB from test to production server etc. There, "how easy" directly translates to "how much time we need to set it up", which translates to "how much will the development will cost".
    Considering the current technology, switching the DBMS in such systems is not necesarily a major commitment and believe me that you will not produce terrible code. In many cases it's as simple as changing a switch in your ORM toolkit: hibernate.dialect = Hibernate.Dialect.OracleDialect vs MySQLDialect vs MsSql2005Dialect
    Therefore, in some part of market it's easy to switch DBMS, even on project-by-project basis. The reason to switch will appear when other DBMS makes life easier => development faster. From that point of view, I can understand my colleagues giving me an embarassing look and saying "come on, I won't read all these docs just to have db copied to test server". And it doesn't mean "they are not willing to learn anything new", it's just that they feel such basic task should have self-explaining solution that doesn't require mastering any special knowledge. And if they get such simple solutions somewhere else, it costs them nothing to change the hibernate dialect.
    I think Oracle did the great job with introducing the Express to this "fire&forget" market. The installation is a snap, it just works out of the box, nothing serious to configure, opposite to what I remember from installing and working on Oracle 9 a few years ago. In some places it's still "you need to start SQL*Plus and enter this script", but it's definitely less than before. I also find the SQL Developer a great tool, it can do most of what we need to do with the DB, it's also much better and pleasant to use over Oracle 9 tools. Still, a few basic things still require too much hassle, and I'd say taking your schema to another machine is one of them. So I think that, if you do it well, the "schema copy wizard" you mentioned might be very helpful. If I was to give any general advice for Express line of DB/tools, I'd say "make things simple" - make it "a DB you can't see".
    That's, IMHO, the way to attract more Express users.

  • Converting mixed case table name to upper case

    I am migrating data from Access to Oracle and new tables and columns being created are in mixed case is there a way to convert all tablename or column name automatically.
    Also does the migration workbench handle the memo fields currently defined in my oracle database.

    If you want tables and columns to be created in Upper Case then make sure the Create ANSI-Compliance Names checkbox is unchecked in the options section.
    1.Open Workbench.
    2.Tools -> Options
    Memo fields are migrated to CLOB fields in Oracle.

  • How to export a table with a mixed case name using EXP untility

    i'm trying to export a table which has a name with mixed upper and lower case. The command i'm trying is
    exp USER/password TABLES=("MyTableName") FILE=ExportCNCS1.dat
    and does not work.
    Error:
    Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Produc
    tion
    With the Partitioning, OLAP and Data Mining options
    Export done in WE8MSWIN1252 character set and AL16UTF16 NCHAR character set
    About to export specified tables via Conventional Path ...
    EXP-00011: USER.MYTABLENAME does not exist
    Export terminated successfully with warnings.
    I presume its saying the table doesnt exist because its looking for MYTABLENAME rather than MyTableName and doing this because its ignoring the double quotes. Any ideas?

    Or, let the export prompt you for the table name:
    C:\Temp>exp
    Export: Release 9.2.0.7.0 - Production on Mon Aug 14 11:33:28 2006
    Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.
    Username: scott/tiger
    Connected to: Oracle9i Enterprise Edition Release 9.2.0.7.0 - Production
    With the Partitioning, OLAP and Oracle Data Mining options
    JServer Release 9.2.0.7.0 - Production
    Enter array fetch buffer size: 4096 >
    Export file: EXPDAT.DMP >
    (2)U(sers), or (3)T(ables): (2)U > T
    Export table data (yes/no): yes >
    Compress extents (yes/no): yes > no
    Export done in WE8MSWIN1252 character set and AL16UTF16 NCHAR character set
    About to export specified tables via Conventional Path ...
    Table(T) or Partition(T:P) to be exported: (RETURN to quit) > MyTableName
    EXP-00011: SCOTT.MYTABLENAME does not exist
    Table(T) or Partition(T:P) to be exported: (RETURN to quit) > "MyTableName"
    . . exporting table                    MyTableName         14 rows exported
    Table(T) or Partition(T:P) to be exported: (RETURN to quit) >
    Export terminated successfully with warnings.
    C:\Temp>

  • Blanks, spetial characters in column and table names

    Is there any posibility, which i have overseen to change the sugested table and column names to something with mixed case, blanks, spetial characters, which often occurs in the MS World. It's uggly but 1000 times better then rewriting code, or changing create table scrips like this:
    CREATE TABLE "BDProjection"
    "ID" NUMBER(11) DEFAULT 0 NOT NULL,
    "Name" VARCHAR2(4000),
    "Semi-major axis" NUMBER(20,5) DEFAULT 0,
    "Semi-minor axis" NUMBER(20,5) DEFAULT 0,
    "Latitude origin" NUMBER(20,5) DEFAULT 0,
    "Longitude" NUMBER(20,5) DEFAULT 0,
    "False easting" NUMBER(20,5) DEFAULT 0,
    "False northing" NUMBER(20,5) DEFAULT 0,
    "Scale factor at origin" NUMBER(20,5) DEFAULT 0,
    "scale Coords" NUMBER(11) DEFAULT 0,
    "default" NUMBER(1) DEFAULT 0,
    "MinEasting" NUMBER(20,5) DEFAULT 0,
    "MaxEasting" NUMBER(20,5) DEFAULT 0,
    "MinNorthing" NUMBER(20,5) DEFAULT 0,
    "MaxNorthing" NUMBER(20,5) DEFAULT 0
    This may be a sugestion for a future relaese.
    Uwe

    To query your table, as is:
    SQL> SELECT *
    2 FROM cst_customer
    3 WHERE "#_CUST" = 10030;
    To get rid of the #'s in the column names of your table:
    SQL> CREATE TABLE new_cst_customer
    2 AS
    3 SELECT "#_CUST" no_cust,
    4 "#_PH_BUS" no_ph_bus,
    5 "#_PH_HOME" no_ph_home,
    6 n_cust_surname
    7 FROM cst_customer;
    Table created.
    SQL> DROP TABLE cst_customer;
    Table dropped.
    SQL> CREATE TABLE cst_customer
    2 AS
    3 SELECT *
    4 FROM new_cst_customer;
    Table created.
    Then, you can query your table as follows:
    SQL> SELECT *
    2 FROM cst_customer
    3 WHERE no_cust = 10030;
    You will need to recreate any constraints associated with the table and recompile any procedures, functions, triggers, and packages associated with the table, and change any code to use the new column names. It would be a good idea to make a list of all the changes to be made and make a backup copy of the table before you start. In your code, just replace all #_ with no_. If you are just getting started, it would be worth your while to make the changes now and save a lot of hassles later. If you have a lot of dependencies, it might be better just to use the quotes everywhere. I have seen posts by someone else with a similar situation and everything he tries to do has to be done specially because of it; Creating a simple procedure becomes "procedure agony".
    null

  • How to get the column name and table name from xml file

    I have one XML file, I generated xsd file from that xml file but the problem is i dont know table name and column name. So my question is how can I retrieve the data from that xml file?

    Here's an example using binary XML storage (instead of Object-Relational storage as described in the article).
    begin
      dbms_xmlschema.registerSchema(
        schemaURL       => 'my_schema.xsd'
      , schemaDoc       => xmltype(bfilename('TEST_DIR','my_schema.xsd'), nls_charset_id('AL32UTF8'))
      , local           => true
      , genTypes        => false
      , genTables       => true
      , enableHierarchy => dbms_xmlschema.ENABLE_HIERARCHY_CONTENTS
      , options         => dbms_xmlschema.REGISTER_BINARYXML
    end;
    genTables => true : means that a default schema-based XMLType table will be created during registration.
    enableHierarchy => dbms_xmlschema.ENABLE_HIERARCHY_CONTENTS : indicates that a repository resource conforming to the schema will be automatically stored in the default table.
    If the schema is not annotated, the name of the default table is system-generated but derived from the root element name :
    SQL> select table_name
      2  from user_xml_tables
      3  where xmlschema = 'my_schema.xsd'
      4  and element_name = 'employee';
    TABLE_NAME
    employee1121_TAB
    (warning : the name is case-sensitive)
    To annotate the schema and control the naming, modify the content to :
    <?xml version="1.0" encoding="UTF-8" ?>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xdb="http://xmlns.oracle.com/xdb">
      <xs:element name="employee" xdb:defaultTable="EMPLOYEE_XML">
        <xs:complexType>
    Next step : create a resource, or just directly insert an XML document into the table.
    Example of creating a resource :
    declare
      res  boolean;
      doc  xmltype := xmltype(
    '<employee>
      <details>
        <emp_id>1</emp_id>
        <emp_name>SMITH</emp_name>
        <emp_age>40</emp_age>
        <emp_dept>10</emp_dept>
      </details>
    </employee>'
    begin
      res := dbms_xdb.CreateResource(
               abspath   => '/public/test.xml'
             , data      => doc
             , schemaurl => 'my_schema.xsd'
             , elem      => 'employee'
    end;
    The resource has to be schema-based so that the default storage mechanism is triggered.
    It could also be achieved if the document possesses an xsi:noNamespaceSchemaLocation attribute :
    SQL> declare
      2 
      3    res  boolean;
      4    doc  xmltype := xmltype(
      5  '<employee xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      6             xsi:noNamespaceSchemaLocation="my_schema.xsd">
      7    <details>
      8      <emp_id>1</emp_id>
      9      <emp_name>SMITH</emp_name>
    10      <emp_age>40</emp_age>
    11      <emp_dept>10</emp_dept>
    12    </details>
    13   </employee>'
    14   );
    15 
    16  begin
    17    res := dbms_xdb.CreateResource(
    18             abspath   => '/public/test.xml'
    19           , data      => doc
    20           );
    21  end;
    22  /
    PL/SQL procedure successfully completed
    SQL> set long 5000
    SQL> select * from "employee1121_TAB";
    SYS_NC_ROWINFO$
    <employee xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceS
      <details>
        <emp_id>1</emp_id>
        <emp_name>SMITH</emp_name>
        <emp_age>40</emp_age>
        <emp_dept>10</emp_dept>
      </details>
    </employee>
    Then use XMLTABLE to shred the XML into relational format :
    SQL> select x.*
      2  from "employee1121_TAB" t
      3     , xmltable('/employee/details'
      4         passing t.object_value
      5         columns emp_id   integer      path 'emp_id'
      6               , emp_name varchar2(30) path 'emp_name'
      7       ) x
      8  ;
                                     EMP_ID EMP_NAME
                                          1 SMITH

  • Table name input. and output i need  all rows and columns  using procedures

    hi,
    question: table name input. and output i need all rows and columns by using procedures.
    thanks,
    To All

    An example of using DBMS_SQL package to execute dynamic SQL (in this case to generate CSV data in a file)...
    As sys user:
    CREATE OR REPLACE DIRECTORY TEST_DIR AS '\tmp\myfiles'
    GRANT READ, WRITE ON DIRECTORY TEST_DIR TO myuser
    /As myuser:
    CREATE OR REPLACE PROCEDURE run_query(p_sql IN VARCHAR2
                                         ,p_dir IN VARCHAR2
                                         ,p_header_file IN VARCHAR2
                                         ,p_data_file IN VARCHAR2 := NULL) IS
      v_finaltxt  VARCHAR2(4000);
      v_v_val     VARCHAR2(4000);
      v_n_val     NUMBER;
      v_d_val     DATE;
      v_ret       NUMBER;
      c           NUMBER;
      d           NUMBER;
      col_cnt     INTEGER;
      f           BOOLEAN;
      rec_tab     DBMS_SQL.DESC_TAB;
      col_num     NUMBER;
      v_fh        UTL_FILE.FILE_TYPE;
      v_samefile  BOOLEAN := (NVL(p_data_file,p_header_file) = p_header_file);
    BEGIN
      c := DBMS_SQL.OPEN_CURSOR;
      DBMS_SQL.PARSE(c, p_sql, DBMS_SQL.NATIVE);
      d := DBMS_SQL.EXECUTE(c);
      DBMS_SQL.DESCRIBE_COLUMNS(c, col_cnt, rec_tab);
      FOR j in 1..col_cnt
      LOOP
        CASE rec_tab(j).col_type
          WHEN 1 THEN DBMS_SQL.DEFINE_COLUMN(c,j,v_v_val,2000);
          WHEN 2 THEN DBMS_SQL.DEFINE_COLUMN(c,j,v_n_val);
          WHEN 12 THEN DBMS_SQL.DEFINE_COLUMN(c,j,v_d_val);
        ELSE
          DBMS_SQL.DEFINE_COLUMN(c,j,v_v_val,2000);
        END CASE;
      END LOOP;
      -- This part outputs the HEADER
      v_fh := UTL_FILE.FOPEN(upper(p_dir),p_header_file,'w',32767);
      FOR j in 1..col_cnt
      LOOP
        v_finaltxt := ltrim(v_finaltxt||','||lower(rec_tab(j).col_name),',');
      END LOOP;
      --  DBMS_OUTPUT.PUT_LINE(v_finaltxt);
      UTL_FILE.PUT_LINE(v_fh, v_finaltxt);
      IF NOT v_samefile THEN
        UTL_FILE.FCLOSE(v_fh);
      END IF;
      -- This part outputs the DATA
      IF NOT v_samefile THEN
        v_fh := UTL_FILE.FOPEN(upper(p_dir),p_data_file,'w',32767);
      END IF;
      LOOP
        v_ret := DBMS_SQL.FETCH_ROWS(c);
        EXIT WHEN v_ret = 0;
        v_finaltxt := NULL;
        FOR j in 1..col_cnt
        LOOP
          CASE rec_tab(j).col_type
            WHEN 1 THEN DBMS_SQL.COLUMN_VALUE(c,j,v_v_val);
                        v_finaltxt := ltrim(v_finaltxt||',"'||v_v_val||'"',',');
            WHEN 2 THEN DBMS_SQL.COLUMN_VALUE(c,j,v_n_val);
                        v_finaltxt := ltrim(v_finaltxt||','||v_n_val,',');
            WHEN 12 THEN DBMS_SQL.COLUMN_VALUE(c,j,v_d_val);
                        v_finaltxt := ltrim(v_finaltxt||','||to_char(v_d_val,'DD/MM/YYYY HH24:MI:SS'),',');
          ELSE
            v_finaltxt := ltrim(v_finaltxt||',"'||v_v_val||'"',',');
          END CASE;
        END LOOP;
      --  DBMS_OUTPUT.PUT_LINE(v_finaltxt);
        UTL_FILE.PUT_LINE(v_fh, v_finaltxt);
      END LOOP;
      UTL_FILE.FCLOSE(v_fh);
      DBMS_SQL.CLOSE_CURSOR(c);
    END;This allows for the header row and the data to be written to seperate files if required.
    e.g.
    SQL> exec run_query('select * from emp','TEST_DIR','output.txt');
    PL/SQL procedure successfully completed.Output.txt file contains:
    empno,ename,job,mgr,hiredate,sal,comm,deptno
    7369,"SMITH","CLERK",7902,17/12/1980 00:00:00,800,,20
    7499,"ALLEN","SALESMAN",7698,20/02/1981 00:00:00,1600,300,30
    7521,"WARD","SALESMAN",7698,22/02/1981 00:00:00,1250,500,30
    7566,"JONES","MANAGER",7839,02/04/1981 00:00:00,2975,,20
    7654,"MARTIN","SALESMAN",7698,28/09/1981 00:00:00,1250,1400,30
    7698,"BLAKE","MANAGER",7839,01/05/1981 00:00:00,2850,,30
    7782,"CLARK","MANAGER",7839,09/06/1981 00:00:00,2450,,10
    7788,"SCOTT","ANALYST",7566,19/04/1987 00:00:00,3000,,20
    7839,"KING","PRESIDENT",,17/11/1981 00:00:00,5000,,10
    7844,"TURNER","SALESMAN",7698,08/09/1981 00:00:00,1500,0,30
    7876,"ADAMS","CLERK",7788,23/05/1987 00:00:00,1100,,20
    7900,"JAMES","CLERK",7698,03/12/1981 00:00:00,950,,30
    7902,"FORD","ANALYST",7566,03/12/1981 00:00:00,3000,,20
    7934,"MILLER","CLERK",7782,23/01/1982 00:00:00,1300,,10The procedure allows for the header and data to go to seperate files if required. Just specifying the "header" filename will put the header and data in the one file.
    Adapt to output different datatypes and styles are required.

  • Convert data in table to mix case

    Hi All,
    I have a table that contains data.
    This table has to columns, an id and description.
    I would like to update my table to convert data to mix case.
    As of now, all of my data in the table are lower case.
    What I mean by mix case is first letter for each word is uppercase and the rest are lower case.
    is there a function i can use ?
    example:
    Amended/Resentence, Type UnknownThanks

    You can use the INITCAP function.
    update table
    set description = INITCAP(description);Example:
    create table test (description varchar(50));
    Table created
    insert into test values ('amended/resentence, type unknown');
    1 row inserted
    select * from test;
    DESCRIPTION
    amended/resentence, type unknown
    update test set description = initcap(description);
    1 row updated
    select * from test;
    DESCRIPTION
    Amended/Resentence, Type Unknown

  • Jdbc bug in executeUpdate(sql, int[]) when table name is case-sensitive;

    I have found a bug in oracle's jdbc (ojdbc6.jar), can someone tell me how to submit it so that it can be fixed?
    The BUG: using executeUpdate(insert_sql_stmt, int[]) to retrieve the generatedKey generated by before-insert trigger using a sequence results in error when the tablename is case-sensitive (but OK if table name in uppercase).
    Steps to reproduce:
    1a. create table "mixCase" (f1 integer, f2 varchar2(20));
    1b. create table upperCase (f1 integer, f2 varchar2(20));
    2a. create sequence mixCase_seq start with 1;
    2b. create sequence upperCase seq start with 1;
    3a. create or replace trigger mixCase_trigger before insert on "mixCase"
    bq. for each row \\ begin \\ select mixCase_seq.nextval into :new.f1 from dual; \\ end;
    3b. create or replace trigger upperCase_trigger before insert on upperCase
    bq. for each row \\ begin \\ select upperCase_seq.nextval into :new.f1 from dual; \\ end;
    4a. String url = "jdbc:oracle:thin:@//localhost:1521/orcl";
    bq. conn=DriverManager.getConnection(url,user,password); \\ Statement stmt = conn.createStatement (); \\ int rc=stmt.executeUpdate("insert into \"mixCase\"(f2) values('aa')",new int[]{1});
    4b. String url = "jdbc:oracle:thin:@//localhost:1521/orcl";
    bq. conn=DriverManager.getConnection(url,user,password); \\ Statement stmt = conn.createStatement (); \\ int rc=stmt.executeUpdate("insert into upperCase(f2) values('aa')",new int[]{1});
    When you run 4a or 4b in a java jdbc program:
    4b runs OK and rset=stmt.getGeneratedKeys() returns the correct f1 value of 1.
    4a results in error:
    bq. h6. java.sql.SQLSyntaxErrorException: ORA-00942: table or view does not exist \\ + at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:91)+ \\ + at oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:112)+ \\ + at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:173)+ \\ + at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:455)+ \\ + at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:406)+ \\ + ...+
    +Notes:&lt;/&lt;/em&gt;
    # If Statement.RETURN_GENERATEDKEYS is used instead of "new int[]{1}" in 4b, there is no error but the rset=stmt.getGeneratedKeys() returned in a ROWID such as 'AAARUyAAEAAAAGQAAL', not what is expected. Other database's jdbc return the correct generated integer value.
    # Same 4b error if new String[]{"f1"} is used as 2nd argument for executeUpdate.
    # The only difference in 4a and 4b is that 4a has case-sensitive table name. All sequence names, trigger names, column names are implicitly deemed to be uppercase by oracle in both cases.
    bq.
    Edited by: user10343198 on Oct 2, 2008 5:50 PM
    Edited by: user10343198 on Oct 2, 2008 6:34 PM

    Please patch one fo your machines to 10.2.0.3 and then try and duplicate. You do not have to go through the complete registration of the XSD process thoguh you can check and see if the c based parser will validate on the command line using the
    schema executible under your oracle_home bin directory.
    schema 1.xml 1.xsd
    for example
    if it dupes in 10.2.0.3 open a TAR with support so that we may bug it.
    regards
    Coby

  • Table names and column names defined by other languages, not English.

    Hi, everyone.
    I am wondering if there are any possible problems or any inconvenience
    when I define table names and column names by Japanese, not English.
    Currently, we are using SQL server 2000 as a db and windows as a operating
    system. In the near future, we have the plan to change the database software
    and operating system to "Oracle 10g" and "Linux O/S".
    I have not experienced the oracle database, which has table names and column
    names defined by other languages, not English.
    Personally, I would like to use English as table names and column names.
    In this case, I might have to provide appropriate reasons.
    Are there any possible problems or any "inconvenience" in terms of
    system maintenance, development, or something else ?
    What could be pros and cons in this case?
    Thanks in advance.
    Have a nice day.
    Best Regards.
    Ho.

    First you need to make sure your database has character set that support Japanese.
    Choosing a Character Set
    http://download-west.oracle.com/docs/cd/B19306_01/server.102/b14225/ch2charset.htm#i1007681
    The main "inconvenience" you will have is if the client doesn't support Japanese or unicode, it will have trouble to access the table.
    And say in future after the application been developed, you want to implement the schema in some English environment, you will have hard time to do it.
    My point is English tablename and column names doesn't prevent you use it in Japanese environment and save Japanese data but not vice-versa. Hope you understand.

  • Translation of Columns and Table Names

    Hi,
    We are starting a large migration project and we have a mix of dutch and english developers.
    I was wondering if there is any clever ways to translate column names and table names.
    Not physically translate the text but store the english column name against the dutch column name?
    I know I could write a view which overlays the table with the english version but I was wondering if there was something a bit cleverer?
    Anyway to store multiple meta data against a physical table?
    Thanks
    Richard

    I'd tend to agree with Nicolas that you'd generally want all the developers to agree on what a particular object was called rather than having half of them think of it in Dutch and half in English.
    On the other hand, it would make sense to me that the comments you create on your objects and tables should be multilingual, i.e.
    SQL> create table my_emp (
      2    name varchar2(100)
      3  );
    Table created.
    SQL> comment on table my_emp is 'Table containing employee information.
      2  Lijst die werknemersinformatie bevat.';
    Comment created.(The translation is from babelfish.yahoo so I apologize if it butchers the Dutch).
    The developers should be able to see the table and column comments in their IDE of choice and should be able to see what the object represents in their language.
    Justin

  • Join a row to a table name stored within a column ?

    Hi guys - can you tell me if this is doable at all ?
    I've an existing table with a lot of data in it that I wish to query on.
    This table has a text column, and then 4 more columns - Join Table name, Join column name, Join value and table value column.
    The 3 join 3 columns allow me to join this piece of text to a row in another table, identified by the 3 join columns listed above.
    Now, I appreciate this is a lousy design, but its in place and there's nothing I can do about it.
    I do however need to get a row by row report of the text, followed by the value stored in the column identified by table id column.
    So lets say I have
    Table_A
    Pers_ID
    Name
    Age
    Sex
    Table_B
    Col_ID
    Colour
    Hue
    My text table will have rows like this
    Text
    text = 'Person A Age'
    join tablename = 'Table_A'
    join columnname = 'Pers_ID'
    join value = 1
    table value column = 'Age'
    text = 'Person B Sex'
    join tablename = 'Table_A'
    join columnname = 'Pers_ID'
    join value = 2
    table value column = 'Sex'
    text = 'Pers A Fave Colour'
    join tablename = 'Table_B'
    join columnname = 'Col_ID'
    join value = 1
    table value column = 'Colour'
    So - what I should be able to do is go to either table a, and select the column specified, where the id column = the value supplied.
    The only way I can think of doing this is to create a temporary table and go through the text table, row by row using pl/sql and select from whatever table it tells me to using dynamic sql and populate the temporary table.
    Can this be done using sql ??

    Hi,
    ScottyH wrote:
    Hi guys - can you tell me if this is doable at all ?
    I've an existing table with a lot of data in it that I wish to query on.
    This table has a text column, and then 4 more columns - Join Table name, Join column name, Join value and table value column.
    The 3 join 3 columns allow me to join this piece of text to a row in another table, identified by the 3 join columns listed above.
    Now, I appreciate this is a lousy design, ...I agree. It's a variation of the Entity-Attribute-Value (EAV) model, which might be a good thing if relational databases didn't exist.
    I think your present approach, using dynamic SQL, is the best that you can do.
    One possible alternative is to unpivot table_a, table_b, and all the other tables like them into an EAV form, then do a UNION of all those unpivoted results. (You could do this in a view, if you wanted to.) Then your query would simply be a join between your text table and the EAV table (or view).
    If you'd care to post CREATE TABLE and INSERT statements for a little sample data, and the results you want from that data, then I could demonstrate what I mean.
    What version of Oracle are you using? You should always include this when you have a question. It might not matter in this case, but why take a chance?
    Here's another approach that would work in very special circumstances.
    If there are only a couple of tables like table_a and table_b, and they only have a couple of columns that you might need to reference, then you could do all possible joins, and use CASE expressions to get the results from the one you actually want. All the joins would have to be outer joins, so I expect this approach would be very slow.

Maybe you are looking for