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
Solved

Changes in the range of dates for execution of store procedure

Posted on 2013-06-27
5
403 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)
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 76

Accepted Solution

by:
slightwv (䄆 Netminder) earned 500 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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Suggested Solutions

Have you ever had to make fundamental changes to a table in Oracle, but haven't been able to get any downtime?  I'm talking things like: * Dropping columns * Shrinking allocated space * Removing chained blocks and restoring the PCTFREE * Re-or…
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 explains at a high level about the four available data types in Oracle and how dates can be manipulated by the user to get data into and out of the database.
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

856 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