Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: maximum number of columns per table
Frank van Bortel wrote:
>>> CREATE TABLE parent ( >>> obj_id NUMBER, >>> obj_name VARCHAR2(30)); >>> >>> CREATE TABLE attribute ( >>> obj_id NUMBER, >>> attrnum NUMBER(2), >>> attrval VARCHAR2(10)); >>> >>> Is one way to approach the problem. >> >> >> >> I understand your approach. But what about the overhead of reading say >> 150 rows every time when you only wanted one 'logical' row? Sure, in >> some cases you don't need all 150 columns - but even then, the need to >> code the multiple reads instead of a single 'select *' adds complexity >> to the code. >> >>
As the OP stated, it's not a performance problem, it's a coding problem. There's nothing in the database that assures you that, for every ATTRNUM, all OBJ_IDs are filled, at least with a NULL value. So turning a dataset like this:
ATTRNUM OBJ_ID ATTRVAL
------- ------ -------
1 1 AFW 1 3 DAE 2 1 CAL 2 2 SOP 2 3 MON 3 2 COP
... into a report like this:
+---------+-----------+-----------+-----------+ | attrnum | obj_id(1) | obj_id(2) | obj_id(3) | +---------+-----------+-----------+-----------+
| 1 | AFW | n/a | DAE | | 2 | CAL | SOP | MON | | 3 | n/a | COP | n/a |+---------+-----------+-----------+-----------+
... requires more coding than usual. You can't do it using only SQL. I believe this contradicts Daniel's principle that developers should be focusing on getting the data out of the database.
Kind regards,
-- Cris Carampa (spamto:cris119_at_operamail.com) What once seemed black and white turns to so many shades of gray...Received on Wed Jul 21 2004 - 07:33:33 CDT