Results 1 to 6 of 6
  1. #1
    Join Date
    Feb 2004
    Posts
    5

    Question Unanswered: Help SQL Command

    Dear All,

    I just migrate our database going to ORACLE 9.2, but I have little problem with name of table.

    Before in our SQL, we can created table with name "USER", in sql command we can access using "select * from [user]".

    Right now, I am confused with ORACLE, how to access that table's name?

    This is possible or not? Please, give me an advice.

    thanks.

    regards,

    Johan

  2. #2
    Join Date
    Feb 2004
    Location
    Eternity
    Posts
    31
    Quite an intresting problem.
    But I really wonder if you will be able get the data as Oracle doesnt allow key words for table names.
    Obviousness is the enemy of Correctness
    --Bertand Russel

  3. #3
    Join Date
    Feb 2004
    Posts
    5

    Unhappy Advice

    Thanks your response before.

    Another thing is how to create default value in VARCHAR data type, ie. '' but not NULL value.

    I am trying to give empty quote ('') but not working properly, tested using SQL Plus got error, can not NULL value.

    My friends told me must using procedure to handle it.
    How about that?
    If you have idea, please told me.

    Thanks

    regards,

    Johan

  4. #4
    Join Date
    Feb 2004
    Posts
    11

    Re: Advice

    Originally posted by johan.wijaya
    Thanks your response before.

    Another thing is how to create default value in VARCHAR data type, ie. '' but not NULL value.

    I am trying to give empty quote ('') but not working properly, tested using SQL Plus got error, can not NULL value.

    My friends told me must using procedure to handle it.
    How about that?
    If you have idea, please told me.

    Thanks

    regards,

    Johan
    Hi..

    If you want to give a default value at the time of table creation you can give like this

    create table just (id number, name varchar2(20) default ' ' NOT NULL);
    (here default is ' ' is not empty.. space is there)

    if you want give some default value After table creation you need to write triggers.

    Thanks.
    learning Oracle

  5. #5
    Join Date
    Oct 2003
    Location
    St.Louis,MO
    Posts
    120

    Re: Help SQL Command

    Originally posted by johan.wijaya
    Dear All,

    I just migrate our database going to ORACLE 9.2, but I have little problem with name of table.

    Before in our SQL, we can created table with name "USER", in sql command we can access using "select * from [user]".

    Right now, I am confused with ORACLE, how to access that table's name?

    This is possible or not? Please, give me an advice.

    thanks.

    regards,

    Johan
    To access this table in Oracle the table_name must be enclosed in double quotes i.e.
    select * from "user"
    you must have the table_name exactly correct to how it is stored in the DB as double quotes will look only for the table user, Not User or USER or UsEr. It is case sensitive.

    BTW, change the table name.

  6. #6
    Join Date
    Feb 2004
    Posts
    5

    Re: Advice

    Originally posted by jeethu
    Hi..

    If you want to give a default value at the time of table creation you can give like this

    create table just (id number, name varchar2(20) default ' ' NOT NULL);
    (here default is ' ' is not empty.. space is there)

    if you want give some default value After table creation you need to write triggers.

    Thanks.
    Hi,

    Actually I am created that table using a Wizard, then put '' in text of default value and not null.

    If I put ' ' (with space in there), is ok.

    I am not interested with ' ', because in SQL Server (i am using before) ' ' and '' is different value.
    And I think in ORACLE also support this value.

    Presently, in my mind, to give default value in VARCHAR2 must be ' ' (with space). Is it true or not???

    Please advice.

    regards,

    Johan

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •