• Quick Trick About Using Dbms_Metadata With Forms_DDL In Oracle Forms


    Example is given below to fetch any Oracle objects DDL script using DBMS_Metadata.Get_DDL command in Oracle Forms using Forms_DDL command.
     
    You can download this form for free including source code with following link from Google Drive Dbms_Utility.fmb

    You may need to create a table in current schema/user by which you are logging with and below is the script for this:

    Create Table DDL_Script (ddl varchar2(1000));


    I will add further more tabs related to Dbms utility tasks to this form and will share also.
     
     
    Following is the code written in Show DDL push button:
    DECLARE
       v        VARCHAR2 (4000);
       objtpe   VARCHAR2 (100);
    BEGIN
       --    v := dbms_metadata.get_ddl('TABLE', :objname, user);
       SELECT object_type
         INTO objtpe
         FROM user_objects
        WHERE object_name = :objname;
     
       :objtype := objtpe;
     
       FORMS_DDL ('drop table ddl_script');
       FORMS_DDL(   'create table ddl_script as select dbms_metadata.get_ddl('
                 || CHR (39)
                 || objtpe
                 || CHR (39)
                 || ','
                 || CHR (39)
                 || :objname
                 || CHR (39)
                 || ', user) ddl from dual');
     
       IF FORM_SUCCESS
       THEN
          SELECT ddl
            INTO :ddltxt
            FROM ddl_script
           WHERE ROWNUM = 1;
       ELSE
          :statbar := 'Message: Object does not exists.';
          FORMS_DDL ('create table ddl_script (ddl varchar2(1000))');
       END IF;
    END;
     
    Following is the code written in When-new-form-instance trigger:
     
    set_window_property(forms_mdi_window, window_state, maximize);
     
    DECLARE
       rg_list_id   RECORDGROUP;
       rg_name      VARCHAR2 (20) := 'OBJECTTYPES';
       ret_code     NUMBER;
       --The following holds a SELECT query from which the list elements are derived.
       v_select     VARCHAR2 (300);
    BEGIN
       BEGIN
          FORMS_DDL ('drop table ddl_script');
       EXCEPTION
          WHEN OTHERS
          THEN
             NULL;
       END;
     
       BEGIN
          FORMS_DDL ('create table ddl_script (ddl varchar2(1000))');
       EXCEPTION
          WHEN OTHERS
          THEN
             NULL;
       END;
     
       ret_code := POPULATE_GROUP ('OBJECTNAMES');
       POPULATE_LIST ('OBJNAME', 'OBJECTNAMES');
    END;
     
    You can find the record group details itself in form which I am sharing with this post.
  • 相关阅读:
    用 .Net WebBrowser 控件获取POST数据
    yield再理解--绝对够透彻
    Keras 和 PyTorch 的对比选择
    Keras -Python编写的开源人工神经网络库
    Python 加密之 生成pyd文件
    FPN全解-特征金字塔网络
    RetinaNet(Focal Loss)
    Focal Loss for Dense Object Detection(Retina Net)
    ImageNet Classification-darknet
    Darknet
  • 原文地址:https://www.cnblogs.com/quanweiru/p/6220238.html
Copyright © 2020-2023  润新知