Solved

Changes in the range of dates for execution of store procedure

Posted on 2013-06-27
5
398 Views
Last Modified: 2013-07-03
Hi experts,
I need to change the date range that handles the execution of the store procedure.

His execution takes values from a table and then inserts or updates made on another board.

When I run, passing him an IN parameter (p_in_time DATE):
update_1dia_proc exec (TO_DATE ('30 / 05/2013 3:00:00 ',' DD / MM / YYYY HH24: MI: SS '));

Open in new window

takes data from:
a_hora_test

Open in new window

and the inserted or updated in:
a_1dia_test

Open in new window

The result is:
Processing -> 30/05/2013 00:00:00
A_HORA_TEST -> A_1DIA_TEST
Updating utchora = 30/05/2013 00:00:00, pointnumber = 330000
Updating utchora = 30/05/2013 00:00:00, pointnumber = 330001

Open in new window

But I need that the insert or update be conducted on:
Processing -> 30/05/2013 03:00:00
A_HORA_TEST -> A_1DIA_TEST
Updating utchora = 30/05/2013 03:00:00, pointnumber = 330000
Updating utchora = 30/05/2013 03:00:00, pointnumber = 330001

Open in new window

I can not find this variant and so I come to your experience.

Attachment tables, inserts and procedure.

Thankyou in advanced!
update-1dia-proc.sql
script-table-inserts-hora.sql
script-table-inserts-1dia.sql
0
Comment
Question by:carlino70
  • 3
  • 2
5 Comments
 
LVL 76

Expert Comment

by:slightwv (䄆 Netminder)
Comment Utility
Check out this line:
v_in_time := TRUNC (p_in_time, 'DD');

This strips off the time portion of the date.
0
 

Author Comment

by:carlino70
Comment Utility
slightwv, i changed that line, for example:
v_in_time := p_in_time;

Open in new window

And nothing made over the tables:
Processing -> 30/05/2013 03:00:00
A_HORA_TEST -> A_1DIA_TEST

Open in new window

never gets update lines or inserts.
0
 
LVL 76

Accepted Solution

by:
slightwv (䄆 Netminder) earned 500 total points
Comment Utility
OK, look further down in the code.  You will need to adjust the following:
WHERE TRUNC ( utctime, ''DD'')+1 = :1)

Likely changing it from an '=' to a '>=' and '<'.

I cannot say for sure because I don't understand your exact requirements.
0
 

Author Comment

by:carlino70
Comment Utility
Look here:

The table a_hora_test contains data inserted by hour.

The procedure take all data ( he takes max, min, average and date of each one ) of a_hora_test table, and then are inserted or updated the  a_1dia_test table.

That insert or update must be done over the mark of '03:00:00' at the next day.

Ej: In this case the table a_hora_test, have data of
'29/05/2013 10:00:00' and  '29/05/2013 11:00:00' 

Open in new window

Then that insert or update, must be done in a_1dia_test:
'30/05/2013 03:00:00'

Open in new window

But is done in:
'30/05/2013 00:00:00'

Open in new window

wrong way!

Please, tell me if you dont understand yet.

Thank you.
0
 

Author Comment

by:carlino70
Comment Utility
I've requested that this question be closed as follows:

Accepted answer: 0 points for carlino70's comment #a39281384

for the following reason:

Thanks!
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Working with Network Access Control Lists in Oracle 11g (part 1) Part 2: http://www.e-e.com/A_9074.html So, you upgraded to a shiny new 11g database and all of a sudden every program that used UTL_MAIL, UTL_SMTP, UTL_TCP, UTL_HTTP or any oth…
Truncate is a DDL Command where as Delete is a DML Command. Both will delete data from table, but what is the difference between these below statements truncate table <table_name> ?? delete from <table_name> ?? The first command cannot be …
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
This video shows setup options and the basic steps and syntax for duplicating (cloning) a database from one instance to another. Examples are given for duplicating to the same machine and to different machines

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now