How to wrapped the function and procedure

Hello friends,
I wanna know that how to wrapped the procedure and the
functions in oracle i know little bit about the
wrapping but how can i unrapped the procedure of function
plz help me i am realy thx to you.

You can not un-wrap a procedure/function once it has been wrapped.
look at the following documentation for the wrap utility:
http://download-west.oracle.com/docs/cd/B10501_01/appdev.920/a96624/c_wrap.htm

Similar Messages

  • How to call package function and procedure by PL/SQL

    Dear all,
    I created a package and I want test it by a select statement. e.g. select packagename.function(1, 'A') . However, there is an error message. "ORA-14551: cannot perform a DML operation inside a query ".
    In the package, there is a function and I passed two parameters to the function and return a number. These two parameters will be used in the cursor select statment. Is there sth wrong that I use the cursor with the parameters? What can I do then?
    On the other hand, I want to test the package procedure by using select statement in SQL Plus. How can I call it (with parameter)?
    Remark: I am using Oracle 8i.
    Thanks for advance!!
    Regrads.

    Hi!
    I don't know why it is not running in ur computer. Pls check the script --
    SQL> ed
    Wrote file afiedt.buf
      1  create or replace package pack_test
      2  is
      3    function try_test(eno in number,depno in number)
      4    return number;
      5* end;
    SQL> /
    Package created.
    SQL> create or replace package body pack_test
      2  is
      3    function try_test(eno in number,depno in number)
      4    return number
      5    is
      6      saln number(10);
      7    begin
      8      select sal
      9   into saln
    10   from emp
    11   where empno = eno
    12   and deptno = depno;
    13  
    14   return saln;
    15    end;
    16  end pack_test;
    17  /
    Package body created.
    SQL>
    SQL> select pack_test.try_test(7777,30) from dual;
    PACK_TEST.TRY_TEST(7777,30)
                           3456-it is working fine in my system.
    Regards.
    Satyaki De.

  • 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

  • Query functions and procedures of a user schema

    Hai all,
    how can i query functions and procedures of user suppose user scott using sqlplus?
    i created a function as user scott how can i view my function name?
    Thanks

    Hi,
    You can Query from dba_objects of user_objects for View,
    select owner,object_name,object_type,status from dba_objects where owner='SCOTT';
    or
    conn scott/pass
    select object_name,object_type,status from user_objects;HTH

  • How to run the Oracle Triggers,Functions and Procedures from java

    Hi ,
    I want to execute the Oracle's Triggers, Functions and Procedures from java as like executing the SQL commands by using Execute statements.
    Or can we have some other option for doing this.
    Plz help me ...

    you can use CallableStatement interface of JDBC to execute any DBMS triger,stored procedure ....
    refer any of the JDBC book for extra help
    hope you got it
    Azeem Ahmed

  • Oracle Form functions and procedures in APEX, how?

    I am working to recreate in APEX, already existing Read Only Forms in Oracle Forms. APEX Interactive Report functionality among other things, makes it worth while as well as targetting a different audience than the one that utilizies the Oracle Form versions. Oracle Forms versions use lots of pre and post query triggers, PLSQL Functions.
    In Oracle Forms one of the places those functions can be located is in the "Program Units" section of the Form. A typical function of this sort, based on a specific Mission ID Itinerary, collects scheduled passengers last names, formats them with a comma and space after each one, into a single string that is returned and displayed as the passenger list of one row.
    I have all this code written so I can move most of the main query of the Oracle Form into an Interactive Report. These functions and triggers called from within the Form, from the "Program Units" section of the Oracle Form rather than being stored in the Database schema in a package, where would they go inside APEX? Can I create a "Shortcut" in APEX and call it from the Interactive Report "Region Source"? Can I create the PLSQL function at the page level or region level of the Interactive Report? Or, is my best bet creating a package stored in the database, of all these functions and/or proecedures I may need from the original Oracle Form?
    Some advice would be greatly appriciated.

    RLBickham wrote:
    I don't think I have been clear enough in describing the specific thing I want to do, it simply does not reach the level of forms to APEX conversion. It is basically a PLSQL Function problem.
    I have an Interactive Report that is currently getting 90 percent of what I want however, each row, representing a Mission may have multiple legs. Each Leg has two locations or ICAO codes attached to it. Based on the Mission number, I want to loop through the leg table, collect all the ICAO codes for that Mission, put them all into 1 variable separated by a coma and add that variable to the column display of that Interactive Report as the last column.
    In Oracle Forms I have a function saved to the database that is called within the main query. Maybe I am asking a question that does not need to be asked but in any case my question is can I put that function currently in the database somewhere in the confines of the Interactive Report and reference it via Http somehow or should I just stick with putting functions and procedures in packages stored in the database and called the conventional way?You could move the function to the database and call it from the report query, but it sounds as if it's superfluous. In the report query use whatever form of Re: 4. How do I convert rows to columns? is appropriate to your (unspecified) database version.
    When you have a problem you'll get a faster, more effective response by including as much relevant information as possible upfront. This should include:
    <li>Full APEX version
    <li>Full DB/version/edition/host OS
    <li>Web server architecture (EPG, OHS or APEX listener/host OS)
    <li>Browser(s) and version(s) used
    <li>Theme
    <li>Template(s)
    <li>Region/item type(s) (making particular distinction as to whether a "report" is a standard report, an interactive report, or in fact an "updateable report" (i.e. a tabular form)
    With APEX we're also fortunate to have a great resource in apex.oracle.com where we can reproduce and share problems. Reproducing things there is the best way to troubleshoot most issues, especially those relating to layout and visual formatting. If you expect a detailed answer then it's appropriate for you to take on a significant part of the effort by getting as far as possible with an example of the problem on apex.oracle.com before asking for assistance with specific issues, which we can then see at first hand.

  • How to use type, packages, functions, and procedures in another schema ?

    I have two target schema in one OWB project, such as A and B. In a mapping of A, I would like to use some types, packages, functions, and procedures from B. I have tried the method of synonym as suggested, but I could not find the metadata of these when importing ... The only type of synonym I can import is the synonym for table. Is there a bug for synonym?
    If I cannot use synonym for this issue, is there another way to solve the problem?

    Now, in some instances you will absolutely need to create the second module as Carsten describes, however it should also be noted that you can reference objects in things like Expressions even if you have not loaded up the metadata. It is only when you need strong binding that it becomes neccessary to import objects. For everything else, as long as the reference will resolve at compile-time then you are good to go.
    For example, I have a function in one target schema (S1) and a private synonym to it in another(s2). A mapping in the S2 schema has an expression object that uses the synonym to the function in the expression property for a couple of the output attirbutes. The synonym has not been loaded into metadata - indeed OWB has no knowledge of its existance. But it resolves at compile time so the mapping validates and generates successfully.
    Mike

  • How to find the columns and tables used in a stored procedure?

    Hi,
    Can someone suggest how to find the columns and tables used within a stored procedure?
    Thanks
    VBK

    For example:
    SQL> create or replace
      2    procedure p1
      3      is
      4          cnt number;
      5      begin
      6          select count(*) into cnt from emp;
      7  end;
      8  /
    Procedure created.
    SQL> select  referenced_owner,
      2          referenced_name
      3    from  dba_dependencies
      4    where owner = 'SCOTT'
      5      and name = 'P1'
      6      and referenced_type = 'TABLE'
      7  /
    REFERENCED_OWNER               REFERENCED_NAME
    SCOTT                          EMP
    SQL> SY.

  • Query for getting all function and procedure inside the packages

    hi All
    Please provide me Query for getting all function and procedure inside the packages
    thanks

    As Todd said, you can use user_arguments data dictionary or you can join user_objects and user_procedures like below to get the name of the packaged function and procedure names.
    If you are looking for the packaged procedures and functions source then use user_source data dictionary
    select a.object_name,a.procedure_name from user_procedures a,
                  user_objects b
    where a.object_name is not null
    and a.procedure_name is not null
    and b.object_type='PACKAGE'        
    and a.object_name=b.object_name

  • 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

  • Function and Procedure

    Hi Friends,
    My Question is : At what time we will use function and Procedure.? How i can prefer it?
    Regards,
    Anu

    Functions are normally used for computations where as procedures
    are normally used for executing business logic.
    there can be many difference between stored procedures and functions
    main are
    1. function can be used in the SQL statements anywhere in the WHERE/HAVING/SELECT section where as Stored procedures cannot be.
    If you have a function in which there are DML statements only then you can not call this function in a SQL query
    for example
    For example, if you have a function that is updating a table, you cannot call that function from a SQL query.
    - select myFunction(field) from sometable; will throw error.
    But you can do it through procedure.
    I hope it is clear

  • Same algorithm in function and procedure then which one will better?

    Why pl sql function is better to computes a value instead of procedure?
    If I apply same algorithm in function and procedure then which one will perform better?

    It's not a matter of performance, it is more a matter of how it is going to be used.
    A function can be used as an expression in an assignment or in a query.
    my_var := my_func(my_param);
    select my_var(my_col) from my_table;But it can just return a single value (which can be a complex value like a nested table or object or ref cursor, but still a single value.)
    The procedure often is more used to perform an action that does not return anything.
    execute_invoicing(my_invoice_id);Or procedures can be used if you need multiple return values.
    my_proc(my_input, my_output_1, my_output_2, my_output_3);But the procedure cannot be used in an assignment expression or a select query.
    Performance wise procedures and functions are completely identical. It is only a matter of what action they perform and how you are going to use them.

  • Calling Oracle function and Procedure using OCCI with in C++ code

    Could any body send me the sample code to create and execute Oracle function and Procedure using OCCI concept in C++?.
    Edited by: 788634 on Aug 16, 2010 4:09 AM

    Hi Vishnu,
    Yes, sure, you can create a PL/SQL procedure, function, package, package body, etc. from within an OCCI application. I would say that, generally, this is not the sort of activity a typical client application would perform unless there is some initialization/installation processes that need to happen. In any case, here is a simple demo showing how to create a stand alone procedure (in a real application I would use a package and body) that returns a ref cursor. The ref cursor is just a simple select of two columns in the hr.countries sample table. Of course, there is no error handling, object orientation, etc. in this demo - I wanted to keep the code as short and as simple as possible to illustrate the concept.
    Regards,
    Mark
    #include <occi.h>
    #include <iostream>
    using namespace std;
    using namespace oracle::occi;
    int main(void)
      // occi variables
      Environment *env;
      Connection  *con;
      Statement   *stmt;
      ResultSet   *rs;
      // database connection information
      string user = "hr";
      string passwd = "hr";
      string db = "orademo";
      // sql to create the procedure which returns a ref cursor as out parameter
      // should be run as hr sample user or in a schema that has select privilege
      // on the hr.countries table and a synonym (countries) that points to the
      // hr.countries table
      string sqlCreate =
        "create or replace procedure get_countries(p_rc out sys_refcursor) as "
        "begin"
        " open p_rc for"
        " select country_id, country_name from countries order by country_name; "
        "end;";
      // pl/sql anonymous block to call the procedure
      string sqlCall = "begin get_countries(:1); end;";
      // create a default environment for this demo
      env = Environment::createEnvironment(Environment::DEFAULT);
      cout << endl;
      // open the connection to the database
      con = env->createConnection(user, passwd, db);
      // display database version
      cout << con->getServerVersion() << endl << endl;
      // create statement object for creating procedure
      stmt = con->createStatement(sqlCreate);
      // create the procedure
      stmt->executeUpdate();
      // terminate the statement object
      con->terminateStatement(stmt);
      // now create new statement object to call procedure
      stmt = con->createStatement(sqlCall);
      // need to register the ref cursor output parameter
      stmt->registerOutParam(1, OCCICURSOR);
      // call the procedure through the anonymous block
      stmt->executeUpdate();
      // get the ref cursor as an occi resultset
      rs = stmt->getCursor(1);
      // loop through the result set
      // and write the values to the console
      while (rs->next())
        cout << rs->getString(1) << ": " << rs->getString(2) << endl;
      // close the result set after looping
      stmt->closeResultSet(rs);
      // terminate the statement object
      con->terminateStatement(stmt);
      // terminate the connection to the database
      env->terminateConnection(con);
      // terminate the environment
      Environment::terminateEnvironment(env);
      // use this as a prompt to keep the console window from
      // closing when run interactively from the IDE
      cout << endl << "ENTER to continue...";
      cin.get();
      return 0;
    }

  • Doubts in Functions and Procedures

    Hi Everybody,
    Can anybody tell the exact differences between function and the Procedure?
    My doubts are
    1. if procedure can return, and not necessary that it has to return a value,(that means if we want to return and doesnt also we can write procedure) then why do we need function?
    2. I tried to call a function which updates one table in the code,, i got an error saying that the function should not use DML.
    3. I want to know the combination that
    a. can procedure call a function and viceversa?
    b. can function (which uses DML statements)be called from sql statement ?
    and if any other combinations are there let me know with reasons.
    Thanks in advance,
    Vinay

    To elaborate on the already correct answers...
    user12281717 wrote:
    Can anybody tell the exact differences between function and the Procedure?
    My doubts are
    1. if procedure can return, and not necessary that it has to return a value,(that means if we want to return and doesnt also we can write procedure) then why do we need function?Procedures and Functions are self contained blocks of executable code. When that code completes it has to "return" to whatever called it, so both Procedures and Functions do return, however a procedure has an implicit return when it reaches the end of the code (or you can specify the keyword RETURN without any value if you like), whereas a function must contain a RETURN keyword before reaching the END keyword and a value of the correct datatype must be returned by that RETURN keyword.
    Functions must return a value, whereas Procedures do not return any value.
    If values need to be passed back from a procedure then OUT or IN OUT parameters are used, however if values are to be passed back then often it is something that should be considered for being a function rather than a procedure.
    Functions may also contain OUT or IN OUT parameters, but these types of parameters limit the function to use within PL/SQL code only and prevent them from being used in SQL, as the SQL engine will have no variable to pass back the OUT value into. Generally it is considered bad practice to use OUT or IN OUT parameters in functions.
    The underlying internal differences of Functions and Procedures comes down to how values are passed in and returned via the internal stack or via memory references where the parameter is specified as an OUT / IN OUT with NOCOPY. If you're not familiar with writing machine code / assembly language or low level C code, then this concept will probably be alien to you and it will take more than a simple post to explain it.
    2. I tried to call a function which updates one table in the code,, i got an error saying that the function should not use DML.Functions can contain DML, but those functions can only be used from a PL/SQL call to it, not from within a call from an SQL DML itself. i.e. a DML cannot contain further DML.

  • Drop  all functions and procedures

    How can I delete all functions and procedures by using Native Dynamic SQL

    Loop against DBA_OBJECTS for the object_type and owner you want to delete.
    For each loop, build your query into a variable, then execute it.
    http://tahiti.oracle.com/pls/db102/drilldown?levelnum=2&toplevel=b14261&method=FULL&chapters=0&book=&wildcards=1&preference=&expand_all=&result_id=1662311&verb=&word=execute+immediate#b14261
    Nicolas.

Maybe you are looking for