FOR and FORALL

-cursor

Cursor curor1 IS

SELECT *

de table2;


BEGIN

-For LOOP

FOR Looper IN curor1 LOOP

SELECT count(*) INTO counter FROM table1 WHERE id = looper. id ;

IF meter > 0 THEN

SELECT name IN sacond_name DE table1 id = looper. id ;

IF sacond_name = Looper . Name THEN

Update Table2 the value name = x.name where id = looper. id ;

END IF;

ON THE OTHER

Insert into table2 ()id, name) values (squance, looper.name) ;

END IF;

END LOOP;



Can I use FORALL instead of to compare one table with others if its lack added to the second table, and if his fouund with the same id but different day name record in the second table.

TO improve performance.

I get this meesage from anlizer program.

(Whenever an insert, update, delete, or merge is executed inside a loop (cursor FOR loop, a simple loop, loop, etc.), you must convert the use collect in BULK and FORALL.) COLLECTION BULK is necessary when the loop queries data from relational tables. Even if Oracle will automatically optimize the performance of the query to match the COLLECTION BULK, you will need it in BULK COLLECT to fill the collections for FORALL. Use of FORALL will result in increased spectacular DML performance, thanks to the collections and the decrease of the context switches.)

Try the following query:

merge into Table2y

using Table1x

on (Table2y.id = Table1x.id)

When matched then

update the value Table2y.status = case when Table2y.name = Table1x.name then 'unchanged' other end 'Modified,'

Table2y.name = Table1x.name

When not matched then

Insert (id, name, State)

values (Table1x.id, Table1x.name, Table1x.status);

Tags: Database

Similar Questions

Maybe you are looking for

  • Japanese language that appear as question marks?

    Hello! I have a problem, where some of the things I look for or registered now appears as a question mark (?). I think I might have accidentally deleted something in the font book, this is why it appears this way. Please could someone help me? Here's

  • Satellite C850-B720 - order online mothrrboard

    HelloMy motherboard for laptop satellite model C850-B720 with part no PSCBYV-03W002AR, recently dead that my integrated graphics card work has failed... I want to order a new motherboard online to install by myself... Please let me know the link to o

  • Fix cards double during Contacts Apple?

    Contacts from Apple has a function «Look Let's double...» "that lets you know what he finds. For example, it will report, "30 double cards and 17 duplicate entries found." The dialog box gives me the choice of either merge duplicates or cancel. I don

  • Re-install XP Pro on a new computer, my 'old' is dead...

    I need to know if I can re - install the copy of XP Pro that I bought my laptop and have re-activated through Microsoft. The original computer I had my XP installed on died.

  • Vista organize by file type?

    XP has a tab to organize files by type.  I can't understand how to do this in Vista.  I work with image (jpeg and raw) files in the Solution Explorer and I need to have a set of JPEG files and raw together in a list form so I can download into separa