10 6778
"Niy" <ni***@hotmail.com> wrote in message
news:55**************************@posting.google.c om...
| why?
that's the rules
also, '-' has special meaning to the parser
however, just like Access and VB use [] delimiters, Oracle (and I believe
this is standard ANSI SQL) uses "" delimiters to allow 'illegal' column (and
other object) names -- but I wouldn't recommend this
just use _ instead of -, and life with oracle will be just fine
;-{) mcs
IF you had a tale with columns
a number
b number
a-b number
what would return
select a-b from x
?
your question is not clear, but it looks like you need to do research on
expressions -- take some time reading the Oracle SQL Reference manual, and
running some tests
you will find that oracle does not support derived columns in table
definitions, but it does in views
;-{ mcs
"x" <x@x.hr> wrote in message news:c1**********@ls219.htnet.hr...
| IF you had a tale with columns
|
| a number
| b number
| a-b number
|
| what would return
|
| select a-b from x
|
| ?
|
|
"x" <x@x.hr> wrote in message news:<c1**********@ls219.htnet.hr>... IF you had a tale with columns
a number b number a-b number
what would return
select a-b from x
?
Obviously a minus b:
SQL> @test
SQL> create table marktest3 (
2 a number, b number, "a-b" number);
Table created.
SQL> desc marktest3
Name Null? Type
----------------------------------------- --------
----------------------------
A NUMBER
B NUMBER
a-b NUMBER
SQL>
SQL> insert into marktest3 values (6,4,9);
1 row created.
SQL> commit;
Commit complete.
SQL>
SQL> select a, b, a-b, "a-b" from marktest3;
A B A-B a-b
---------- ---------- ---------- ----------
6 4 2 9
SQL>
SQL> drop table marktest3;
Table dropped.
If you need a col "a-b" it would be better to name it a_minus_b,
diff_a_b, or some such than use double quotes to create potential
problems for users.
HTH -- Mark D Powell --
| SQL> select a, b, a-b, "a-b" from marktest3;
|
| A B A-B a-b
| ---------- ---------- ---------- ----------
| 6 4 2 9
|
| SQL>
| SQL> drop table marktest3;
|
| Table dropped.
|
| If you need a col "a-b" it would be better to name it a_minus_b,
| diff_a_b, or some such than use double quotes to create potential
| problems for users.
|
| HTH -- Mark D Powell --
unless there's a specific identified processing advantage to storing a
derived value, the "a-b" or a_minus_b column really should be implemented
via a view, not included in the table.
(function-based indexes would be an alternative if searches are often done
on the derived value, if an index would be effective in those searches)
-- mcs
"Mark C. Stock" <mcstockX@Xenquery .com> wrote in message news:<OL********************@comcast.com>... | SQL> select a, b, a-b, "a-b" from marktest3; | | A B A-B a-b | ---------- ---------- ---------- ---------- | 6 4 2 9 | | SQL> | SQL> drop table marktest3; | | Table dropped. | | If you need a col "a-b" it would be better to name it a_minus_b, | diff_a_b, or some such than use double quotes to create potential | problems for users. | | HTH -- Mark D Powell --
unless there's a specific identified processing advantage to storing a derived value, the "a-b" or a_minus_b column really should be implemented via a view, not included in the table. (function-based indexes would be an alternative if searches are often done on the derived value, if an index would be effective in those searches)
-- mcs
Mark, very true. I was just trying to make a point about meaningful
names and should have thought of that also.
Saving calculated values should only be done where either the
variables of the calculation are not retained with the result such as
in a history table OR the cost of calculating the result is too
expensive. Our electronics and prototype lab calculates values that
often take significant time per calculation so even it the variable
values are saved it is not feasible to recalculate the results for
display.
-- Mark D Powell --
Thanks for the reply.
In v$transaction, you can see
DSCN-B, DSCN-W columns, how
to select them?
"Niy" <ni***@hotmail.com> wrote in message
news:55**************************@posting.google.c om...
| Thanks for the reply.
|
| In v$transaction, you can see
| DSCN-B, DSCN-W columns, how
| to select them?
very observant -- you have to (always) use double-quotes to select these
columns, and type them in upper case, because oracle (why, oh, why?) used
non-conforming column names here
the only exception to 'always' is when you do a SELECT *
select addr, "DSCN-B", "DSCN-W"
from v$transaction
;-{ mcs
"Mark D Powell" <Ma*********@eds.com> wrote in message
news:26**************************@posting.google.c om...
| "Mark C. Stock" <mcstockX@Xenquery .com> wrote in message
news:<OL********************@comcast.com>...
| > | SQL> select a, b, a-b, "a-b" from marktest3;
| > |
| > | A B A-B a-b
| > | ---------- ---------- ---------- ----------
| > | 6 4 2 9
| > |
| > | SQL>
| > | SQL> drop table marktest3;
| > |
| > | Table dropped.
| > |
| > | If you need a col "a-b" it would be better to name it a_minus_b,
| > | diff_a_b, or some such than use double quotes to create potential
| > | problems for users.
| > |
| > | HTH -- Mark D Powell --
| >
| > unless there's a specific identified processing advantage to storing a
| > derived value, the "a-b" or a_minus_b column really should be
implemented
| > via a view, not included in the table.
| > (function-based indexes would be an alternative if searches are often
done
| > on the derived value, if an index would be effective in those searches)
| >
| > -- mcs
|
| Mark, very true. I was just trying to make a point about meaningful
| names and should have thought of that also.
|
| Saving calculated values should only be done where either the
| variables of the calculation are not retained with the result such as
| in a history table OR the cost of calculating the result is too
| expensive. Our electronics and prototype lab calculates values that
| often take significant time per calculation so even it the variable
| values are saved it is not feasible to recalculate the results for
| display.
|
| -- Mark D Powell --
point well made, and good real-world example
;-{ mcs
Thank you for your answers, but I didn't ask what would select a-b return, I
just answered to 'why column name can't include character '-''
My point is that in that cese select a-b would be confusing. select "a-b" is
something else. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Martin Lucas-Smith |
last post by:
Can anyone point me to a regular expression in PHP which could be used to
check that a proposed (My)SQL database/table/column name is valid, i.e.
shouldn't result in an SQL error when created?
...
|
by: Albretch |
last post by:
I am trying to insert some textual data belonging to an HTML page into
a table column with 'TEXT' as data type
mysql's maual _/manual.html#String_types tell you, you may insert up
to (2^16 - 1),...
|
by: CharlesEF |
last post by:
Hi All,
I have run into another problem that is eating my lunch. Should be
simple but I am having one heck of a time. Please look at this SELECT
statement:
SELECT FROM States WHERE ] =...
|
by: Owen T. Soroke |
last post by:
Using VB.NET
I have a ListView with several columns.
Two columns contain integer values, while the remaining contain string
values.
I am confused as to how I would provide functionality to...
|
by: CindyH |
last post by:
Hi
Does anyone know how to create a multi column combo box from the same table?
Thanks,
Cindy
|
by: Hexman |
last post by:
Hello All,
I'd like to find out the best way to add a cb column to a dgv and process efficiently. I see at least two ways of doing it.
-------------------------------
1) Add a cb to the dgv,...
|
by: Hemant Shah |
last post by:
Folks,
Today, I was exporting a table in one database and then importing it in
another database. The table in destination database was missing one column
(my mistake while creating the table),...
|
by: sameer_deshpande |
last post by:
Hi,
I have DB2 UTF-8 database (codeset IBM-1252) on Windows 2000 Server. I
need to store multi-byte contents. How do I calculate size of the
column to store multi-byte information?
F.ex: I...
|
by: Niy |
last post by:
why?
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |