iis服务器助手广告广告
返回顶部
首页 > 资讯 > 数据库 >怎么理解edb中的package
  • 830
分享到

怎么理解edb中的package

2024-04-02 19:04:59 830人浏览 薄情痞子
摘要

本篇内容介绍了“怎么理解edb中的package”的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有所成!创建pack

本篇内容介绍了“怎么理解edb中的package”的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有所成!

创建package
兼容oracle语法

create or replace package pk_demo
as
  var_pk_demo_1 number;
  function func_demo() return number;
  procedure proc_demo();
end pk_demo;
create or replace package body pk_demo 
as
  function func_demo() return number
  AS
    BEGIN
      var_pk_demo_1 := 100;
      return var_pk_demo_1;
    END;
  procedure proc_demo() 
  AS
    ret number;
    BEGIN
      select func_demo() into ret;
      var_pk_demo_1 := 200;
      dbms_output.put_line('var_pk_demo_1 := '||var_pk_demo_1||',ret = '||ret);
    END;
END pk_demo;

元数据
1.存储组织结构
pg_namespace

postgres=# \d pg_namespace
                Table "pg_catalog.pg_namespace"
      Column      |   Type    | Collation | Nullable | Default 
------------------+-----------+-----------+----------+---------
 nspname          | name      |           | not null | 
 nspowner         | oid       |           | not null | 
 nspparent        | oid       |           | not null | 
 nspobjecttype    | oid       |           | not null | 
 nspforeignserver | oid       |           | not null | 
 nspsecdef        | boolean   |           | not null | 
 nspremoteschema  | text      |           |          | 
 nspheadsrc       | text      |           |          | 
 nspbodysrc       | text      |           |          | 
 nspacl           | aclitem[] |           |          | 
Indexes:
    "pg_namespace_nspname_index" UNIQUE, btree (nspname, nspparent)
    "pg_namespace_oid_index" UNIQUE, btree (oid)
postgres=# select * from pg_namespace where nspname='pk_demo';
 nspname | nspowner | nspparent | nspobjecttype | nspforeignserver | nspsecdef | nspremoteschema |     nspheadsrc      |     nspbodysrc      | nspacl 
---------+----------+-----------+---------------+------------------+-----------+-----------------+---------------------+---------------------+--------
 pk_demo |       10 |      2200 |             0 |                0 | t         |                 |                    +|                    +| 
         |          |           |               |                  |           |                 |   @VARIABLE 16462@;+|   @FUNCTION 16463@;+| 
         |          |           |               |                  |           |                 |   @FUNCTION 16463@;+|                    +| 
         |          |           |               |                  |           |                 |   @FUNCTION 16464@;+|   @FUNCTION 16464@;+| 
         |          |           |               |                  |           |                 |                     |                     | 
(1 row)
postgres=# select * from pg_user where usesysid=10;
   usename    | usesysid | usecreatedb | usesuper | userepl | usebypassrls |  passwd  | valuntil | useaccountstatus | uselockdate | usepassWordexpire | useconfig 
--------------+----------+-------------+----------+---------+--------------+----------+----------+------------------+-------------+-------------------+-----------
 enterprisedb |       10 | t           | t        | t       | t            | ******** |          |                0 |             |                   | 
(1 row)
postgres=# select * from pg_namespace where oid=2200;
 nspname | nspowner | nspparent | nspobjecttype | nspforeignserver | nspsecdef | nspremoteschema | nspheadsrc | nspbodysrc |                     nspacl                      
---------+----------+-----------+---------------+------------------+-----------+-----------------+------------+------------+-------------------------------------------------
 public  |       10 |         0 |             0 |                0 | f         |                 |            |            | {enterprisedb=UC/enterprisedb,=UC/enterprisedb}
(1 row)

2.变量
edb_variable

postgres=# \d edb_var*
               Table "pg_catalog.edb_variable"
      Column      |  Type   | Collation | Nullable | Default 
------------------+---------+-----------+----------+---------
 varname          | name    |           | not null | 
 varpackage       | oid     |           | not null | 
 vartype          | oid     |           | not null | 
 vartypmod        | integer |           | not null | 
 varaccess        | "char"  |           | not null | 
 varisconst       | boolean |           | not null | 
 varseq           | integer |           | not null | 
 varerrcode       | integer |           | not null | 
 varsrc           | text    |           |          | 
 varexceptionname | text    |           |          | 
Indexes:
    "pg_variable_oid_index" UNIQUE, btree (oid)
    "pg_variable_varname_pkg_index" UNIQUE, btree (varpackage, varname)
postgres=# select * from edb_variable where oid=16462;
    varname    | varpackage | vartype | vartypmod | varaccess | varisconst | varseq | varerrcode | varsrc | varexceptionname 
---------------+------------+---------+-----------+-----------+------------+--------+------------+--------+------------------
 var_pk_demo_1 |      16454 |    1700 |        -1 | +         | f          |      1 |          0 |        | 
(1 row)

3.函数/过程
pg_proc

postgres=# \d pg_proc
                     Table "pg_catalog.pg_proc"
       Column        |     Type     | Collation | Nullable | Default 
---------------------+--------------+-----------+----------+---------
 proname             | name         |           | not null | 
 pronamespace        | oid          |           | not null | 
 proowner            | oid          |           | not null | 
 prolang             | oid          |           | not null | 
 procost             | real         |           | not null | 
 prorows             | real         |           | not null | 
 provariadic         | oid          |           | not null | 
 protransfORM        | regproc      |           | not null | 
 proisagg            | boolean      |           | not null | 
 proiswindow         | boolean      |           | not null | 
 prosecdef           | boolean      |           | not null | 
 proleakproof        | boolean      |           | not null | 
 proisstrict         | boolean      |           | not null | 
 proretset           | boolean      |           | not null | 
 proisweak           | boolean      |           | not null | 
 provolatile         | "char"       |           | not null | 
 proparallel         | "char"       |           | not null | 
 protype             | "char"       |           | not null | 
 proaccess           | "char"       |           | not null | 
 pronargs            | smallint     |           | not null | 
 pronargdefaults     | smallint     |           | not null | 
 prolineno           | integer      |           | not null | 
 prorettype          | oid          |           | not null | 
 proargtypes         | oidvector    |           | not null | 
 promemberattrs      | text         |           |          | 
 proallargtypes      | oid[]        |           |          | 
 proargmodes         | "char"[]     |           |          | 
 proargdeclaredmodes | "char"[]     |           |          | 
 proargnames         | text[]       |           |          | 
 proargdefaults      | pg_node_tree |           |          | 
 protrftypes         | oid[]        |           |          | 
 prosrc              | text         |           | not null | 
 probin              | text         |           |          | 
 proconfig           | text[]       |           |          | 
 proacl              | aclitem[]    |           |          | 
Indexes:
    "pg_proc_oid_index" UNIQUE, btree (oid)
    "pg_proc_proname_args_nsp_index" UNIQUE, btree (proname, protype, proargtypes, pronamespace)
postgres=# select proname,pronamespace from pg_proc where oid=16463;
  proname  | pronamespace 
-----------+--------------
 func_demo |        16454
(1 row)
postgres=# select proname,pronamespace from pg_proc where oid=16464;
  proname  | pronamespace 
-----------+--------------
 proc_demo |        16454
(1 row)
postgres=#

4.相关视图:edb_pkgelements、edb_package

postgres=# \d edb_pkg*
                View "pg_catalog.edb_pkgelements"
   Column    |       Type        | Collation | Nullable | Default 
-------------+-------------------+-----------+----------+---------
 packageoid  | oid               |           |          | 
 eltname     | name              |           |          | 
 visibilty   | "char"            |           |          | 
 eltclass    | character varying |           |          | 
 eltdatatype | oid               |           |          | 
 nargs       | smallint          |           |          | 
 argtypes    | oidvector         |           |          | 
 argmodes    | "char"[]          |           |          | 
 argnames    | text[]            |           |          | 
 argdefvals  | pg_node_tree      |           |          | 
postgres=# select * from edb_pkgelements where packageoid = 16454;
 packageoid |    eltname    | visibilty | eltclass | eltdatatype | nargs | argtypes | argmodes | argnames | argdefvals 
------------+---------------+-----------+----------+-------------+-------+----------+----------+----------+------------
      16454 | proc_demo     | +         | P        |        2278 |     0 |          |          |          | 
      16454 | var_pk_demo_1 | +         | V        |        1700 |       |          |          |          | 
      16454 | func_demo     | +         | F        |        1700 |     0 |          |          |          | 
(3 rows)
postgres=# 
postgres=# select * from pg_views where viewname='edb_pkgelements';
 schemaname |    viewname     |  viewowner   |                         definition                         
------------+-----------------+--------------+------------------------------------------------------------
 pg_catalog | edb_pkgelements | enterprisedb |  SELECT edb_variable.varpackage AS packageoid,            +
            |                 |              |     edb_variable.varname AS eltname,                      +
            |                 |              |     edb_variable.varaccess AS visibilty,                  +
            |                 |              |     'V'::character varying AS eltclass,                   +
            |                 |              |     edb_variable.vartype AS eltdatatype,                  +
            |                 |              |     NULL::smallint AS nargs,                              +
            |                 |              |     NULL::oidvector AS argtypes,                          +
            |                 |              |     NULL::"char"[] AS argmodes,                           +
            |                 |              |     NULL::text[] AS argnames,                             +
            |                 |              |     NULL::pg_node_tree AS argdefvals                      +
            |                 |              |    FROM edb_variable                                      +
            |                 |              | UNION                                                     +
            |                 |              |  SELECT pg_proc.pronamespace AS packageoid,               +
            |                 |              |     pg_proc.proname AS eltname,                           +
            |                 |              |     pg_proc.proaccess AS visibilty,                       +
            |                 |              |         DECODE(  (pg_proc.protype)::character varying     +
            |                 |              |             , ('0'::text)::character varying              +
            |                 |              |             , ('F'::text)::character varying              +
            |                 |              |             , ('1'::text)::character varying              +
            |                 |              |             , ('P'::text)::character varying              +
            |                 |              |             , NULL::character varying                     +
            |                 |              |         ) AS eltclass,                                    +
            |                 |              |     pg_proc.prorettype AS eltdatatype,                    +
            |                 |              |     pg_proc.pronargs AS nargs,                            +
            |                 |              |     pg_proc.proargtypes AS argtypes,                      +
            |                 |              |     pg_proc.proargmodes AS argmodes,                      +
            |                 |              |     pg_proc.proargnames AS argnames,                      +
            |                 |              |     pg_proc.proargdefaults AS argdefvals                  +
            |                 |              |    FROM pg_proc                                           +
            |                 |              |   WHERE (pg_proc.pronamespace IN ( SELECT pg_namespace.oid+
            |                 |              |            FROM pg_namespace                              +
            |                 |              |           WHERE (pg_namespace.nspparent <> (0)::oid)));
(1 row)
postgres=# select * from pg_views where viewname='edb_package';
 schemaname |  viewname   |  viewowner   |                                         definition                                          
------------+-------------+--------------+---------------------------------------------------------------------------------------------
 pg_catalog | edb_package | enterprisedb |  SELECT pg_namespace.oid,                                                                  +
            |             |              |     pg_namespace.nspname AS pkgname,                                                       +
            |             |              |     pg_namespace.nspparent AS pkgnamespace,                                                +
            |             |              |     pg_namespace.nspowner AS pkGowner,                                                     +
            |             |              |     edb_get_packageheaddef(pg_namespace.oid) AS pkgheadsrc,                                +
            |             |              |     edb_get_packagebodydef(pg_namespace.oid) AS pkgbodysrc,                                +
            |             |              |     'P'::character(1) AS pkgproperties,                                                    +
            |             |              |     pg_namespace.nspacl AS pkgacl,                                                         +
            |             |              |     pg_namespace.cmin,                                                                     +
            |             |              |     pg_namespace.xmin,                                                                     +
            |             |              |     pg_namespace.cmax,                                                                     +
            |             |              |     pg_namespace.xmax,                                                                     +
            |             |              |     pg_namespace.ctid                                                                      +
            |             |              |    FROM pg_namespace                                                                       +
            |             |              |   WHERE ((pg_namespace.nspparent <> (0)::oid) AND (pg_namespace.nspobjecttype = (0)::oid));
(1 row)
postgres=# select * from edb_package where pkgname='pk_demo';
  oid  | pkgname | pkgnamespace | pkgowner |                 pkgheadsrc                  |                                   pkgbodysrc                                    | pkgproperties | pkgacl | cmin | xmin | cmax | xmax |  ctid  
-------+---------+--------------+----------+---------------------------------------------+---------------------------------------------------------------------------------+---------------+--------+------+------+------+------+--------
 16454 | pk_demo |         2200 |       10 | CREATE OR REPLACE PACKAGE public.pk_demo IS+| CREATE OR REPLACE PACKAGE BODY public.pk_demo IS                               +| P             |        |    2 | 1231 |    2 |    0 | (0,29)
       |         |              |          |   var_pk_demo_1 numeric;                   +|   FUNCTION func_demo() RETURN numeric IS                                       +|               |        |      |      |      |      | 
       |         |              |          |   FUNCTION func_demo() RETURN numeric;     +|     BEGIN                                                                      +|               |        |      |      |      |      | 
       |         |              |          |   PROCEDURE proc_demo();                   +|       var_pk_demo_1 := 100;                                                    +|               |        |      |      |      |      | 
       |         |              |          | END                                         |       return var_pk_demo_1;                                                    +|               |        |      |      |      |      | 
       |         |              |          |                                             |     END;                                                                       +|               |        |      |      |      |      | 
       |         |              |          |                                             |                                                                                +|               |        |      |      |      |      | 
       |         |              |          |                                             |   PROCEDURE proc_demo() IS                                                     +|               |        |      |      |      |      | 
       |         |              |          |                                             |     ret number;                                                                +|               |        |      |      |      |      | 
       |         |              |          |                                             |     BEGIN                                                                      +|               |        |      |      |      |      | 
       |         |              |          |                                             |       select func_demo() into ret;                                             +|               |        |      |      |      |      | 
       |         |              |          |                                             |       var_pk_demo_1 := 200;                                                    +|               |        |      |      |      |      | 
       |         |              |          |                                             |       dbms_output.put_line('var_pk_demo_1 := '||var_pk_demo_1||',ret = '||ret);+|               |        |      |      |      |      | 
       |         |              |          |                                             |     END;                                                                       +|               |        |      |      |      |      | 
       |         |              |          |                                             | END                                                                             |               |        |      |      |      |      | 
(1 row)

“怎么理解edb中的package”的内容就介绍到这里了,感谢大家的阅读。如果想了解更多行业相关的知识可以关注编程网网站,小编将为大家输出更多高质量的实用文章!

您可能感兴趣的文档:

--结束END--

本文标题: 怎么理解edb中的package

本文链接: https://www.lsjlt.com/news/63597.html(转载时请注明来源链接)

有问题或投稿请发送至: 邮箱/279061341@qq.com    QQ/279061341

本篇文章演示代码以及资料文档资料下载

下载Word文档到电脑,方便收藏和打印~

下载Word文档
猜你喜欢
  • 怎么理解edb中的package
    本篇内容介绍了“怎么理解edb中的package”的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有所成!创建pack...
    99+
    2024-04-02
  • python中的module和package怎么用
    这篇文章主要介绍“python中的module和package怎么用”的相关知识,小编通过实际案例向大家展示操作过程,操作方法简单快捷,实用性强,希望这篇“python中的module和package怎么用”文章能帮助大家解决问题。在 pa...
    99+
    2023-06-30
  • Ubuntu中的 “Unable to parse package file” 错误怎么解决
    这篇文章主要介绍“Ubuntu中的 “Unable to parse package file” 错误怎么解决”,在日常操作中,相信很多人在Ubuntu中的 “Unable to parse package file” 错误怎么解决问题上存...
    99+
    2023-06-16
  • Java的package包怎么用
    这篇文章主要介绍“Java的package包怎么用”的相关知识,小编通过实际案例向大家展示操作过程,操作方法简单快捷,实用性强,希望这篇“Java的package包怎么用”文章能帮助大家解决问题。什么是包包 (package) 是组织类的一...
    99+
    2023-06-29
  • Android中Package Manager怎么使用
    这篇文章主要介绍“Android中Package Manager怎么使用”,在日常操作中,相信很多人在Android中Package Manager怎么使用问题上存在疑惑,小编查阅了各式资料,整理出简单好用的操作方法,希望对大家解答”And...
    99+
    2023-06-25
  • 怎么在python中导入package
    本篇内容介绍了“怎么在python中导入package”的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有所成!package 在 python 中,是...
    99+
    2023-06-30
  • Go语言中的包Package怎么使用
    本文小编为大家详细介绍“Go语言中的包Package怎么使用”,内容详细,步骤清晰,细节处理妥当,希望这篇“Go语言中的包Package怎么使用”文章能帮助大家解决疑惑,下面跟着小编的思路慢慢深入,一起来学习新知识吧。问题一、Go使用Pac...
    99+
    2023-07-02
  • Go语言中的包Package详解
    问题一、Go使用Package组织源码的好处是什么? 1.任何源码属于一个包 2.用包组织便于代码的易读和复用 问题二、Go语言中Package的种类 Go语言中存在两种包、一种是可...
    99+
    2024-04-02
  • linux中package指的是什么
    这篇文章主要介绍“linux中package指的是什么”,在日常操作中,相信很多人在linux中package指的是什么问题上存在疑惑,小编查阅了各式资料,整理出简单好用的操作方法,希望对大家解答”linux中package指的是什么”的疑...
    99+
    2023-07-02
  • 无法找到Package Proftpd怎么解决
    这篇文章给大家介绍无法找到Package Proftpd怎么解决,内容非常详细,感兴趣的小伙伴们可以参考借鉴,希望对大家能有所帮助。ProFTPD:一个Unix平台上或是类Unix平台上(如Linux, FreeBSD等)的FTP服务器程序...
    99+
    2023-06-16
  • rust的package,crate,module怎么使用
    这篇文章主要介绍“rust的package,crate,module怎么使用”的相关知识,小编通过实际案例向大家展示操作过程,操作方法简单快捷,实用性强,希望这篇“rust的package,crate,module怎么使用”文章能帮助大家解...
    99+
    2023-07-06
  • Java 中 Class Path 和 Package的使用详解
    目录一、 类路径 (class path)二、 包 (package)三、 jar 文件一、 类路径 (class path) 当你满怀着希望安装好了 java, 然后兴冲冲地写了个...
    99+
    2022-11-13
    Java 中的Class Path Java 中的Package
  • Hybris的extension和ABAP的package怎么使用
    本篇内容介绍了“Hybris的extension和ABAP的package怎么使用”的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有所成!这个概念和A...
    99+
    2023-06-04
  • 怎么解决MySQL的conflicts with file from package报错问题
    这篇文章主要讲解了“怎么解决MySQL的conflicts with file from package报错问题”,文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究和学习...
    99+
    2024-04-02
  • Rstudio中安装package出现的问题及解决
    Rstudio中安装package问题 一、 install.packages('REmap')无法安装package:错误:“无法与服务器建立连接” 解决方式:切换下载的镜像 方法...
    99+
    2024-04-02
  • pycharm中cv2的package安装失败问题及解决
    目录pycharm cv2的package安装失败具体的解决方案如下解决PyCharm/Python安装cv2和OpenCV报错问题解决总结pycharm cv2的package安装...
    99+
    2023-05-18
    pycharm cv2 cv2 package安装失败 pycharm cv2 package安装失败
  • 怎么解决linux安装mysql提示conflicts with file from package的问题
    这篇文章主要介绍“怎么解决linux安装mysql提示conflicts with file from package的问题”,在日常操作中,相信很多人在怎么解决linux安装mysql提示conflict...
    99+
    2024-04-02
  • 怎么在python中利用Package设置文件入口
    本篇文章给大家分享的是有关怎么在python中利用Package设置文件入口,小编觉得挺实用的,因此分享给大家学习,希望大家阅读完这篇文章后可以有所收获,话不多说,跟着小编一起来看看吧。Python主要用来做什么Python主要应用于:1、...
    99+
    2023-06-14
  • 通过spring-boot-maven-plugin package失败问题怎么解决
    这篇文章主要介绍“通过spring-boot-maven-plugin package失败问题怎么解决”的相关知识,小编通过实际案例向大家展示操作过程,操作方法简单快捷,实用性强,希望这篇“通过spring-boot-maven-...
    99+
    2023-07-06
  • 怎么理解MySQL5.6中的PERFORMANCE_SCHEM
    本篇内容介绍了“怎么理解MySQL5.6中的PERFORMANCE_SCHEM”的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅...
    99+
    2024-04-02
软考高级职称资格查询
编程网,编程工程师的家园,是目前国内优秀的开源技术社区之一,形成了由开源软件库、代码分享、资讯、协作翻译、讨论区和博客等几大频道内容,为IT开发者提供了一个发现、使用、并交流开源技术的平台。
  • 官方手机版

  • 微信公众号

  • 商务合作