Geeks Talk

Prepare for your Next Interview


Welcome to the Geeks Talk forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.

View

This is a discussion on View within the Oracle forums, part of the Databases category; 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 ...

Go Back   Geeks Talk > Databases > Oracle
Register Blogs FAQ Tag Cloud Calendar Mark Forums Read

Oracle Oracle 9i & Oracle 10g Knowledge Base Learn and Share Oracle Technology related articles, white papers, tutorials / study materials, example codes, FAQ's, Tips and Tricks.

Reply

 

LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 12-21-2007
Expert Member
 
Join Date: Sep 2007
Posts: 738
Thanks: 22
Thanked 67 Times in 65 Posts
krishnaindia2007 is on a distinguished road
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?
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 02-18-2008
Junior Member
 
Join Date: Dec 2007
Location: chennai
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
mrprasad is on a distinguished road
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.
Reply With Quote
  #3 (permalink)  
Old 02-18-2008
Contributing Member
 
Join Date: Feb 2008
Location: Hyderabad
Posts: 32
Thanks: 4
Thanked 2 Times in 2 Posts
jaya_geek is on a distinguished road
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
Reply With Quote
  #4 (permalink)  
Old 02-18-2008
Expert Member
 
Join Date: Sep 2007
Posts: 738
Thanks: 22
Thanked 67 Times in 65 Posts
krishnaindia2007 is on a distinguished road
Re: View

Yes, what jaya said is correct. I am not talking about alias names. My doubt is how a coloum name accepted quotes?
Reply With Quote
  #5 (permalink)  
Old 02-19-2008
Junior Member
 
Join Date: Dec 2007
Location: chennai
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
mrprasad is on a distinguished road
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.
Reply With Quote
  #6 (permalink)  
Old 02-19-2008
Expert Member
 
Join Date: Apr 2007
Location: Bangalore
Posts: 518
Thanks: 30
Thanked 63 Times in 61 Posts
susarlasireesha will become famous soon enough
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;
Reply With Quote
  #7 (permalink)  
Old 02-19-2008
Contributing Member
 
Join Date: Feb 2008
Location: Hyderabad
Posts: 32
Thanks: 4
Thanked 2 Times in 2 Posts
jaya_geek is on a distinguished road
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
Reply With Quote
Reply

  Geeks Talk > Databases > Oracle

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads

Thread Thread Starter Forum Replies Last Post
How to view constraints? Bhuvana07 Oracle 6 02-13-2009 07:27 PM
Normal View, Materialised View and Bitmap Index Geek_Guest Oracle 3 05-28-2008 12:59 AM
Not able to view the script Geek_Guest LoadRunner 5 01-23-2008 08:15 PM
Materailized view krishnaindia2007 Oracle 2 11-26-2007 10:18 AM
A View Doubt krishnaindia2007 Oracle 5 11-13-2007 08:59 AM


All times are GMT -4. The time now is 05:20 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.3.1
Copyright © 2009 GeekInterview.com. All Rights Reserved