Question

Asked on 2001-08-29 at 12:47:16ID: 25481514

UPDATE statement

by: kuichan100

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. 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…
  2. 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…
  3. SQL QUERY - CASE STATEMENT
    NOT SURE WHY CASE STATEMENT IS NOT WORKING...WHAT AM I MISSING? and case when :PATIENT_TYPE = 'DP' then 'and PLOC.transfer_reason in (40, 41, 42)' when :PATIENT_TYPE = 'NDP' then ' and PLOC.transfer_reason not in (40,41,42) ' when :PATIENT_TY…
  4. Update Statement
    Hi, I never got the update working.. always just went to a PL/SQL loop.. why does the give "ORA-00933: SQL command not properly ended" ? UPDATE A set A.auditor_id = p.pid, A.auditor = p.first_name||' '||p.last_name from AUDIT_USE A, PERSON p, tmp_bill0819 t w…
  5. ORA-00900: invalid SQL statement
    I want to call the procedure below from my .net page but when I try to execute it in toad, I get the following error "ORA-00900: invalid SQL statement" What am I doing wrong? Thanks!

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

Posted on 2001-08-29 at 13:07:15ID: 28365552

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

Posted on 2001-08-29 at 14:35:29ID: 28365553

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

Posted on 2001-08-29 at 15:46:12ID: 28365554

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

Posted on 2001-08-29 at 16:31:07ID: 28365555

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

Posted on 2001-08-29 at 16:48:06ID: 28365556

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

Posted on 2001-08-29 at 18:42:24ID: 28365557

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:

Posted on 2001-08-30 at 01:07:28ID: 28365558

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

Posted on 2001-08-30 at 04:07:43ID: 28365559

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

Posted on 2001-09-06 at 12:27:33ID: 28365560

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

Posted on 2002-05-25 at 14:54:28ID: 28365561

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

Posted on 2002-05-27 at 01:07:00ID: 28365562

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

Posted on 2002-06-05 at 14:32:05ID: 28365563

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