简单的PLSQL(oracle)语法问题

时间:2011-08-02 03:48:52

标签: sql oracle plsql

我有这样的声明:

SELECT passwdlib.piv_insertPasswd(:A1, :A2) 
  FROM DUAL

我猜测piv_insertPasswd是函数或SP的名称,而passwdlib是用户名。我对吗?如果不是每个组件是什么?

3 个答案:

答案 0 :(得分:3)

passwdlib可以是包名。见http://download.oracle.com/docs/cd/B10500_01/appdev.920/a96624/09_packs.htm

否则,它是模式名称。

答案 1 :(得分:2)

passwdlib更有可能是包名称,而piv_insertPasswd是包中函数的名称。

答案 2 :(得分:2)

架构,包,对象,同义词。

select object_type
from   user_objects uo
where  uo.OBJECT_NAME = 'PASSWDLIB'

select typecode
from   user_types ut
where  ut.type_name = 'PASSWDLIB'

select *
from   USER_METHOD_PARAMS um
where  um.type_name = 'PASSWDLIB'

2°部分:在帖子被标记为已回答后添加。 我认为在这种情况下正确的方法是查询字典,没有它我们只会尝试猜测!

测试对象选项。

CREATE TYPE TPerson AS OBJECT (
  idno           NUMBER,
  first_name     VARCHAR2(20),
  last_name      VARCHAR2(25),
  email          VARCHAR2(25),
  phone          VARCHAR2(20),

  static FUNCTION getDetails  return varchar2);
/

create type body TPerson as

    static function getDetails return varchar2 is
    begin           
        return 'I am TPerson type ';
    end;
end;
/

select TPerson.getDetails() from dual;

输出

 select TPerson.getDetails() from dual;  

 TPERSON.GETDETAILS()
 --------------------------------------------------------------------------------
 I am TPerson type   

调查

select object_type,uo.*
from   user_objects uo
where  uo.OBJECT_NAME = 'TPERSON';


OBJECT_TYPE         OBJECT_NAME                                                                      SUBOBJECT_NAME                  OBJECT_ID DATA_OBJECT_ID OBJECT_TYPE         CREATED     LAST_DDL_TIME TIMESTAMP           STATUS  TEMPORARY GENERATED SECONDARY  NAMESPACE EDITION_NAME
------------------- -------------------------------------------------------------------------------- ------------------------------ ---------- -------------- ------------------- ----------- ------------- ------------------- ------- --------- --------- --------- ---------- ------------------------------
TYPE                TPERSON                                                                                                              23020                TYPE                02/08/2011  02/08/2011 07 2011-08-02:07:50:57 VALID   N         N         N                  1 
TYPE BODY           TPERSON                                                                                                              23021                TYPE BODY           02/08/2011  02/08/2011 07 2011-08-02:07:50:57 VALID   N         N         N                  2



select typecode,ut.*
from   user_types ut
where  ut.type_name = 'TPERSON';


TYPECODE                       TYPE_NAME                      TYPE_OID                         TYPECODE                       ATTRIBUTES    METHODS PREDEFINED INCOMPLETE FINAL INSTANTIABLE SUPERTYPE_OWNER                SUPERTYPE_NAME                 LOCAL_ATTRIBUTES LOCAL_METHODS TYPEID
------------------------------ ------------------------------ -------------------------------- ------------------------------ ---------- ---------- ---------- ---------- ----- ------------ ------------------------------ ------------------------------ ---------------- ------------- --------------------------------
OBJECT                         TPERSON                        711EFA23BE614F1BAFE0D741324DB215 OBJECT                                  5          1 NO         NO         YES   YES