-
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?
-
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.
-
Re: View
hi all
no no krishna, expected the answer about '[B]how coloum name accepted quotes[/B]" instead of alias. I think he knows that alias can have spaces.
[B][COLOR="DarkOrange"]Jaya[/COLOR][/B]
-
Re: View
Yes, what jaya said is correct. I am not talking about alias names. My doubt is how a coloum name accepted quotes?
-
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.
-
Re: View
[QUOTE=krishnaindia2007;23002]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?[/QUOTE]
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;
-
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....'
[B][COLOR="DarkOrange"]Jaya [/COLOR][/B]:)