logs archiveIRC Archive / Freenode / #oracle / 2010 / February / 21 / 1
idletask
http://download.oracle.com/docs/cd/E11882_01/server.112/e10576/audplcy.htm#BGBCFBDI <-- WHAT??
They have to be joking!
idle_task
Gee
idletask
(Action) kicks Oracle devs hard
glaksmono
helppppppp
idletask
Yes, hello too
What's the problem?
glaksmono
how to create a primary key for Object
:(
my object has ID, and i need that ID to be primary key
unique and not null
well, primary key is unique and not null
idletask
Well, it's a primary key constraint on the column in the table, where's the difficulty in that?
glaksmono
hmm.. but the the CREATE TABLE just have the following right: CREATE OR REPLACE TABLE photos OF photo;
and i need photo.id to be the primary key
idletask
Eh?
How was the photo table created in the first place?
         

glaksmono
from Object?
photo is an object right?
idletask
No, what is the SQL statement that was used to create the table?
No, it's a table
Or you use features of Oracle that I don't know of, which is likely here
glaksmono
http://pastebin.com/d54f9be9d
idletask
I use Oracle as an rdbms, not an object store
Why go through an object in this case??
glaksmono
...
idletask
Your photo "object" could just be a table!
glaksmono
that's what i thought.. but..
isn't all objects can be converted into table anyway..
idletask
Err
Even in this case, why an object and why not create photos as a table, plain and simple?
glaksmono
but then it's the same thing as saying, what's the point of having ORDBMS then
hmmm.. i don't understand that part grr..
idletask
In ORDBMS, O and R contradict each other
glaksmono
what does that mean?
btw, is there AUTO_INCREMENT in Oracle?
no there's none
idletask
Not as such, but you can create sequences and bind a column to a sequence
glaksmono
hmm..
yeah
i should
idletask
What I meant by "O and R contradict each other" is that objects are accessed individually and are organized in trees, whereas a relational database operates on sets
Which means a fundamental difference in the basic organization of data to start with
glaksmono
hmm.. i see..
for the sequence bind to column, we need to use trigger right?
idletask
Sure, you have joins, but this is not what "relational" stands for
No, you don't
glaksmono
hmmm..
idletask
Relational is there to emphasize _the relation of the columns between them inside a table_
And this is where the normal forms come into play
And the non respect of the normal forms by application developers are the prime factor for poor performances in databases, not the database engine itself
glaksmono
hmmm
so for Object, there's no such a thing called primary key right?
i've seen so many examples, there's no examples which use primary key for the object
see, the way i see it is that Photo itself can be an Object
but it can also be a Table
so i'm not sure to decide on whether it should be a table or an object
idletask
Not if the object is anything other than, to your ORM, a direct mapping of a table, accessed by its id alone
Go for table, then
         

glaksmono
So, how do you decide (or know) whether it should be a table or Object?
idletask
ORMs are there to make them be viewed as objects at your application level
I never use objects, I use tables and ORMs :p
glaksmono
what is ORMs?
= ="..
that doesn't help..
idletask
Object Relational Mappers
glaksmono
lol..
ahhh..
idletask
Such as Hibernate, to only name the most popular
glaksmono
ohhh i see
yeah, that's true..
btw, is there drop table if exists in oracle?
and how do you bind sequence to column?
idletask
No, there no drop if exists afaik
As to your second question, a simple Google query can answer that
Let's see
There doesn't seem to be! Uh
Well
A good ORM (Hibernate does it, I know) will do that for you
glaksmono
omg, i'm getting a headache
i still got a problem!! :(
what's wrong with this one: http://pastebin.com/d684bbf44
helpppppppppppppppp
anyone here?
oh my god
what is the difference between foreign key and reference?
anyone here?
yellowww
i need love
helpppppppppp
anyone here?
helpppppppppppppp
cofeineSunshine
zdrastvuite
glaksmono
anyone here?
helpppppppppp
idletask
Hello
Am I the only one to have difficulties reading any note on Metalink?
The document titles are found but I can never get the full text of any document/note
The dbvault audit trail cannot be purged without disabling dbvault
Gah
Talk about a stupid design decision
unop
I'm trying to write a pl/sql stored proc that has something like this. for vtable in (select prodTable from blah) loop select barcode, price from vtable; end loop; but it appears vtable needs to be cast as something to be used in this fashion. Does anyone know how to do this?
idletask
No idea, I do'nt use cursors this way
unop
I think it might just work with a bulk collect .. but progress is slow, i'm new to oracle.
idletask
Why don't you create a view?
create view myview as select barcode, price from table1 union all select barcode, price from table2 bla bla?
And just select from myview?
unop
that works, but i don't have the list of tables beforehand, they're populated in a lookup table - don't ask me why it is this way but it just is
idletask
Ah
Well, you have another solution
Build your SQL statement to create or replace view in a string and use execute immediate
TheBonsai
a view can be fed by pl/sql code, so you can lookup your tables and query the proper fields + provide them in the view
idletask
http://www.oracle-base.com/articles/10g/StringAggregationTechniques.php <-- this gives a good number of tips
bbl
« prev next »