Hi,
I have been given a critical task of updating 45000 records on sensitive oracle database and although it is a simple update, I am not to familiar with writing update scripts in perl. I normally just do selects and then do data analysis
I am looking for a full script example using DBI that will update the records and keep a log of everything that gets updated.
My update statement is the following:
update
(
select t1.field1, 999 deact_status
from
schema.table1 t1
inner join schema.table2 t2 on t1.id = t2.id
where
t2.field2 = $emp_id
)
set
field1 = deact_status
And the 45000 emp_ids exist in a flat file in the following format which is an emp_id per line.
0909099
3298729
2849872
2472972
...
...
...
I am sure its as easy as just loooping through the file one emp_id at a time and then plugging the emp_id into the update statement and running it, however I want to learn how to do this the right way at the beginning from the pros.
After all this is over, all that will really have mattered is how we treated each other.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.