Using PL/SQL procedure and function

In a page i have a VO that uses a Where clause that looks like this
WHERE attr=package.function
where the function returns a value of an internal variable valued by another procedure in the package which considers only the Dbuser DBSchema as parameters.
Do i have to call the procedure in a method like initializeBindigsForPage or i have to put it in another place? And in which mode?
Thanks Marco

hi satish,
i tried ur suggestion, but its shows error like
declare
o1 number;
total_bytes number;
o3 number;
unused_bytes number;
o5 number;
o6 number;
o7 number;
b number:=0;
str varchar2(2000);
cursor name is select TNAME FROM TAB WHERE TABTYPE='TABLE';
begin
FOR VAL IN name
LOOP
DBMS_SPACE.UNUSED_SPACE('XMLUSER',VAL.TNAME,'TABLE',o1,total_bytes,o3,unused_bytes,o5,o6,o7);
--dbms_output.put_line(VAL.TNAME);
--dbms_output.put_line(total_bytes);
--dbms_output.put_line(unused_bytes);
EXECUTE IMMEDIATE 'select count(*) from '||VAL.TNAME||' ' RETURNING into b;
--select count(*) into b from VAL.TNAME;
--execute immediate(str);
dbms_output.put_line(b);
insert into space values(VAL.TNAME,total_bytes,unused_bytes,b);
END LOOP;
end;
SQL> @space.sql
declare
ERROR at line 1:
ORA-06547: RETURNING clause must be used with INSERT, UPDATE, or DELETE
statements
ORA-06512: at line 19
wat goes wrong satish?

Similar Messages

  • Are the Pl/sql procedure and function atomic by themself

    i want to ask a question does oracle pl/sql procedure and function support Atomicity for the database by themself , or they became atomic incase we call them using begin -- end;

    You appear to be discussing transaction scope which is completely independent of PL/SQL blocks like procedures or how you call procedures. It's all in where commits (or rollbacks) are issued.
    If you have a procedure like this
    CREATE PROCEDURE p1
    AS
    BEGIN
      INSERT INTO some_table( key, value ) VALUES( 1, 'Foo' );
      INSERT INTO some_table( key, value ) VALUES( 1, 'Bar' );
    END;where the first statement succeeds and the second statement fails as a result of a duplicate key, there will still be a Foo row in the table but the procedure will have thrown an exception. The caller of the procedure may choose to commit or rollback the change-- that will determine whether the first statement's results are made permanent. If you have a procedure like this,
    CREATE PROCEDURE p1
    AS
    BEGIN
      INSERT INTO some_table( key, value ) VALUES( 1, 'Foo' );
      commit;
      INSERT INTO some_table( key, value ) VALUES( 1, 'Bar' );
    END;the commit will make the first insert permanent regardless of whether the second statement fails no matter what the calling code does (that's one reason that putting commits in stored procedures is generally a bad idea-- the caller is in a much better position to know what other uncommitted work has been done and whether it is safe to commit.
    Justin

  • How to test PL/SQL procedures and functions?

    What are the proven ways to test pl/sql procedures and functions? Specifically, procedures and functions that take cursor variables as IN OUT parameter, OR procedure and functions that takes an array as IN parameter?
    Thx.

    HI,
    One way could by using PL/SQL Develper tool, see Tools/Test Manager...
    Also there are others tools, see [Cleaning Up PL/SQL Practices|http://www.oracle.com/technology/oramag/oracle/04-mar/o24tech_plsql.html] and specifically oUnit
    Regards,
    PS: Your question is very general, could you provide an specific example you are trying?
    Edited by: Walter Fernández on Nov 11, 2008 4:04 PM - Adding PS

  • How to insert BLOB datatype image using PL/SQL Procedure and SQL Loader

    Hi,
    How to insert an image into database using PL/SQL Procedure and also how to insert using SQL Loader. Please help by giving sample code and process description.
    Thanks,
    Vijay V

    http://asktom.oracle.com/pls/apex/f?p=100:11:0::::P11_QUESTION_ID:232814159006

  • Passing arrays through multiple PL/SQL procedures and functions

    I am maintaining a large PL/SQL application. There is a main procedure that is initially called which subsequently passes information to other PL/SQL functions and procedures. In the end an error code and string is passed to PUT_LINE so it can be displayed. What I would like to be able to do is have an array that stores an error code and string for each error that it comes upon during going through each of the procedures and functions. This would involve passing these codes and strings from function to function within the pl/sql application. What would be the best way to implement this and is it possible to pass arrrays or records to other PL/SQL functions? Thanks.

    Here is one simulation ->
    satyaki>
    satyaki>select * from v$version;
    BANNER
    Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Prod
    PL/SQL Release 10.2.0.3.0 - Production
    CORE    10.2.0.3.0      Production
    TNS for 32-bit Windows: Version 10.2.0.3.0 - Production
    NLSRTL Version 10.2.0.3.0 - Production
    Elapsed: 00:00:00.20
    satyaki>
    satyaki>
    satyaki>create or replace type n_array is table of number;
      2  /
    Type created.
    Elapsed: 00:00:07.10
    satyaki>
    satyaki>CREATE OR REPLACE PROCEDURE Get_Array(array_in IN n_array,
      2                                        array_out OUT n_array)  
      3  IS
      4  BEGIN 
      5    array_out := n_array(); 
      6    FOR i IN 1..array_in.count 
      7    LOOP 
      8      array_out.extend; 
      9      array_out(i) := array_in(i) * 2; 
    10    END LOOP;
    11  END Get_Array;
    12  /
    Procedure created.
    Elapsed: 00:00:00.89
    satyaki>
    satyaki>
    satyaki>Create or Replace Procedure Set_Array(myArray IN n_array)
      2  is  
      3    i   number(10);  
      4    rec emp%rowtype;  
      5    w n_array:=n_array(1200,3200);
      6    bucket n_array := n_array();
      7  Begin
      8    Get_Array(w,bucket);  
      9   
    10    for i in 1..myArray.count  
    11    loop 
    12      select *  
    13      into rec 
    14      from emp 
    15      where empno = myArray(i); 
    16      dbms_output.put_line('Employee No:'||rec.empno||' Name:'||rec.ename);
    17      for j in 1..bucket.count
    18      loop
    19        dbms_output.put_line('Commission Sub Type: '||bucket(j));
    20      end loop;
    21    end loop; 
    22  End Set_Array;
    23  /
    Procedure created.
    Elapsed: 00:00:01.33
    satyaki>
    satyaki>
    satyaki>select * from emp;
         EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO
          9999 SATYAKI    SLS             7698 02-NOV-08      55000       3455         10
          7777 SOURAV     SLS                  14-SEP-08      45000       3400         10
          7521 WARD       SALESMAN        7698 22-FEB-81       1250        500         30
          7566 JONES      MANAGER         7839 02-APR-81       2975                    20
          7654 MARTIN     SALESMAN        7698 28-SEP-81       1250       1400         30
          7698 BLAKE      MANAGER         7839 01-MAY-81       2850                    30
          7782 CLARK      MANAGER         7839 09-JUN-81       4450                    10
          7788 SCOTT      ANALYST         7566 19-APR-87       3000                    20
          7839 KING       PRESIDENT            17-NOV-81       7000                    10
          7844 TURNER     SALESMAN        7698 08-SEP-81       1500          0         30
          7876 ADAMS      CLERK           7788 23-MAY-87       1100                    20
         EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO
          7900 JAMES      CLERK           7698 03-DEC-81        950                    30
          7902 FORD       ANALYST         7566 03-DEC-81       3000                    20
    13 rows selected.
    Elapsed: 00:00:00.28
    satyaki>
    satyaki>declare
      2    v n_array:=n_array(9999,7777);  
      3  begin  
      4    Set_Array(v);  
      5  end;
      6  /
    Employee No:9999 Name:SATYAKI
    Commission Sub Type: 2400
    Commission Sub Type: 6400
    Employee No:7777 Name:SOURAV
    Commission Sub Type: 2400
    Commission Sub Type: 6400
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:00.15
    satyaki>
    satyaki>Regards.
    Satyaki De.

  • PL-SQL Procedures and Functions

    Hi All,
    while reading about PL-SQL Procedures I came across a concept, which states that we can not include bind or host variables in procedures because the compiler cannot resolve the reference to bind variable.
    Can someone please explain it more elaborately.
    Thank you.

    983037 wrote:
    while reading about PL-SQL Procedures I came across a concept, which states that we can not include bind or host variables in procedures because the compiler cannot resolve the reference to bind variable. Correct. This code cannot compile as it needs a bind variable to be bound:
    create or replace function GetEmpName return varchar2 is
      empName emp.ename%Type;
    begin
      select
        e.ename into empName
      from emp
      where emp_no = :BIND_VARIABLE;
      return( empName );
    end;Stored code cannot include bind variables as how is Oracle's compiler to know the data type of +:BIND_VARIABLE+ - or execute the function at run-time when the code is already compiled, but missing a bind call to supply a value for +:BIND_VARIABLE+ ?
    So the code needs to look as follows instead:
    create or replace function GetEmpName( empID number ) return varchar2 is
      empName emp.ename%Type;
    begin
      select
        e.ename into empName
      from emp
      where emp_no = empID;
      return( empName );
    end;The empID PL/SQL variable will be treated (transparently) as a bind variable when the SQL SELECT statement in that function is parsed and executed as a SQL cursor.
    You as caller, however need to supply bind variables when calling this function from an external client (e.g. SQL*Plus, Java, C/C++, etc). E.g.
    --// using sqlplus as example - create 2 sqlplus host variables
    var name varchar2(100)
    var id number
    --// assign a value to a host variable
    exec :id := 12345;
    --// execute the stored function code binding host variables as bind variables
    begin
      :name := GetEmpName( :id );
    end;
    --// display host variable
    print name

  • How to use pl/sql procedure or function as part of validate the entity obj?

    Hi,
    we are migrating from oracle forms to jdeveloper 11g.
    I have a req. that,i wanted to use oracle pl/sql procedure to validate a attribute in an entity created with ADF BC?
    Is it possible to implement this?
    And how to show the error message from pl/sql procedure?
    Regards
    Murali.

    Hi,
    It is possible by using a method validator for the entity attribute.
    Create a transient attribute 'X'.
    In the validation section of the attribute to be validate, choose method validator.
    In the Error Message tab set error message as {0}.
    Below the value for tokentoken should source.X (X is the transient attribute name)
    In the java code of method validator, call the stored procedure and set the value of transient attribute X with the error message from SP.
    Use setX("ErrorMessage").
    Regards,
    Srinidhi

  • Start one job after another complets using PL/SQL procedure and DBMS_JOB

    All,
    I am attempting to refresh a materialized view using DBMS_JOB and having a PL/SQL program loop through each materialized view name that resides in a table I created. We do the table because they have to be refreshed in a specific order and I utilize the ORDER_OF_REFRESH column to dictate which MV comes first, second, third, etc.
    Now - I have this working to the extent that it kicks off 4 materialized views (currently set the procedure to only do 4 MVs for testing purposes) but I would ultimately like the procedure to create a new DBMS_JOB that calls DBMS_MVIEW.REFRESH of the next view in line ONLY after the preceeding materialized view DBMS_JOB completes.
    The purpose of all of this is to do a few things. One - if I simply create a procedure with the DBMS_MVIEW.REFRESH call to each materialized view in order - that works but if one fails, the job starts over again and will up to 16 times - BIG PROBLEM. Secondly, we want the job that will call this procedure to fail if it encounters 2 failures on any one materialized view (because some MVs may be dependant upon that data and cannot use old stale data).
    This may not be the "best" approach but I am trying to make the job self-sufficient in that it knows when to fail or not, and doesn't kick off the materialized views jobs all at once (remember - they need to start one after the other - in order).
    As you can see near the bottom, my logic doesn't work quite right. It kicks off all four jobs at once with the date of the whatever LAST_REFRESH is in my cursor (which ultimately is from the prior day. What I would like to happen is this:
    1.) 1st MV kicks off as DBMS_JOB and completes
    2.) 2nd MV kicks off with a start time of 3 seconds after the completion of 1st MV (based off LAST_REFRESH) date.
    3.) This conitnues until all MVs are refresh or until 2 failures are encountered, in which no more jobs are scheduled.
    - Obviously I am having a little bit of trouble with #2 and #3 - any help is appreciated.
    CREATE OR REPLACE PROCEDURE Next_Job_Refresh_Test2 IS
    V_FAILURES NUMBER;
    V_JOB_NO NUMBER;
    V_START_DATE DATE := SYSDATE;
    V_NEXT_DATE DATE;
    V_NAME VARCHAR2(30);
    V_DELIMITER VARCHAR2(1);
    CURSOR MV_LIST IS SELECT DISTINCT A.ORDER_OF_REFRESH,
                                  A.MV_OBJECT_NAME
                        FROM CATEBS.DISCO_MV_REFRESH_ORDER A
                        WHERE A.ORDER_OF_REFRESH < 5
                   ORDER BY A.ORDER_OF_REFRESH ASC;
    CURSOR MV_ORDER IS SELECT B.ORDER_OF_REFRESH,
                                  B.MV_OBJECT_NAME,
                                  A.LAST_REFRESH
                             FROM USER_SNAPSHOTS A,
                                  DISCO_MV_REFRESH_ORDER B
                             WHERE A.NAME = B.MV_OBJECT_NAME
                        ORDER BY B.ORDER_OF_REFRESH ASC;
    BEGIN
    FOR I IN MV_LIST
    LOOP
    IF I.ORDER_OF_REFRESH = 1
    THEN V_START_DATE := SYSDATE + (30/86400); -- Start job one minute after execution time
              ELSE V_START_DATE := V_NEXT_DATE;
    END IF;
         V_FAILURES := 0;
         V_JOB_NO := 0;
         V_NAME := I.MV_OBJECT_NAME;
         V_DELIMITER := '''';
    DBMS_JOB.SUBMIT(V_JOB_NO,'DBMS_MVIEW.REFRESH(' || V_DELIMITER || V_NAME || V_DELIMITER || ');',V_START_DATE,NULL);
              SELECT JOB, FAILURES INTO V_JOB_NO, V_FAILURES
              FROM USER_JOBS
              WHERE WHAT LIKE '%' || V_NAME || '%'
              AND SCHEMA_USER = 'CATEBS';
    IF V_FAILURES = 3
    THEN DBMS_JOB.BROKEN(V_JOB_NO,TRUE,NULL); EXIT;
    END IF;
    FOR O IN MV_ORDER
    LOOP
    IF I.ORDER_OF_REFRESH > 2
    THEN V_NEXT_DATE:= (O.LAST_REFRESH + (3/86400)); -- Start next materialized view 3 seconds after completion of prior refresh
    END IF;
    END LOOP;
    END LOOP;
    EXCEPTION
    WHEN NO_DATA_FOUND
         THEN
              IF MV_LIST%ISOPEN
                   THEN CLOSE MV_LIST;
              END IF;
    NULL;
    END Next_Job_Refresh_Test2;
    ---------------------------------------------------------------------------------------------------------------------

    Justin,
    I think I am getting closer. I have a procedure shown just below this that updates my custom table with information from USER_SNAPSHOTS to reflect the time and status of the refresh completion:
    CREATE OR REPLACE PROCEDURE Upd_Disco_Mv_Refresh_Order_Tbl IS
    V_STATUS VARCHAR2(7);
    V_LAST_REFRESH DATE;
    V_MV_NAME VARCHAR2(30);
    CURSOR MV_LIST IS SELECT DISTINCT NAME, LAST_REFRESH, STATUS
                             FROM USER_SNAPSHOTS
                        WHERE OWNER = 'CATEBS';
    BEGIN
    FOR I IN MV_LIST
    LOOP
         V_STATUS := I.STATUS;
         V_LAST_REFRESH := I.LAST_REFRESH;
         V_MV_NAME := I.NAME;
    UPDATE DISCO_MV_REFRESH_ORDER A SET A.LAST_REFRESH = V_LAST_REFRESH
    WHERE A.MV_OBJECT_NAME = V_MV_NAME;
    COMMIT;
    UPDATE DISCO_MV_REFRESH_ORDER A SET A.REFRESH_STATUS = V_STATUS
    WHERE A.MV_OBJECT_NAME = V_MV_NAME;
    COMMIT;
    END LOOP;
    END Upd_Disco_Mv_Refresh_Order_Tbl;
    Next, I have a "new" procedure that does the job creation and refresh show just below this which, when starting the loop, sets the LAST_REFRESH date in my table to NULL and the STATUS = 'INVALID'. Then if the order of refresh = 1 then it uses SYSDATE to submit the job and start right away, else if it's not the first job, it uses V_NEXT_DATE. Now, V_NEXT_DATE is equal to the LAST_REFRESH date from my table when the view has completed and the V_PREV_STATUS = 'VALID'. I think tack on 2 seconds to that to begin my next job.... See code below:
    CREATE OR REPLACE PROCEDURE Disco_Mv_Refresh IS
    V_FAILURES NUMBER;
    V_JOB_NO NUMBER;
    V_START_DATE DATE := SYSDATE;
    V_NEXT_DATE DATE;
    V_NAME VARCHAR2(30);
    V_PREV_STATUS VARCHAR2(7);
    CURSOR MV_LIST IS SELECT DISTINCT A.ORDER_OF_REFRESH,
                                  A.MV_OBJECT_NAME,
                                  A.LAST_REFRESH,
                                  A.REFRESH_STATUS
                        FROM CATEBS.DISCO_MV_REFRESH_ORDER A
                        WHERE A.ORDER_OF_REFRESH <= 5
                   ORDER BY A.ORDER_OF_REFRESH ASC;
    BEGIN
    FOR I IN MV_LIST
    LOOP
    V_NAME := I.MV_OBJECT_NAME;
    V_FAILURES := 0;
    UPDATE DISCO_MV_REFRESH_ORDER SET LAST_REFRESH = NULL WHERE MV_OBJECT_NAME = V_NAME;
    UPDATE DISCO_MV_REFRESH_ORDER SET REFRESH_STATUS = 'INVALID' WHERE MV_OBJECT_NAME = V_NAME;
    IF I.ORDER_OF_REFRESH = 1
    THEN V_START_DATE := SYSDATE;
    ELSE V_START_DATE := V_NEXT_DATE;
    END IF;
    DBMS_JOB.SUBMIT(V_JOB_NO,'DBMS_MVIEW.REFRESH(' || '''' || V_NAME || '''' || '); BEGIN UPD_DISCO_MV_REFRESH_ORDER_TBL; END;',V_START_DATE,NULL);
    SELECT A.REFRESH_STATUS, A.LAST_REFRESH INTO V_PREV_STATUS, V_NEXT_DATE
    FROM DISCO_MV_REFRESH_ORDER A
    WHERE (I.ORDER_OF_REFRESH - 1) = A.ORDER_OF_REFRESH;
    IF I.ORDER_OF_REFRESH > 1 AND V_PREV_STATUS = 'VALID'
    THEN V_NEXT_DATE := V_NEXT_DATE + (2/86400);
    ELSE V_NEXT_DATE := NULL;
    END IF;
    END LOOP;
    EXCEPTION
    WHEN NO_DATA_FOUND
         THEN
              IF MV_LIST%ISOPEN
                   THEN CLOSE MV_LIST;
              END IF;
    NULL;
    END Disco_Mv_Refresh;
    My problem is that it doesn't appear to be looping to the next job. It worked succesfully on the first job but not the subsequent jobs (or materialized views in this case).... Any ideas?

  • How to get a list of values used in the WHERE filter of stored procedures and functions in SQL Server

    How can I get a list of values (one or more) used in the WHERE filter of stored procedures and functions in SQL Server?
    How can get a list of values as shown (highlighted) in the sample stored procedure below?
    ALTER PROC [dbo].[sp_LoanInfo_Data_Extract] AS
    SELECT   [LOAN_ACCT].PROD_DT,
                  [LOAN_ACCT].ACCT_NBR, 
                  [LOAN_NOTE2].OFCR_CD, 
                  [LOAN_NOTE1].CURR_PRIN_BAL_AMT, 
                  [LOAN_NOTE2].BR_NBR,
    INTO #Table1
    FROM
                    dbo.[LOAN_NOTE1],
                    dbo.[LOAN_NOTE2],
                    dbo.[LOAN_ACCT]
    WHERE
                    [LOAN_ACCT].PROD_DT = [LOAN_NOTE1].PROD_DT
                    and
                    [LOAN_ACCT].ACCT_NBR = [LOAN_NOTE1].ACCT_NBR
                    and
                    [LOAN_NOTE1].PROD_DT = [LOAN_NOTE2].PROD_DT
                    and
                    [LOAN_NOTE1].MSTR_ACCT_NBR = [LOAN_NOTE2].MSTR_ACCT_NBR
                    and
                    [LOAN_ACCT].PROD_DT = '2015-03-10'
                    and
                    [LOAN_ACCT].ACCT_STAT_CD IN
    ('A','D')
                    and
                    [LOAN_NOTE2].LOAN_STAT_CD IN
    ('J','Z')
    Lenfinkel

    Hi LenFinkel,
    May I know what is purpose of this requirement, as olaf said,you may parse the T-SQL code (or the execution plan), which is not that easy.
    I have noticed that the condition values in your Stored Procedure(SP) are hard coded and among them there is a date values, I believe some day you may have to alter the SP when the date expires. So why not declare 3 parameters of the SP instead hard coding?
    For multiple values paramter you can use a
    table-valued parameter. Then there's no problem getting the values.
    If you could elaborate your purpose, we may help to find better workaround.
    Eric Zhang
    TechNet Community Support

  • 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

  • Use of Procedure and Functions in ADF BC

    Hi,
    In ADF 11g
    1. can I use oracle function and procedures ( having in and OUT parameters) to expose as service interface
    2. if yes , How can this be done. and what are the allowed data types as input to procedure/function and can be returned by procedure/function
    3. How the transaction control will be achieved using ADF BC service interface.
    E.g. one ADF BC creates orders in order details and second creates Order lines in Order lines table. Now if order is created successfully but line creation fails then I want order to be rolled back also.
    Thanks.

    google it out.
    How to get two out param which is used in Procedure
    http://sameh-nassar.blogspot.in/2010/01/create-plsql-function-and-call-it-from.html
    http://adf-tools.blogspot.in/2010/09/adf-function-call-from-el-statement-in.html
    http://adf-tools.blogspot.in/2010/03/adf-plsql-procedure-or-function-call.html
    http://adfhowto.blogspot.in/2010/11/call-db-procedure-or-function-from-adf.html
    Re: use of Procedure and Functions in ADF BC

  • 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;

  • Call a PL/SQL procedure or function from applet

    Could anyone please let me know how I could call a PL/SQL procedure
    or function from a JDBC method from applet with Internet Explorer?

    It depends from where you are calling your PLSQL routine. If it is SQL*Plus then you can use & (ampersand) with the variable to be input at run time.
    If you are executing the PLSQL routine from another application (some front end application) then it's not possible. Because when a procedure is executing at server side, the front end application does not have control, and the control is only transfered back to front end application when the PLSQL routine either completes successfully or throws an exception.
    In either case, you can not go back to the PLSQL routine.
    In this case, what you can do is, write code in your front end application to get that variable value from user and then pass that value to PLSQL routine.

  • Procedure and function

    hi folks,
               procedure and function are doing a same job then why we using function,please give explanation in real time scenario ...

    When talking about PL/SQL only, everything that can be achieved with a function can also be achieved with a procedure using out parameters, thus you don't really need functions.
    However, a function may be used as a "syntactical convenience" in that you can write expressions like this in your PL/SQL code:
    total_salary := get_total_salary(dept_id => my_dept);
    (assuming you have defined the function get_total_salary).
    You may find this more readable than writing
    get_total_salary(result => total_salary, dept_id => my_dept);
    (assuming you have defined the procedure get_total_salary with an out parameter result).
    This is the same as with e.g. the CASE statement. You don't really need it, every CASE statement might be expressed with IF .. THEN statements as well. However using CASE may be more convenient and make your code more readable. Another example are loops, where you have different flavours, while everything might be expressed using one sort of loops (e.g. WHILE).
    In addition, you may use functions in SQL, while this is not possible with procedures, i.e. after defining some function f, you may write SQL like this:
    select * from t where f(id) = 0;

  • How to find how much memory used by particular procedure or function.

    Hi,
    How can we find out memory used by particular procedure or function?
    If procedure or function is called many times in particular interver, wil it be cached in memory?
    and how will it affect performance?
    what type of pl/sql statement will take more time than normal sql statement?

    Hi
    There are several different memory issues to consider:
    - the code itself (stored in the shared pool)
    - simple variables defined in the code
    - complex variables (eg VARRAY, TABLE etc)
    There's a helpful note on PL/SQL profiling here - http://www.oratechinfo.co.uk/tuning.html - which mentions how to measure memory use (session PGA and UGA - that's program and user global areas)
    You can find out more about shared pool memory structures here - http://download-east.oracle.com/oowsf2005/003wp.pdf.
    Calling a function many times - yes, the function code will be cached (if possible). Session state (for a package) will also be retained (ie global package variables).
    If many users call the same function, there will be one copy of the code but many copies of the private state.
    Finally: PL/SQL statements that can take a long time include:
    - anything that does heavy processing inside a tight loop;
    - anything that waits (select for update; read from a pipe or dequeue from AQ etc)
    Probably the most common mistake is to use PL/SQL for relational processing that can be done from SQL itself (eg writing nested PL/SQL loops to join data that could have been queried in a single SQL statement. Try to minimise context switches between PL/SQL and SQL:
    - use bulk collect where possible
    - use set operations in SQL
    Good luck, HTH
    Regards Nigel

Maybe you are looking for

  • How can I change my iCloud account without my original password?

    How can I Change my iCloud account without having access to my original password?

  • HT4863 iCloud Mail is showing incorrect storage capacity

    My Mailbox is currently showing 3.1 GB capacity, and is causing huge trouble in my iCloud backup and operations in several of my iDevices including my mac. When I open my iCloud account, I've ensured I deleted majority all of my previous email and is

  • Get data from external system

    hi everybody for a report i have to retrieve the data from infotype 0016 from the HR system which is separate from the SAP database. Is there any BAPI which does that or what is the way to proceed never done that before thanks a lot for your help

  • Mass Plant Upload

    Hi Can any one tell me how to upload the Plants in mass? Is there any standard available for this? LSMW and SCAT is not possible as the creation of Plant does not have a transaction code.... Solution is highly appreciated, Thanks and Regards, PKM

  • Help! I deleted favorites folder?

    Hi I'm a new Mac user and it seems my favorites folder has disapeared- the kind with the red heart next to it? How can I get it back if its NOT in my trash? Making a new folder and renaming it "Favorites" doesn't bring back the same functionality as