回覆列表
  • 1 # 使用者8451710051916

    建立序列:

    create sequence t_id

    increment by 1

    start with 1

    nomaxvalue

    cache 20;

    建立自動建表過程:

    create or replace procedure pro_createtable(tname in varchar2 default to_char(sysdate,"yyyymm"))

    as

    v_sql varchar2(200);

    v_tname varchar2(10);

    begin

    if length(tname)6 then

    raise_application_error(-20000,"輸入引數長度不夠,不能轉換為日期格式!");

    end if ;

    if to_number(substr(tname,5,2)) not between 1 and 12 then

    raise_application_error(-20001,"輸入引數中不包含有效的月份數字,不能轉換為日期格式!");

    end if ;

    --v_tname:=to_char(to_date(tname,"yyyymm"),"yyyymm");

    v_tname:="hd_"||tname;

    v_sql:="create table "||v_tname||" ("||

    "id number not null,"||

    "name varchar2(20),"||

    "city varchar2(20))"||

    "tablespace users";

    execute immediate v_sql;

    end;

    測試:

    begin

    pro_createtable;

    pro_createtable("201106");

    pro_createtable("201115");--報錯

    end;

  • 中秋節和大豐收的關聯?
  • 為什麼C羅獲得的歐冠次數超過梅西,但有些人還是認為C羅不如梅西?