zoukankan      html  css  js  c++  java
  • ddl in PL/SQL

    If you write DDL directly in PL/SQL. You will hit error.

      1  DECLARE
      2     str_sql varchar2(500);
      3  begin
      4     create table test (id number);
      5  end;
      6  /
            create table test (id number);
            *
    ERROR at line 4:
    ORA-06550: line 4, column 2:
    PLS-00103: Encountered the symbol "CREATE" when expecting one of the following:
    begin case declare exit for goto if loop mod null pragma
    raise return select update while with <an identifier>
    <a double-quoted delimited-identifier> <a bind variable> <<
    close current delete fetch lock insert open rollback
    savepoint set sql execute commit forall merge pipe
    

      

    But you can use dynamic run as below.

      1  DECLARE
      2    str_sql varchar2(500);
      3  begin
      4    str_sql := 'create table test (id number)';
      5    execute immediate str_sql;
      6  end
      7      ;
      8   /
    
    PL/SQL procedure successfully completed.
    

      

  • 相关阅读:
    eclipsesvn
    js邮箱和正则表达式
    jsreplace
    JQuery与Json转换
    thinkPHP时间戳格式化
    JS绝对定位到右下角
    chrome快捷键
    js配置示例
    JQuery class选择器
    JS调试技巧
  • 原文地址:https://www.cnblogs.com/kramer/p/3656179.html
Copyright © 2011-2022 走看看