博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Quick Trick About Using Dbms_Metadata With Forms_DDL In Oracle Forms
阅读量:7224 次
发布时间:2019-06-29

本文共 1866 字,大约阅读时间需要 6 分钟。

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
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.

转载地址:http://tfkfm.baihongyu.com/

你可能感兴趣的文章
环境搭建,8种基本类型,Static,package和import,log4j
查看>>
即将到来的 Debian 10 Buster 发布版的新特点
查看>>
iOS 头部视图下拉变大
查看>>
Disruptor并发框架
查看>>
react-hooks 实现简单的评论list
查看>>
【多图警告】学会JavaScript测试你就是同行中最亮的仔(妹)
查看>>
19-04-25
查看>>
一个JAVA程序员成长之路分享
查看>>
30K iOS程序员的简述:如何快速进阶成为高级开发人员
查看>>
Go 夜读 - 每周四晚上 Go 源码阅读技术分享
查看>>
tranform知多少
查看>>
Android电量优化
查看>>
[爬虫手记] 我是如何在3分钟内开发完一个爬虫的
查看>>
【译】Css Grid VS Flexbox: 实践比较
查看>>
iOS 开发知识索引
查看>>
Linux iptables命令
查看>>
webpack的使用
查看>>
干货 | 基于Go SDK操作京东云对象存储OSS的入门指南
查看>>
D3.js入门
查看>>
一次和前端的相互甩锅的问题记录
查看>>