开发者

simple PLSQL (oracle) syntax question

I have this statement:

SELECT passwdlib.piv_insertPasswd(:A1, :A开发者_运维百科2) 
  FROM DUAL

I am guessing that piv_insertPasswd is the name of function or SP, and passwdlib is the user name. Am i right? If not what is each component?


passwdlib could be a package name. See http://download.oracle.com/docs/cd/B10500_01/appdev.920/a96624/09_packs.htm

Otherwise, it's a schema name.


It is more likely that passwdlib is the package name, and that piv_insertPasswd is the name of the function within the package.


Schema, package, object, synonym.

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° section: added after the post was marked as answered. I think the correct method in this case is to query the dictionary, without it we only try to guess!

Test the object option.

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;

Output

 select TPerson.getDetails() from dual;  

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

The investigation

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                                                                                              
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜