Home » SQL & PL/SQL » SQL & PL/SQL » Help
Help [message #234015] Sun, 29 April 2007 01:22 Go to next message
thandavakarumuri
Messages: 64
Registered: May 2005
Member
I was given a procedure to change the logic. The procedure should be able to insert fresh data come in and should be able to copy the runout(received from last 3 months) data data from history table to other table. I am using the below query. I would appreciate if you could please help me in this.

INSERT INTO PM2006.PM_DISEASE_ID PARTITION (DI_PG_7)
(process_group_id,
member_id,
yyyymm,
Col1,
col2,
col3,
load_date)
SELECT gv_process_group_id,
member_id,
id_yyyymm,
Col1,
col2,
col3,
SYSDATE
FROM history_table_name id
WHERE p_id = gv_id
AND yyyymm = v_process_yrmo
AND NOT EXISTS (SELECT 'y'
FROM new_table_name pm
WHERE pm.process_group_id = gv_process_group_id
AND pm.m_id = id.m_id
AND pm.yyyymm = id.id_yyyymm);
AND pm.yyyymm = TO_CHAR(ADD_MONTHS(gv_recd_date, -3), 'YYYYMM'));


[Updated on: Sun, 29 April 2007 01:23]

Report message to a moderator

Re: Help [message #234070 is a reply to message #234015] Sun, 29 April 2007 06:27 Go to previous message
Michel Cadot
Messages: 64110
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Read How to format your posts and edit your post accordingly.
Your query in unreadable.

In addition post a DESC of your tables, and maybe saying what is your problem may help.

Regards
Michel
Previous Topic: help
Next Topic: ROWNUM in 10G
Goto Forum:
  


Current Time: Mon Dec 05 11:04:20 CST 2016

Total time taken to generate the page: 0.07883 seconds