A
A
Alexey2015-10-19 11:29:56
Oracle
Alexey, 2015-10-19 11:29:56

There is a data upload problem. What are some ideas?

Hello, I have such a problem. There are two requests. The first unloads dates under certain conditions. The second query, for each date, makes us an analysis, i.e. uploads the data we need. The problem is that you have to manually insert each date from the first request into the second one. How can this be done automatically or semi-automatically?
You cannot combine these two queries, they take a very long time to download separately .... All this is done in Oracle ... No web

Answer the question

In order to leave comments, you need to log in

5 answer(s)
A
Alexander, 2015-10-19
@NeiroNx

I think it can be implemented through the cursor - the first request sends data to the cursor, the following requests are processed by iterations of the cursor.
datasql.ru/sqlandpol/14.htm

M
Max, 2015-10-19
@MaxDukov

save the result of the first one into a "temporary" table, unload from it already.
set the second request on this plate. "temporary" in quotes - because the classic TEMPORARY will die after the session is closed. Well, or do everything in 1 session.

I
igaraev, 2015-10-30
@igaraev

You have a contradiction in the task
"It is impossible to combine these two requests, they are unloaded separately for a very long time"
If separately for a long time, then together it should be fast.
Try hint /*+ materialize */

D
dk-web, 2015-10-19
@dk-web

I'm not sure I understood the problem correctly. What do you mean by manual. But offhand.. dates into an array... $ dates
Next
foreach $ dates as $ date
Select * from .. where date=$date
P.s. essentially wrote under mysql-php

V
Vyacheslav, 2015-10-19
@nskarl

You can pull out 2 arrays separately according to the necessary parameters and then combine them through php:
First we pull out the dates:
then we reshape the dates into a new array, because the dates pulled out can go out of order
and we put the dates for which we need data into a separate array:

foreach ($dates as $key => $date)
    {
      $data_to_show[$key] = $date;
      $dates_array[] = $date['date'];
    }

then we pull out only the data for the dates of which we need:
and then rebuild the first array
foreach ($analiz as $row)
    {
      $data_to_show[$row['analiz_key']][] = $row;
    }

--------------------
I don't know what keys you select there, but here is my example, where users and machines are combined, which these users have,
I hope I understood you correctly and pushed you in the right direction
$users = $this->user_model->get_users();
    foreach ($users as $user)
    {
      $users_to_show[$user['username']] = $user;
      $names[] = $user['username'];
    }
    
    $cars = $this->user_model->get_cars($names);
    foreach ($cars as $car)
    {
      $users_to_show[$car['owner']]['cars'][] = $car;
    }

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question