Thanks
Faisal, May 29, 2005 - 12:25 pm UTC
Thanks Tom, this is exactly I was looking for, I will use bulk collect, but do I have to define column by column in the statement below or I can define record type.
create or replace type myScalarType as object
( empno number, ename varchar2(30)) <-- I have more then 100 columns here
Thanks again
May 29, 2005 - 1:01 pm UTC
object types are not PLSQL record types, there is no "create type x as record of table" or anything.
But bear in mind, with more than 100 columns -- you MERGE is going to have to reference them by name anyhow.
To reduce the potential for error, I'd be tempted to use a plsql routine to create this type from the data dictionary. If the underlying schema changes, it can be used to regenerate the correct type.
Another option?
Bob B, May 29, 2005 - 12:54 pm UTC
I'm taking a wild guess here, but it seems like the purpose of the procedure is to pass in a result set containing valid data (employees in the example) and to merge them into existing table data (all employees in the example). This sounds like a good place to bulk insert into a GTT and then merge the GTT into the table. Something like:
1) Open cursor
2) Bulk collect cursor into plsql table
3) Bulk insert plsql table into GTT
4) Merge GTT into destination table
5) Close cursor
Steps 3 and 4 could be put into their own procedure as a means to merge a plsql table into the destination table.
I'll post an example when I have access to Oracle again =/ (Tue)
May 29, 2005 - 1:03 pm UTC
sure, the example would be to bulk collect, process, bulk insert and then merge.
But, if you are going to bulk insert and spend cycles doing that, might just as well merge in the first place? seems to be cutting out of step this way rather than adding one.
(I cannot imagine life without access to the database! I'm at home and I have at least 10 instances running -- well, 12 if you count the RAC database I just turned on to look at something.... and access to dozens more at work if needed :)
What is GTT?
Faisal, May 29, 2005 - 1:22 pm UTC
Tom thanks for quick response, I got your point.
Bob: What is GTT means?
May 29, 2005 - 3:04 pm UTC
Global
Temporary
Table
gtt = global temporary table
Matthias Rogel, May 29, 2005 - 3:05 pm UTC