Data dcitioany view and function and procedures insure a package

I need the run a query on the Data dcitioany, to get a list of packages as well as a list for procedures and functions inside on Oracle 10g

I use DBA_SOURCE,
I used like this
  SELECT v.owner,
       (CASE V.type
        WHEN 'FUNCTION'  THEN NULL
        WHEN 'PROCEDURE' THEN NULL
        ELSE v.name
        END
       )PACKAGE_NAME ,
        UPPER(
        SUBSTR
        TRANSLATE(
        LTRIM(REPLACE(SUBSTR(ltrim(v.text),LENGTH('PROCEDURE')+1),'"',''),' '),
        '+++'
        ),---TEXT TO BE SEARCH
        1,---STARTING POSITION
        INSTR(
        TRANSLATE(
        LTRIM(REPLACE(SUBSTR(ltrim(v.text),LENGTH('PROCEDURE')+1),'"',''),' '),
        '+++'
        ||'+'
        '+'
        )-1 ---lENGTH
        )OBJECT_NAME
        TRIM(SUBSTR(ltrim(v.text),1,LENGTH('PROCEDURE')))"TYPE"
FROM dba_source v
WHERE (TRIM(ltrim(v.text)) LIKE ('FUNCTION%') OR TRIM(ltrim(v.text)) LIKE ('PROCEDURE%')) AND
            v.type IN ('PACKAGE','FUNCTION','PROCEDURE')
ORDER BY V.OWNER,V.name,v.text;Note: the translate, substr, etc function can be simplified based on your needs
in my case, how developers created the function and procedure is quite messy.
thanks

Similar Messages

  • How can i find start line of any functions or procedures stored in package body?

    hi
    how can i find start line of any functions or procedures stored in package body?
    is there any way to write a query from for example user_source?
    thanks

    how can i find start line of any functions or procedures stored in package body?
    Why? What will you do differently if a procedure starts on line 173 instead of line 254?
    Tell us what PROBLEM you are trying to solve so we can help you find the best way to solve it.
    If you use PL_SCOPE that info is available in the *_IDENTIFIERS views. See 'Using PL/Scope in the Advanced Dev Doc
    http://docs.oracle.com/cd/B28359_01/appdev.111/b28424/adfns_plscope.htm
    Try this simple sample code. The query is modified from that doc sample:
    -- tell the compiler to collect the info
    ALTER SESSION SET PLSCOPE_SETTINGS='IDENTIFIERS:ALL';
    -- recompile the package
    CREATE OR REPLACE package SCOTT.pack1 as
    PROCEDURE proc1;
    PROCEDURE proc2;
    END;
    CREATE OR REPLACE package BODY SCOTT.pack1 as
    PROCEDURE proc1 IS
    BEGIN
      NULL;
    END;
    PROCEDURE proc2 IS
    BEGIN
      proc1;
    END;
    PROCEDURE proc3 IS
    BEGIN
      proc1;
      proc2;
    END;
    END;
    -- query the info for the package spec
    WITH v AS (
      SELECT    Line,
                Col,
                INITCAP(NAME) Name,
                LOWER(TYPE)   Type,
                LOWER(USAGE)  Usage,
                USAGE_ID,
                USAGE_CONTEXT_ID
        FROM USER_IDENTIFIERS
          WHERE Object_Name = 'PACK1'
            AND Object_Type = 'PACKAGE'
    SELECT LINE, RPAD(LPAD(' ', 2*(Level-1)) ||
                     Name, 20, '.')||' '||
                     RPAD(Type, 20)||
                     RPAD(Usage, 20)
                     IDENTIFIER_USAGE_CONTEXTS
      FROM v
      START WITH USAGE_CONTEXT_ID = 0
      CONNECT BY PRIOR USAGE_ID = USAGE_CONTEXT_ID
      ORDER SIBLINGS BY Line, Col
    LINE,IDENTIFIER_USAGE_CONTEXTS
    1,Pack1............... package             declaration        
    2,  Proc1............. procedure           declaration        
    3,  Proc2............. procedure           declaration        
    -- query the info for the package body - change 'PACKAGE' to 'PACKAGE BODY' in the query above
    LINE,IDENTIFIER_USAGE_CONTEXTS
    1,Pack1............... package             definition         
    2,  Proc1............. procedure           definition         
    6,  Proc2............. procedure           definition         
    8,    Proc1........... procedure           call               
    10,  Proc3............. procedure           declaration        
    10,    Proc3........... procedure           definition         
    12,      Proc1......... procedure           call               
    13,      Proc2......... procedure           call               

  • HR transactions and functionality and creation of Database view

    Hi Guys
        I am new to HR module . can anybody send me the list of transaction codes with HR functionalities.
    I also have to made a database view from hrp1001 and hrp1010 table to list all chief positions who are head of business group , Business unit , Site etc .
    Could you help me in creating this databse view.

    Hi,
    These are HR Infotypes
    0000    Events
    0001    Org assignment
    0002    Personal info
    0003    Payroll data
    0007    Work time
    0008    Basic pay
    0014    Reoccurring pay
    0015   1 X pay
    0027   Cost Center
    0041   Event Dates
    0057   Membership dues
    0165   Over ride  to limits on deductions
    0167   Health
    0168   Insurance
    0169   Savings
    0170   Spending   
    0194   Garnishment reduction
    0195   Garnishment order
    0207   Residence Tax
    0208   Work Tax
    0209   Unemployment Tax
    0210   Withholding
    0216   Garnishment adjustment
    0221   Adjustment
    0267   Off cycle
    2005   OT
    2010   Catts direct to cluster
    1000   Infotypes 1000 – 1999 are PD Relationship infotypes
    Logical Database (PNP) ·     
    Programming with Infotypes ·     
    Processing Time infotypes/Cluster ·     
    Processing Payroll infotypes/Cluster
    In OM level hrp 1001 and 1010 will be there.
    If u want total transactions goto SE11->TSTC Table.
    ****POINTS TO BE CONSIDERD
    Thanks
    P.SRIKANTH

  • Analytical View - Substring function and Other functions.

    Hello All
    I am trying to use substring and trim function for a value/string and get the field value from position 6 - 10. in analytical view.
    Example: Field name XYZ (Values showing as: ASDFG GETVALUENW  2345) --> (data type :22 VARCHAR)
    Output must be : GETVALUENW (which is 10 characters, from position 6 after trimming) which I am wring to new filed in Calculated coloumns.
    Trying the use built-in functions but syntax wise missing some thing need your inputs.
    Regards
    Kiran.

    Hi Kiran Avunuri,
    A small thought process.
    Have you tried something similar(syntax) in your view.
    BR
    Prabhith

  • Procedure and Functions from ADF View Layer

    Hi,
    Before i ask my question ,I would like to mention that I have done lot of googling on this topic before asking this question.
    http://adfhowto.blogspot.in/2010/11/call-db-procedure-or-function-from-adf.html
    http://adf-tools.blogspot.ca/2010/03/adf-plsql-procedure-or-function-call.html
    Lot of threads on otn forum too on this topic.
    I m pretty new to ADf too.
    Now most of our logic is in procedures and functions ,so on various events on form(view layer) I need to call procedure and function and then return values back to value layer too.
    Now the approach mentioned in the link above is good whats best approach to return out parameters to view layer considering i will be using either the DbCall class for all calls to procedures and functions
    I am thinking of this approach to Create a view with static fields,and in Model layer set values for these fields and access them in view layer or binding view controls to these fields.
    From View layer i will call the methods in AppmodImpl which will be calling procedure( methods will be exposed as Client Interface)
    Also in few articles i came across generic CallStoredProcedure and CallStoredFunctions.
    But my main concern is how to share out parameters with view layer....can anyone give link of showing application of it on view layer.
    Regards,

    From your subject. am stating that, dont do all those stuff in backing bean. backing bean is 1:1 mapping with your .jpsx or .jsff .
    best approach would be call those things your Application Module(model layer) exposed it. access the method over your pagedef. well said by ram.

  • Result_cache and data dictionary views

    Hi,
    Are there any special considerations when caching the results of a function which uses data dictionary views to determine it's results?
    This question has popped because I have a such a result_cached function for which the result_cache objects are not getting invalidated even when the underlying data dictionary views have changed and the function gives 'stale' values in it's output. Adding the relies_on clause has not helped either.
    Here is what I am trying to do:
    The function accepts table name as its input and tries to determine all the child tables using the sys.dba_constraints view. The results are returned in a pl/sql table and are cached so that the subsequent calls to this function use the result_cache.
    Everything works fine for the parent/child tables which have been created before the creation of this function. All the results are correct.
    The problem starts when a new child table is added to an existing parent table.
    The v$result_cache_objects view shows the result of this function as 'Published' and the output of the function does not show the newly created child table.
    Same is the case when an existing child table is deleted; the function continues to return it in the output as it is pulled from the result_cache.
    Oracle version:
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
    PL/SQL Release 11.2.0.1.0 - Production
    CORE 11.2.0.1.0 Production
    TNS for Linux: Version 11.2.0.1.0 - Production
    NLSRTL Version 11.2.0.1.0 - Production

    >
    Restrictions on Result-Cached Functions*
    To be result-cached, a function must meet all of these criteria:
    * It is not defined in a module that has invoker's rights or in an anonymous block.
    * It is not a pipelined table function.
    * It does not reference dictionary tables, temporary tables, sequences, or nondeterministic SQL functions.
    For more information, see Oracle Database Performance Tuning Guide.
    * It has no OUT or IN OUT parameters.
    * No IN parameter has one of these types:
    o BLOB
    o CLOB
    o NCLOB
    o REF CURSOR
    o Collection
    o Object
    o Record
    * The return type is none of these:
    o BLOB
    o CLOB
    o NCLOB
    o REF CURSOR
    o Object
    o Record or PL/SQL collection that contains an unsupported return type
    It is recommended that a result-cached function also meet these criteria:
    * It has no side effects.
    For information about side effects, see "Subprogram Side Effects".
    * It does not depend on session-specific settings.
    For more information, see "Making Result-Cached Functions Handle Session-Specific Settings".
    * It does not depend on session-specific application contexts.
    >
    http://download.oracle.com/docs/cd/E11882_01/appdev.112/e17126/subprograms.htm#LNPLS698

  • Member function and member procedure inside an object type in Oracle.

    Hi All,
    Please do have a look at these codes and help me understand. I have no idea about this member function and member procedure. How do they work? Please explain me about this.
    Regards,
    BS2012
    create type foo_type as object (
      foo number,
      member procedure proc(p in number),
      member function  func(p in number) return number
    create type body foo_type as
      member procedure proc(p in number) is begin
        foo := p*2;
      end proc;
      member function func(p in number) return number is begin
        return foo/p;
      end func;
    end;
    /

    Methods are just like functions or procedures in a package, except they're not in a package, their part of an object type.
    The object has attributes (which are the variables declared in it).
    To use such an object you would do things like this...
    SQL> set serverout on
    SQL>
    SQL> declare
      2    v_foo foo_type;
      3    v_val number;
      4  begin
      5    v_foo := foo_type(20); -- instantiate the object and initialize the object attributes
      6    v_foo.proc(20); -- call the object method (proc)
      7    v_val := v_foo.func(4); -- call the object method (func)
      8    dbms_output.put_line(v_val);
      9  end;
    10  /
    10
    PL/SQL procedure successfully completed.The Type definition you've declared creates the object class, but not actually an object itself.
    To actually have an object you need to declare a variable of that object class type, and then instantiate it. When you instantiate the object you need to initialize all the attributes (generally you can pass null if required for each of them to initialize them).
    Once you have your object instantiated, you can call the methods within that object as demonstrated above, a bit like calling functions and procedures in a package, except they are methods within the object type itself, and therefore called directly by referencing them from the variable.
    The documentation goes into a lot more detail of objects if you look it up.

  • How to move functions and procedures from packages into a schema?

    Hello,
    I have below requirements for a homework and my question is if someone can point me in the right direction to find documentation which can help me solve the below. Any information will be very much appreciated. Thank you.
    Write procedures and functions (included or not in packages)under the form scripts  .txt or .sql . Once they have been launched in SQL developer they should more the functions and the procedures from the packages in the current schema. If the current schema contains only 2 packages, pac1( with procedures p11,p12 and the functions f11,f12,f13) and pac2( contains the following procedures p21,p22,p23 and the functions f21 and f21( overloading cases), the execution of the scripts will generate the following effects:
    The procedures p11,p12,p21,p22 ,p23 and the functions f11,f12 and f13 will be created in the current schema.
    pac2 will contain 2 instances of the overloading function- f21; they will be kept in the package, without being created in the current schema; so all the procedures/functions overloaded will be kept in the original packages
    If pac1 contains variables, cursors and public types, we will keep only the package specifics( and delete the body);generally if the packages do not contain procedures or functions overloaded the body will be deleted and if no variables, cursors, public types then we will delete the header.
    If in the triggers, procedures, functions  we will call procedures/functions from the packages(the procedures and the functions moved in the current schema) they reference will need to be updated ( via amending the body or recompile) for example if pa1.p12 will need to be replaced with p12.
    The scripts will have to have numbers in the following series( 01....n) and characters that explain the content.

    My only advice would be to remember that these are public forums and if YOU can find them, so can your instructors.
    Also, those are horrible procedure and function names
    This assignment seems to be around overloading pl/sql objects and order of precedence...do a search on the Oracle Docs around overloading and inheritence
    http://docs.oracle.com/cd/B28359_01/appdev.111/b28371/adobjplsql.htm#i21148

  • How to test procedures and functions of pl/sql

    I am working as a QA basically i got a new assignment of testing functions and procedures, and packeged bodies. Can any one help me in this matter.
    Please help me.
    Hi i am new to oracle I want to test procedures and functions,
    and packaged bodies of pl/sql.

    It depends on what you meant by "testing". I guess you need to check that routines (functions, procedures, packages etc) in valid state and execute without errors. The simpliest way is to get some development tool like TOAD (http://www.quest.com), Oracle Maestro (http://www.sqlmaestro.com) or PL/SQL Developer (http://www.allroundautomations.com). You can connect with them to database and look at the routine state VALID or INVALID. You can recompile them, run and even debug. I guess this should be enough.
    Alternatively you can do same thing from sqlplus. Of course with lesser comfort. You need to write certain SQL statements. For example i want to find invalid procedures:
    SQL> select OBJECT_NAME, OBJECT_TYPE from USER_OBJECTS where STATUS='INVALID';
    To check how procedures work you need to execute anonymous PL/SQL block like this:
    declare
         /* local variables declaration */
         NAME VARCHAR2(4000);
         PRESIDENT_ID NUMBER(38);
         ID NUMBER(38);
    begin
         /* setting up variables */
         NAME:='MICROSOFT';
         PRESIDENT_ID:='BILLY';
         ID:=NULL;
         /* calling routine */
         GEOMETRY.ADD_COMPANY(NAME,PRESIDENT_ID,ID);
    end;

  • Regarding Procedures and functions

    can we pass a cursor,table or ref cursor to a procedure and functions and can a function return cursor,table or ref cursor to a procedure and functions?please if possible give some examples with explanations
    thanks in advance..

    Hi,
    The definition for a Procedure or Function can be edited by selecting Edit from the drop-down menu for the Procedure/Function object in the Browser.
    The definition can then be edited as text, and so Table, REF CURSOR, ... parameters or return types can be added.
    (After completing the edit, select Save from the File menu, or alternatively Close the tab displaying the definition and select Yes to the Save Changes dialog.)
    The Oracle Database PL/SQL Language Reference documentation contains some examples of Procedure and Function definitions.
    David

  • Where exactly should i write API and function calls in OAF

    Can anybody tell me where to call the API's and functions and also please specify the reason for that so that i can understand properly.
    Thanks a lot in advance.
    kumar

    In case you need to call the pl/sql API's then you should create an PL/SQL EO based on each business function per each pl/sql package and override the dml methods.
    Please go through the section "PL/SQL Entity Object Design and Development" in OA Fwk Dev Guide.
    Thanks,
    Ravi

  • Send CURSOR to Function/Store Procedure

    Hi to all,
    I want to send a cursor to a function or store procedure.
    I got 3 tables with the same structure, I made a cursor for update and other stuff but I want to save some data to a text file, so I want to make a function or sotre procedure that I can send the cursor and the function/store procedure make the Job (save the data to a text file) with any tables.
    Can I do That?
    Any sample or documentation?
    Thanks in advance.

    HLopezRD wrote:
    Hi to all,
    I want to send a cursor to a function or store procedure.
    Any sample or documentation?Do you want to send an actual cursor or just the data?
    Either way, a reference cursor might do the job for you. Check out reference cursors in the Oracle on-line documentation. You can pass them to and from procedures and functions, and they provide access to data in the database.

  • How can I use the procedures and functions in my library

    hello, all
    I have a pl/sql library MYLIB.pld, MYLIB.pll and MYLIB.plx.
    How can I invoke procedures and functions there in JDeveloper?
    Thanks.
    Damon

    I am indeed using ADF BC to re-develop the oracle application.
    Here is my situation:
    We have an oracle form application.
    Our objective is to try to re-use the existing sources in the form application as much as possible:
    1. tons of procedures and functions in a pl/sql library(a file with extension name portfolioLib.pll or portfolioLib.plx);
    2. tons of form-level triggers, data-block triggers and item-triggers;
    3. tons of database stored procedures and triggers;
    After doing a research on JDeveloper, we decide to use ADF Swing+ADF BC to re-develop the application.
    My opinion for the above three kinds of sources in our form application is:
    for 1: we try to move most of procedures and functions into database(except Form build-in);
    for 2: we try to wrap those triggers in a SQLJ class;
    for 3: we try to call database procedures and functions with PreparedStatment or CallableStatement;
    I just do a test on a post-query trigger on a data-block:
    I created a sqlj file, named testSQLJ.sqlj in the test.view package;
    I tried to call it in createInstanceFromResultSet of testDeptVOImpl.java which is test.model package,
    I was told that testSQLJ cannot be found there. why?
    How can I call some classes from test.view package in some classes of test.model?
    I read some documents about how to deal with post-query trigger in JDeveloper: create a view with SQL statement, but it seems that it does not support pl/sql statement there.
    Can you give me some opinion about the above stuff?
    I really appreciate your help.
    Damon

  • Double quotes in function and procedure names when using impdp

    When viewing a function in the original database, it looks like:
    CREATE OR REPLACE FUNCTION TA_ACTIVITY_D_GEN_FNC
    After doing an expdp and impdp to restore a development database, it now looks like
    CREATE OR REPLACE FUNCTION "TA_ACTIVITY_D_GEN_FNC"
    and also has 2 blank lines at end of function.
    This causes us problems when trying to use various utilites to compare differences in production and development. Now every function and procedure shows up as being different.
    Can someone please explain why and what can be done to avoid this from happening?
    Edited by: user6116705 on Jun 15, 2010 7:52 AM

    from old exp, here is the first line of the create procedure statement:
    CREATE FORMAT71 PROCEDURE "SECURE_DML"
    You can see the double quotes. I don't understand why you wouldn't see the same compare issue with old exp. I was wondering what you were using for compare since it would let me know where to look for anything that has changed from the original create to the create performed by data pump. I remember there being an issue in this area. I just don't remember if it was extra spacing, upcasing, or something else or multiple changes. You could contact Oracle support to see if there is a fix and if it is backported to your version.
    The only other way you can possibly fix this (and it would be a huge pain) would be to run impdp with a sqlfile and then edit the sqfile to remove the double quotes and to remove any extra spacing/extra lines. A patch from Oracle would certainly be easier if one was available.
    Dean

  • Exp/imp procedures, functions and packages question

    Hi
    I've a 9i R2 version Oracle database. I would like to export procedures, functions and packages from a schema. How do I do that?
    Is there any script or command lines can provide?
    Thanks

    Hello user12259190.
    You can do an export of the user itself, excluding table data as inH:\>exp
    Export: Release 10.2.0.1.0 - Production on Tue Dec 22 11:22:52 2009
    Copyright (c) 1982, 2005, Oracle.  All rights reserved.
    Username: db_user@db_sid
    Password:
    Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
    With the Partitioning, Data Mining and Real Application Testing options
    Enter array fetch buffer size: 4096 >
    Export file: EXPDAT.DMP >
    (2)U(sers), or (3)T(ables): (2)U > 2
    Export grants (yes/no): yes > no
    Export table data (yes/no): yes > no
    Compress extents (yes/no): yes > no
    Export done in WE8MSWIN1252 character set and AL16UTF16 NCHAR character set
    server uses UTF8 character set (possible charset conversion)
    Note: table data (rows) will not be exported
    Note: grants on tables/views/sequences/roles will not be exported
    . exporting pre-schema procedural objects and actions
    . exporting foreign function library names for user DB_USER
    . exporting PUBLIC type synonyms
    . exporting private type synonyms
    . exporting object type definitions for user DB_USER
    About to export DB_USER's objects ...
    . exporting database links
    . exporting sequence numbers
    . exporting cluster definitions
    . about to export DB_USER's tables via Conventional Path ...
    . . exporting table  TABLE_NAMEs
    EXP-00091: Exporting questionable statistics.
    . exporting synonyms
    . exporting views
    . exporting stored procedures
    . exporting operators
    . exporting referential integrity constraints
    . exporting triggers
    . exporting indextypes
    . exporting bitmap, functional and extensible indexes
    . exporting posttables actions
    . exporting materialized views
    . exporting snapshot logs
    . exporting job queues
    . exporting refresh groups and children
    . exporting dimensions
    . exporting post-schema procedural objects and actions
    . exporting statistics
    Export terminated successfully with warnings.Unfortunately, you can't export just the objects you want to unless they are tables.
    Using import (imp) you can list the content of your packages, procedures, functions, views, etc. and perhaps that will give you what you need.
    Another choice would be to useSELECT * FROM user_source ORDER BY 2, 1, 3;to list the code.
    Hope this helps,
    Luke

Maybe you are looking for

  • Dump : Runtime Errors         DBIF_RSQL_INVALID_RSQL

    Hi Experts, I got a dump at the select statement in the production during the excution.The Details of the program are : DATA : BEGIN OF it_ekko OCCURS 0.         INCLUDE STRUCTURE ekko. DATA : END OF it_ekko. START-OF-SELECTION. SELECT * FROM ekko   

  • How can I create a white border around figures that are in an image? (CS 6; examples+image included)

    Hi, I have CS6 and am wondering how to create a white ("comic style"?) border around figures in an image, as in the examples below. I don't wish to include the black shadow of the border, just the white part. Examples: Here's the image I'd like to al

  • I phone 4 goes dim/dark during use

    Replaced a cracked screen, phone comes on fine but after brief usage the screen goes dim/dark. Pressing the sleep/awake button on top will usually bring it back to normal but it continues to do this until I do hard reset. If I hold the phone at an an

  • S10-3 Screen Brightness Linux work around

    I am running Mint 9 and Ubuntu 10.04 on my S10-3. Very happy with the platform overall, but as many have found their screen brightness keys do not work. My web research indicates that the latest kernels will have a fix, but that probably won't be com

  • Issue in using BAPI object in LSMW.

    Hi Friends, we are using BUS1506 business object(BAPI) to change settlement data(RESCSU) in LSMW. We have done the ALE configuration for this object, which is needed to create Inbound idoc. Here we are getting the error message as "Create a partner p