Home Database Mysql Tutorial 为含有分区及子分区的模型添加分区。

为含有分区及子分区的模型添加分区。

Jun 07, 2016 pm 02:57 PM
create content Partition Model Add to detailed

无详细内容 无 create or replace procedure p_test_gy(v_datacycle_id varchar2, --添加分区的上限值 v_entity_owner varchar2, v_entity_name varchar2, v_retcode out varchar2, v_retinfo out varchar2) is v_cnt1 number; --实体检测 v_cnt2 number; --

create or replace procedure p_test_gy(v_datacycle_id varchar2, --添加分区的上限值
                                      v_entity_owner varchar2,
                                      v_entity_name  varchar2,
                                      v_retcode      out varchar2,
                                      v_retinfo      out varchar2) is

  v_cnt1           number; --实体检测
  v_cnt2           number; --分区是否存在检测
  v_cnt3           number; --模板子分区是否存在检测
  v_part_type      varchar2(30); --分区类型
  v_subpart_type   varchar2(30); --子分区类型
  v_part_value_max varchar2(30); --分区最大值
  v_part_style     varchar2(30); --分区命名格式
  v_part_value     varchar2(30); --分区值变量
  v_sql            varchar2(4000); --动态执行SQL
  v_sub_template   varchar2(4000); --调整模板子分区 
  v_high_value  long; --子分区值变量
  v_subpart_value     varchar2(30); --子分区值变量

  /*v_pkg
  v_procname */
begin
  /*--插入日志部分
  p_insert_log(v_acct_month, v_pkg, v_procname, v_prov_id, sysdate, '');*/
  --检测输入参数是否有误
  select count(0)
    into v_cnt1
    from sys.dba_objects
   where owner = v_entity_owner
     and object_name = v_entity_name
     and object_type = 'TABLE';
  if v_cnt1 = 0 then
    v_retcode := 'FAIL';
    v_retinfo := '目标表信息输入有误';
  else
    --检测目标表有无分区
    select count(0)
      into v_cnt2
      from sys.dba_part_tables t
     where t.owner = v_entity_owner
       and t.table_name = v_entity_name;
    if v_cnt2 = 0 then
      v_retcode := 'SUCCESS';
      v_retinfo := '目标表无分区';
    else
      --检测分区是否已存在
      select regexp_replace(max(t.partition_name), '[^0-9]', ''),
             regexp_replace(max(t.partition_name), '[0-9]', '')
        into v_part_value_max, v_part_style
        from sys.dba_tab_partitions t
       where t.table_owner = v_entity_owner
         and t.table_name = v_entity_name;
      select partitioning_type, subpartitioning_type
        into v_part_type, v_subpart_type
        from sys.dba_part_tables t
       where t.owner = v_entity_owner
         and t.table_name = v_entity_name;
         --分区已存在&分区是LIST/HASH分区
      if v_part_value_max >= v_datacycle_id OR v_part_type <> 'RANGE' then
        v_retcode := 'SUCCESS';
        v_retinfo := '分区已存在';
      else
        select count(0)
          into v_cnt3
          from sys.dba_subpartition_templates
         where table_name = v_entity_name
           and user_name = v_entity_owner;
           --无子分区&有子分区且为模板子分区
        if v_part_type = 'RANGE' AND
           ((v_subpart_type = 'LIST' AND v_cnt3 <> 0) OR
           nvl(v_subpart_type, '**') = 'NONE') then
          v_part_value := to_char(add_months(to_date(v_part_value_max,
                                                     'yyyymm'),
                                             1),
                                  'yyyymm');
          while v_part_value <= v_datacycle_id loop
            v_sql := 'alter table ' || v_entity_owner || '.' ||
                     v_entity_name || ' add partition ' || v_part_style ||
                     v_part_value || ' 
  values less than (''' ||
                     to_char(add_months(to_date(v_part_value, 'yyyymm'), 1),
                             'yyyymm') || ''') tablespace ';
             --日志检索                
            /*dbms_output.put_line(v_sql);*/
            --需要分配分区(或者建表设置默认表空间)
            execute immediate v_sql;
            v_part_value := to_char(add_months(to_date(v_part_value,
                                                       'yyyymm'),
                                               1),
                                    'yyyymm');
          end loop;
          v_retcode := 'SUCCESS';
          v_retinfo := '成功';
        else
          /*--顺序不太好看
             select 
                 rtrim(wmsys.wm_concat(' subpartition ' || substr(subpartition_name,length(partition_name)+2) || ' values ( ''' ||
                regexp_replace(substr(subpartition_name, length(partition_name)+2),'[^0-9]','') || ''' ) '),',') into v_sub_template
           from sys.dba_tab_subpartitions
          where table_owner = v_entity_owner
            and partition_name = v_part_value_max
            and table_name = v_entity_name;*/
            --有子分区且非模板子分区
          v_sub_template := 'alter table ' || v_entity_owner || '.' ||
                            v_entity_name || '
set subpartition template(';
--''' ||regexp_replace(substr(subpartition_name,length(partition_name) + 2),'[^0-9]','') || '''
          for t in (select /*+parallel(sub,4)*/*
                      from sys.dba_tab_subpartitions sub
                     where table_owner = v_entity_owner
                       and partition_name = v_part_style || v_part_value_max
                       and table_name = v_entity_name
                     order by length(regexp_replace(subpartition_name, '[0-9]', '')),subpartition_name) loop
          v_high_value:=t.high_value;
          v_subpart_value:=substr(v_high_value,1,4000);
          /*if v_subpart_value= 'DEFAULT' then 
            v_subpart_value:='''DEFAULT''';
            end if;*/
            v_sub_template := v_sub_template ||' subpartition ' ||
                           substr(t.subpartition_name,
                                  length(t.partition_name) + 2) ||
                           ' values ( '||v_subpart_value||' ) ,' ;
          end loop;
          --日志检索
          dbms_output.put_line(rtrim(v_sub_template, ',') || ')');
          insert into dm_check_log
            select rtrim(v_sub_template, ',') || ')',
                   v_datacycle_id,
                   sysdate
              from dual;
          commit;
          execute immediate rtrim(v_sub_template, ',') || ')';
          v_part_value := to_char(add_months(to_date(v_part_value_max,
                                                     'yyyymm'),
                                             1),
                                  'yyyymm');
          while v_part_value <= v_datacycle_id loop
            v_sql := 'alter table ' || v_entity_owner || '.' ||
                     v_entity_name || ' add partition ' || v_part_style ||
                     v_part_value || ' 
  values less than (''' ||
                     to_char(add_months(to_date(v_part_value, 'yyyymm'), 1),
                             'yyyymm') || ''') tablespace ';
            /*dbms_output.put_line(v_sql);*/
          execute immediate v_sql;
            --需要分配分区(或者建表设置默认表空间)
            v_part_value := to_char(add_months(to_date(v_part_value,
                                                       'yyyymm'),
                                               1),
                                    'yyyymm');
          end loop;
          v_retcode := 'SUCCESS';
          v_retinfo := '成功';
        end if;
      end if;
    end if;
  end if;
end;
Copy after login
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

The world's most powerful open source MoE model is here, with Chinese capabilities comparable to GPT-4, and the price is only nearly one percent of GPT-4-Turbo The world's most powerful open source MoE model is here, with Chinese capabilities comparable to GPT-4, and the price is only nearly one percent of GPT-4-Turbo May 07, 2024 pm 04:13 PM

Imagine an artificial intelligence model that not only has the ability to surpass traditional computing, but also achieves more efficient performance at a lower cost. This is not science fiction, DeepSeek-V2[1], the world’s most powerful open source MoE model is here. DeepSeek-V2 is a powerful mixture of experts (MoE) language model with the characteristics of economical training and efficient inference. It consists of 236B parameters, 21B of which are used to activate each marker. Compared with DeepSeek67B, DeepSeek-V2 has stronger performance, while saving 42.5% of training costs, reducing KV cache by 93.3%, and increasing the maximum generation throughput to 5.76 times. DeepSeek is a company exploring general artificial intelligence

How to add a TV to Mijia How to add a TV to Mijia Mar 25, 2024 pm 05:00 PM

Many users are increasingly favoring the electronic ecosystem of Xiaomi smart home interconnection in modern life. After connecting to the Mijia APP, you can easily control the connected devices with your mobile phone. However, many users still don’t know how to add Mijia to their homes. app, then this tutorial guide will bring you the specific connection methods and steps, hoping to help everyone in need. 1. After downloading Mijia APP, create or log in to Xiaomi account. 2. Adding method: After the new device is powered on, bring the phone close to the device and turn on the Xiaomi TV. Under normal circumstances, a connection prompt will pop up. Select &quot;OK&quot; to enter the device connection process. If no prompt pops up, you can also add the device manually. The method is: after entering the smart home APP, click the 1st button on the lower left

Hello, electric Atlas! Boston Dynamics robot comes back to life, 180-degree weird moves scare Musk Hello, electric Atlas! Boston Dynamics robot comes back to life, 180-degree weird moves scare Musk Apr 18, 2024 pm 07:58 PM

Boston Dynamics Atlas officially enters the era of electric robots! Yesterday, the hydraulic Atlas just "tearfully" withdrew from the stage of history. Today, Boston Dynamics announced that the electric Atlas is on the job. It seems that in the field of commercial humanoid robots, Boston Dynamics is determined to compete with Tesla. After the new video was released, it had already been viewed by more than one million people in just ten hours. The old people leave and new roles appear. This is a historical necessity. There is no doubt that this year is the explosive year of humanoid robots. Netizens commented: The advancement of robots has made this year's opening ceremony look like a human, and the degree of freedom is far greater than that of humans. But is this really not a horror movie? At the beginning of the video, Atlas is lying calmly on the ground, seemingly on his back. What follows is jaw-dropping

KAN, which replaces MLP, has been extended to convolution by open source projects KAN, which replaces MLP, has been extended to convolution by open source projects Jun 01, 2024 pm 10:03 PM

Earlier this month, researchers from MIT and other institutions proposed a very promising alternative to MLP - KAN. KAN outperforms MLP in terms of accuracy and interpretability. And it can outperform MLP running with a larger number of parameters with a very small number of parameters. For example, the authors stated that they used KAN to reproduce DeepMind's results with a smaller network and a higher degree of automation. Specifically, DeepMind's MLP has about 300,000 parameters, while KAN only has about 200 parameters. KAN has a strong mathematical foundation like MLP. MLP is based on the universal approximation theorem, while KAN is based on the Kolmogorov-Arnold representation theorem. As shown in the figure below, KAN has

AI subverts mathematical research! Fields Medal winner and Chinese-American mathematician led 11 top-ranked papers | Liked by Terence Tao AI subverts mathematical research! Fields Medal winner and Chinese-American mathematician led 11 top-ranked papers | Liked by Terence Tao Apr 09, 2024 am 11:52 AM

AI is indeed changing mathematics. Recently, Tao Zhexuan, who has been paying close attention to this issue, forwarded the latest issue of "Bulletin of the American Mathematical Society" (Bulletin of the American Mathematical Society). Focusing on the topic "Will machines change mathematics?", many mathematicians expressed their opinions. The whole process was full of sparks, hardcore and exciting. The author has a strong lineup, including Fields Medal winner Akshay Venkatesh, Chinese mathematician Zheng Lejun, NYU computer scientist Ernest Davis and many other well-known scholars in the industry. The world of AI has changed dramatically. You know, many of these articles were submitted a year ago.

Google is ecstatic: JAX performance surpasses Pytorch and TensorFlow! It may become the fastest choice for GPU inference training Google is ecstatic: JAX performance surpasses Pytorch and TensorFlow! It may become the fastest choice for GPU inference training Apr 01, 2024 pm 07:46 PM

The performance of JAX, promoted by Google, has surpassed that of Pytorch and TensorFlow in recent benchmark tests, ranking first in 7 indicators. And the test was not done on the TPU with the best JAX performance. Although among developers, Pytorch is still more popular than Tensorflow. But in the future, perhaps more large models will be trained and run based on the JAX platform. Models Recently, the Keras team benchmarked three backends (TensorFlow, JAX, PyTorch) with the native PyTorch implementation and Keras2 with TensorFlow. First, they select a set of mainstream

Tesla robots work in factories, Musk: The degree of freedom of hands will reach 22 this year! Tesla robots work in factories, Musk: The degree of freedom of hands will reach 22 this year! May 06, 2024 pm 04:13 PM

The latest video of Tesla's robot Optimus is released, and it can already work in the factory. At normal speed, it sorts batteries (Tesla's 4680 batteries) like this: The official also released what it looks like at 20x speed - on a small "workstation", picking and picking and picking: This time it is released One of the highlights of the video is that Optimus completes this work in the factory, completely autonomously, without human intervention throughout the process. And from the perspective of Optimus, it can also pick up and place the crooked battery, focusing on automatic error correction: Regarding Optimus's hand, NVIDIA scientist Jim Fan gave a high evaluation: Optimus's hand is the world's five-fingered robot. One of the most dexterous. Its hands are not only tactile

FisheyeDetNet: the first target detection algorithm based on fisheye camera FisheyeDetNet: the first target detection algorithm based on fisheye camera Apr 26, 2024 am 11:37 AM

Target detection is a relatively mature problem in autonomous driving systems, among which pedestrian detection is one of the earliest algorithms to be deployed. Very comprehensive research has been carried out in most papers. However, distance perception using fisheye cameras for surround view is relatively less studied. Due to large radial distortion, standard bounding box representation is difficult to implement in fisheye cameras. To alleviate the above description, we explore extended bounding box, ellipse, and general polygon designs into polar/angular representations and define an instance segmentation mIOU metric to analyze these representations. The proposed model fisheyeDetNet with polygonal shape outperforms other models and simultaneously achieves 49.5% mAP on the Valeo fisheye camera dataset for autonomous driving

See all articles