Home > Database > Mysql Tutorial > body text

Oracle 定位10亿条数据

WBOY
Release: 2016-06-07 17:06:10
Original
1143 people have browsed it

Oracle 定位10亿条数据: /**app 通过ID查询此ID所在的表及分区,1张表100个表分区的定位存储过程*parm id ID*return table_name 表

Oracle 定位10亿条数据:

/*
*app 通过ID查询此ID所在的表及分区,1张表100个表分区的定位存储过程
*parm id ID
*return table_name 表名,par_name 分区名
*/
create or replace procedure Locate(id in varchar2, table_name out varchar2, par_name out varchar2) authid current_user is
MAXSTR varchar2(12) := '000999999999';
begin
  if id > MAXSTR or LENGTH(id) 12 then
    dbms_output.put_line('id不合法!');
  else
    --定位id号所在的表
    table_name := 'TF_00'||SUBSTR(id,3,1);
    --定位id号所在的分区
    par_name := 'P_0'||SUBSTR(id,4,2);
  end if;
end ;
/

set serveroutput on
declare
table_name varchar2(10);
par_name varchar2(10);
begin
  Locate('000999034567',table_name,par_name);
  dbms_output.put_line('所在表:'||table_name);
  dbms_output.put_line('所在分区:'||par_name);
end;
/

linux

Related labels:
source:php.cn
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template