当前位置: 代码迷 >> Oracle面试 >> oracle 中表名的连接解决方法
  详细解决方案

oracle 中表名的连接解决方法

热度:3615   发布时间:2013-02-26 00:00:00.0
oracle 中表名的连接
有个问题。ORACLE中,有一个表imei_imeicount_201101。我想将其拆分为“imei_imeicount_”和“201101”两个字符串组成一张表。怎么弄呀?
------解决方案--------------------------------------------------------

declare
    str_tabprefix         varchar2(30);
    str_tabsuffix         varchar2(30);
    str_tabname           varchar2(30);
    int_exists            number;
begin
    str_tabprefix := 'imei_imeicount_';
    str_tabsuffix := to_char(sysdate, 'yyyymm');
    str_tabname := str_tabprefix 
------解决方案--------------------------------------------------------
 str_tabsuffix;
    
    select count(*) into int_exists from tabs where table_name = upper(str_tabname);
    if (int_exists = 0) then
        execute immediate 'create table ' 
------解决方案--------------------------------------------------------
 str_tabname 
------解决方案--------------------------------------------------------
 '(text  varchar2(200))';
    end if;
end;



  相关解决方案