Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Update table procedure through pl sql using loop

2986888Jul 29 2015 — edited Jul 31 2015

Assuming that I have only one table : members_tbl which columns are : SN, FN, DB, IDDBL,FLAG, DBLCRIT

I need to update the table if some conditions are OK with this algorithm :

id_dup := 1;

FOR (i in 1 to Nrow(members_tbl)) THEN

  {

  FOR (j in (i+1) to Nrow(members_tbl)) THEN

  {

  IF(members_tbl(i).iddbl IS NULL) THEN

  members_tbl(i).iddbl := id_dup

  IF (((members_tbl(i).DB ==members_tbl(j).DB)

     AND (UTL_MATCH.jaro_winkler_similarity(members_tbl(i).SN,members_tbl(j).SN) > 80)

     AND (UTL_MATCH.jaro_winkler_similarity(members_tbl(i).FN,members_tbl(j).FN) > 80))

     AND (members_tbl(j).iddbl IS NULL)) THEN

       {

         members_tbl(j).iddbl := id_dup;

         members_tbl(i).flag := 1;

         members_tbl(j).flag := 1;

         members_tbl(i).dblcrit:= 1;

         members_tbl(j).dblcrit:= 1;

  }

  }

  id_dup := id_dup + 1;

  }

Is there a way to write this algorithm in a pl/sql procedure ? I'm relatively new to PL/SQL and i've never written a stored procedure.

This post has been answered by BluShadow on Jul 30 2015
Jump to Answer

Comments

Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Aug 28 2015
Added on Jul 29 2015
21 comments
3,004 views