Question

UPDATE statement

Rating6.8Good

I need to update large amount of data into my Oracle database. But it take two day to finish updating 1/20 of the data. By establishment, it will take a whole month to finish updata. I could not wait this long. I had tried my best to optimaize my code and I had added Index to improve speed. PLEASE HELP!!!! (I use perl DBI::Oracle).

CODE:


$sth1=$dbh1->prepare("SELECT PDB_AA_num, residue, alignment_num, syn_AA_num, ".
                " swissprot_serial_ID FROM ID_EMBL_SWISSPROT WHERE PDB_name = ? AND alignment_num = ?;");

$sth2 =$dbh1->prepare("UPDATE ID_EMBL_SWISSPROT SET swissprot_AA_num =  ?".
        " where swissprot_serial_ID = ?;");

#$sth3=$dbh1->prepare("SELECT swissprot_AA_num FROM ID_EMBL_SWISSPROT WHERE PDB_name = ? AND alignment_num = ? AND PDB_AA_num = ? ;");


#Protein table
$sth0=$dbh1->prepare("SELECT swissprot_id, PDB_name, alignment_num, IFIR, ILAS, JFIR, JLAS FROM Alignments;");
$sth0->execute();



#selecting IFIR and JFIR number
while(@aryAlig = $sth0->fetchrow_array()){

        #select from ID_EMBL of the corresponding PDB_name and alignment_num
        $sth1->execute($aryAlig[1], $aryAlig[2]);

        #fetching each swissport series
        while(@arySwiss = $sth1->fetchrow_array()){

                my $syn_AA_num = $arySwiss[3];

                if (defined($arySwiss[0])){

                        print "AAnum:$arySwiss[0]\tIFIR:$aryAlig[3]\n";
                        #when PDB_AA_num equal to IFIR
                        if ($arySwiss[0] == $aryAlig[3]){
                                $start = 1;
                                $swissport_num = $aryAlig[5];
                        }

                }
                print "residue:$arySwiss[1]\n";
                if ($start && $arySwiss[1] ne "." && $arySwiss[1] ne "" && $arySwiss[1] ne " "){

                        $sth2->execute($swissport_num, $arySwiss[4]);
                        $swissport_num++;
                }


        }

}


$dbh1->disconnect()
        or warn "Disconnect failed: $DBI::errstr";
exit();

  1. how to write update statement for this
    Below are the table and records in the table. below query updates the AMOUNT and EXCHANGERATE where STATUS is PART_INVOICED and AMOUNT <> 0 and TRANS_AMOUNT = 0; along with updating these 2 columns i also want to update first detail sequence status with 'INVOICED'; if i put like this JC1.STATUS = 'INVOI…
  2. Oracle Update Statement
    I am trying to update one table with my parameters from two tables. The code below gets the error missing SET keyword. How do I re-write this so Oracle will accept it?
  3. Update statement
    I'm having general issues converting select statements into update statement in Oracle PL/SQL. With T-SQL it is far easier, but rearranging for PL/SQL I'm finding harder. Hopefully with the correct answer I can work out the general rules for converting. This is my current select statement which returns me the correct number of records I am ex…
  4. Update Statement for Oracle 10G
    i had a developer hard code the name of a server in to a feild on a database... And guess what ? the name of the server changed and i need the server names updated in all the rows of the database (oracle 10g) the data currently looks like this Identifyer Datapath name Short Name 1 \…
  5. Update Statement with two tables
    Trying to do an update based on to tables. The update runs forever. the first is the select statement that runs within 15ms. When I add the update the statement runs and runs but I would not think that it would run longer than 2 hours so I killed the execution. cust_ord_customer_tab has 1913 records cust_ord_customer_address_tab …

Solution

Sign up now to view this solution! It's quick, easy, and secure to subscribe. We will return you to this solution, unlocked, when you’re done.

About this Solution
View This Solution - Start Your 30 Day Free Trial
Zone
General
Tags
oracle update optimaize statement
Participating Experts
6
Solution Grade
A

Replies

 
by: ser6398

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 
by: Wadhwa

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 
by: FBIAGENT

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 
by: kuichan

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 
by: FBIAGENT

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 
by: Wadhwa

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 
by:

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 
by: ddandekar

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 
by: Wadhwa

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 
by: Moondancer

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 
by: jtrifts

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

 
by: Moondancer

All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.

Stay Connected

Oracle Around the Web

The latest Oracle news, tips, and tricks

Oracle Unveils Netra SPARC T3 Servers

New Carrier-Grade Blade and Rackmount Servers Deliver Better Performance, Density and Power Efficiency for the Communications Industry ...

read more

Oracle fixes 21 flaws in Java SE, Java for Business

Oracle is fixing 21 flaws in its Java SE and Java for Business products in its February critical patch update issued this week ...

read more

Obama’s Silicon Valley “Tech Supper”

Why was he there? Who wasn’t invited and why? What did they talk about? Why was he really there? These are the questions being debated ...

read more

Featured Oracle Experts

slightwv

slightwv has answered more than 2,000 Oracle questions and oversees database management within the U.S. Government. Slightwv

sdstuber

A regular presenter at the Collaborate conference, Oracle developer sdstuber is a top expert in PL/SQL and Oracle 9, 10 and 11. sdstuber

Testimonials

What users are saying about our experts

"The Oracle gurus provide answers, solutions and valuable workarounds"

User: schwertner

"Wow! Excellent, valuable explanation. Hats off to you"

User: aseshu70

"Solution worked fantastic and performs excellent! Thanks heaps"

User: klausbrandlhuber

Top Experts

  1. slightwv

    2,000

    0 points yesterday

    Profile

BrowseBecome an Expert