Query table with multi part column names [message #652705] |
Thu, 16 June 2016 14:52 |
|
bobghw
Messages: 34 Registered: July 2012
|
Member |
|
|
Hi I have imported data from a spreadsheet where the column names are multi part i.e. 'ordering organisation','referrer name'
how do I reference theses multi part column names?
|
|
|
Re: Query table with multi part column names [message #652707 is a reply to message #652705] |
Thu, 16 June 2016 14:55 |
John Watson
Messages: 8938 Registered: January 2010 Location: Global Village
|
Senior Member |
|
|
Do you mean something like this - orclz>
orclz> create table "silly name"("multi part" varchar2(10));
Table created.
orclz> insert into "silly name" values('something');
1 row created.
orclz> select "multi part" from "silly name";
multi part
----------
something
orclz>
|
|
|
|
|
|
|
Re: Query table with multi part column names [message #652714 is a reply to message #652713] |
Thu, 16 June 2016 15:21 |
Bill B
Messages: 1971 Registered: December 2004
|
Senior Member |
|
|
You can create a table with imbedded spaces in the table and table name but it is NOT a good pratice. If you need them to be descriptive then I would do the following
create table "silly name"("multi part" varchar2(10));
INSTEAD DO
create table silly_name(multi_part varchar2(10));
With the first table every command would have to be surrounded by double quotes and the case would have to be exact
for example the following would work
select "multi part"
from "silly name";
however the following would fail
select "Multi Part"
from "silly name";
with the second table the following would work fine
select multi_part
from silly_name;
select Multi_Part
from silly_name;
select multi_part
from SILLY_name;
[Updated on: Thu, 16 June 2016 15:23] Report message to a moderator
|
|
|