|
|
Re: How to get back purged data into the tables [message #606857 is a reply to message #606842] |
Thu, 30 January 2014 02:21 |
|
Littlefoot
Messages: 21807 Registered: June 2005 Location: Croatia, Europe
|
Senior Member Account Moderator |
|
|
How is your last question related to the original problem?
Write an UPDATE statement, such as
update temp_table t set
t.creation_date = (select h.update_date
from header_table h
where h.id_column = t.id_column
)
where exists (select null
from header_table h1
where h1.id_column = t.id_column
)
[Updated on: Thu, 30 January 2014 02:21] Report message to a moderator
|
|
|
|
|
|
Re: How to get back purged data into the tables [message #606884 is a reply to message #606878] |
Thu, 30 January 2014 07:46 |
|
mist598
Messages: 1195 Registered: February 2013 Location: Hyderabad
|
Senior Member |
|
|
Hi Littlefoot,
I ran the below query i got 16,22,000 records.
SELECT a.creation_date hdr_c_date,
b.creation_date worktab_c_date,
a.original_system_reference hdr_ori_sys_ref,
-- b.original_system_reference worktab_ori_sys_ref,
a.tprt_number hdr_tpt_num,
b.tprt_number worktab_tpt_num
FROM regal.regal_om_edi850_header_tab a,
regal.regal_om_edi850_worktab_temp b
WHERE a.original_system_reference = b.original_system_reference
AND a.tprt_number = b.tprt_number
I wrote same query using cursor for loop but i got only 1400, why not shows 16,22,000 records,
DECLARE
CURSOR c1 IS
SELECT a.creation_date hdr_c_date,
b.creation_date worktab_c_date,
a.original_system_reference hdr_ori_sys_ref,
-- b.original_system_reference worktab_ori_sys_ref,
a.tprt_number hdr_tpt_num,
b.tprt_number worktab_tpt_num
FROM regal.regal_om_edi850_header_tab a,
regal.regal_om_edi850_worktab_temp b
WHERE a.original_system_reference = b.original_system_reference
AND a.tprt_number = b.tprt_number;
--AND a.original_system_reference LIKE 'JCP01-100009670-03440269-94656'
BEGIN
FOR crec IN c1 LOOP
dbms_output.Put_line('TPRT Number: ' ||crec.hdr_tpt_num ||' ' ||
'original system reference : ' ||crec.hdr_ori_sys_ref ||' ' ||
'Header Creation date : ' ||crec.hdr_c_date ||' ' ||' '||
'Worktab creation date : ' ||crec.worktab_c_date);
/*UPDATE regal.regal_om_edi850_worktab_temp
SET creation_date=CREC.hdr_c_date
WHERE original_system_reference = CREC.original_system_reference
and a.tprt_number = b.tprt_number;
*/
END LOOP;
END;
Please help me.
|
|
|
|
Re: How to get back purged data into the tables [message #606891 is a reply to message #606884] |
Thu, 30 January 2014 08:41 |
Lalit Kumar B
Messages: 3174 Registered: May 2013 Location: World Wide on the Web
|
Senior Member |
|
|
mist598 wrote on Thu, 30 January 2014 19:16I ran the below query i got 16,22,000 records.
I wrote same query using cursor for loop but i got only 1400, why not shows 16,22,000 records,
The query is same in both SQL and PL/SQL code, however, the dbms_output which you have used to determine the number of rows makes the output different.
If you want to know the count of records looped, take a variable, increment it by 1 in the loop and display it through dbms_output.
|
|
|
|
|
|
Re: How to store the table data(Backup) [message #606900 is a reply to message #606897] |
Thu, 30 January 2014 09:15 |
pablolee
Messages: 2882 Registered: May 2007 Location: Scotland
|
Senior Member |
|
|
No offense here mist, but you seem woefully out of your depth. The posts that you have recently been posting show that you are being asked to perform work that you currently do not have the skillset to approach. The main issue around this is that you could very well be given code that seems to do what you need, but further down the line will turn out to be wholly inappropriate and potentially damaging (depending upon how you implement). Can I respectfully suggest that you raise, as an issue, with your line manager that you simply don't have the skillset at the moment to be able to handle the work that you are being given which is likely to result in a disaster for your company/ customer and that you really need to be either sent on a training course, or at least given some time to get up to speed with the basics of SQL and PL/SQL.
|
|
|
|
|
|