Results 1 to 7 of 7

Thread: View

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Expert Member
    Join Date
    Sep 2007
    Answers
    697

    View

    I have given the following statement to create a view.

    CREATE OR REPLACE VIEW vw_divisiondetails
    ( divisioncode, divisionname)
    AS
    SELECT "divisioncode","divisionname"
    FROM cmsdivsionmaster

    It was created successfully. My doubt is how it accepted column names in double quotes? Generally we use double quotes in select statement to give alias name. But here it treats it as column name. Could any body explain how it works?


  2. #2
    Junior Member
    Join Date
    Dec 2007
    Answers
    2

    Re: View

    Hi,

    In ANSI oracle like Access the column names may contain a space. So while declaring a alias name in Oracle if you put it in a double quotes then it will recognise as a single word.

    SELECT "divisioncode" "division code","divisionname" "division name"
    FROM cmsdivsionmaster

    here "division code" will be treated as a single name. i think you are clear now.


  3. #3
    Junior Member
    Join Date
    Feb 2008
    Answers
    28

    Re: View

    hi all

    no no krishna, expected the answer about 'how coloum name accepted quotes" instead of alias. I think he knows that alias can have spaces.

    Jaya


  4. #4
    Expert Member
    Join Date
    Sep 2007
    Answers
    697

    Re: View

    Yes, what jaya said is correct. I am not talking about alias names. My doubt is how a coloum name accepted quotes?


  5. #5
    Junior Member
    Join Date
    Dec 2007
    Answers
    2

    Re: View

    As per the ANSI sql standards when we give a column name in double quotes it will be treated as a single word either it may be an alias or the column name. As i have the example for an alias name in oracle.


  6. #6
    Expert Member
    Join Date
    Apr 2007
    Answers
    500

    Re: View

    Quote Originally Posted by krishnaindia2007 View Post
    I have given the following statement to create a view.

    CREATE OR REPLACE VIEW vw_divisiondetails
    ( divisioncode, divisionname)
    AS
    SELECT "divisioncode","divisionname"
    FROM cmsdivsionmaster

    It was created successfully. My doubt is how it accepted column names in double quotes? Generally we use double quotes in select statement to give alias name. But here it treats it as column name. Could any body explain how it works?
    In sqlplus set escape as '"' i.e.,
    sqlplus-->options-->Environmnet-->select escape -->
    under escape option select current and in textbox give '"' and set escape on
    and click ok
    sql>set escape on

    now it takes double quations in column name
    sql > select "empno" from emp;


  7. #7
    Junior Member
    Join Date
    Feb 2008
    Answers
    28

    Re: View

    hi all

    @susarlasireesha

    well, it's ok, but can u explain what is escape and it's use?

    we should know the use of quotes with coloum. since we can't create a coloum name with spaces....i think ,there is no use of quotes while selecting.

    but in case of alias, quotes are so useful.

    i think there is nothing more to discuss about 'quotes with colums', except what is 'set escape....'

    Jaya


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact