?
Solved

Changes in the range of dates for execution of store procedure

Posted on 2013-06-27
5
Medium Priority
?
406 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 77

Expert Comment

by:slightwv (䄆 Netminder)
ID: 39281169
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
ID: 39281259
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 77

Accepted Solution

by:
slightwv (䄆 Netminder) earned 2000 total points
ID: 39281280
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
ID: 39281384
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
ID: 39296288
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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I remember the day when someone asked me to create a user for an application developement. The user should be able to create views and materialized views and, so, I used the following syntax: (CODE) This way, I guessed, I would ensure that use…
When it comes to protecting Oracle Database servers and systems, there are a ton of myths out there. Here are the most common.
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
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Suggested Courses

765 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