Dyn proc

Is following procedure valid ?? If not then how and where I can use & in front of variable?
PROCEDURE DYNPROC ( tbl IN varchar2,
col1 IN varchar2,
col2 IN varchar2)
IS
BEGIN
select &col1,&col2 from &tbl;
EXCEPTION
WHEN others THEN
raise ;
END; -- Procedure
null

The & is the default variable substitution character for SQL*PLUS and is not valid in PL/SQL as what you are trying to do.
What are you trying to do?
In SQL*Plus you would use it like this...
Select col1, col2
from table1
where table1_pk = &MyValue;
When you execute this in SQL*Plus it will prompt you and then you can enter a value to substitute MyValue.

Similar Messages

  • If statement in stored proc

    hi
    i have stored proc like this
    ALTER PROCEDURE [dbo].[p_member]
    @MemberID INT = NULL,
    @ID INT = NULL,
    @Type varchar(20) = NULL
    AS
    IF NOT EXISTS (SELECT Memberid FROM Member mcd  JOIN Pro p WITH(NOLOCK)
                   on mcd.ProgramID = p.ProgramID WHERE ((mcd.MemberID = @MemberID) OR (mcd.ID = @ID and p.CD = @Type)))
    BEGIN
               select 'CAN''T BE FOUND'
    END
    i am not sure what i am doing in if statement, its not working.my logic should be like 
    check if atleast on or the other is available ..ie memberid or id+type, if nto i need to print  message.
    thanks

    What do you get for the following:
    DECLARE @MemberID INT = 444,
    @ID INT = NULL,
    @Type varchar(20) = NULL;
    IF NOT EXISTS (SELECT Memberid FROM Member mcd JOIN Pro p WITH(NOLOCK)
    on mcd.ProgramID = p.ProgramID WHERE ((mcd.MemberID = @MemberID) OR (mcd.ID = @ID and p.CD = @Type)))
    BEGIN
    select 'CAN''T BE FOUND'
    END
    ELSE SELECT 'FOUND'
    Kalman Toth Database & OLAP Architect
    Free T-SQL Scripts
    New Book / Kindle: Exam 70-461 Bootcamp: Querying Microsoft SQL Server 2012

  • Error while calling a Db2 stored proc  using Dataservice

    Hi ,
    I am getting the following exception while calling a Db2 proc.The proc is not returning any refcursor.It has one Input param of type String.We are expecting the result in resultset. I am able to call the proc using JDBC function and iterate tru the resultset and print it.
    While doing import the source Metadata , I Added a "Editable Row Set" Type.
    Any clue ?
    ava.lang.RuntimeException: Incorrect definition, too many return resultset
         at com.bea.ld.wrappers.procedure.ProcedureAdapter$CallableWrapper.getNextReturnValue(ProcedureAdapter.java:634)
         at com.bea.ld.wrappers.procedure.ProcedureIterator.getNextToken(ProcedureIterator.java:249)
         at com.bea.ld.wrappers.procedure.ProcedureIterator.fetchNext(ProcedureIterator.java:125)
         at weblogic.xml.query.iterators.GenericIterator.hasNext(GenericIterator.java:134)
         at weblogic.xml.query.runtime.sequences.Subsequence.fetchNext(Subsequence.java:106)
         at weblogic.xml.query.iterators.GenericIterator.next(GenericIterator.java:113)
         at weblogic.xml.query.runtime.querycide.QueryAssassin.fetchNext(QueryAssassin.java:54)
         at weblogic.xml.query.iterators.GenericIterator.peekNext(GenericIterator.java:151)
         at weblogic.xml.query.runtime.qname.InsertNamespaces.fetchNext(InsertNamespaces.java:161)
         at weblogic.xml.query.iterators.GenericIterator.next(GenericIterator.java:113)
         at weblogic.xml.query.runtime.core.QueryIterator.fetchNext(QueryIterator.java:127)
         at weblogic.xml.query.iterators.GenericIterator.hasNext(GenericIterator.java:134)
         at weblogic.xml.query.xdbc.util.Serializer.serializeItems(Serializer.java:142)
         at com.bea.ld.server.QueryInvocation.getResult(QueryInvocation.java:461)
         at com.bea.ld.EJBRequestHandler.executeFunction(EJBRequestHandler.java:346)
         at com.bea.ld.ServerBean.executeFunction(ServerBean.java:108)
         at com.bea.ld.Server_ydm4ie_EOImpl.executeFunction(Server_ydm4ie_EOImpl.java:208)
         at com.bea.ld.Server_ydm4ie_EOImpl_WLSkel.invoke(Unknown Source)
         at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:491)
         at weblogic.rmi.cluster.ReplicaAwareServerRef.invoke(ReplicaAwareServerRef.java:120)
         at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:434)
         at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
         at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:147)
         at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:429)
         at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java:35)
         at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:224)
         at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:183)

    Hi,
    I am trying to do something like this but with Oracle stored procedure which returns an associate array and a cursor and these are defined as INOUT. I am not finding a way how to do it with editable row set. Can you plese list the steps used to make things work.
    Thanks.

  • BugFix for ProC, Oracle 8.0.5 on RedHat 6.0

    BugFix for ProC, Oracle 8.0.5 on RedHat 6.0
    since gcc-2.7.x is not part of RH6.0, the include
    path in the config specs for the pre-processor has
    to be updated. If the include path is not correct,
    any inclusion of stdio.h will produce errors,
    that the pre-processor can not find stdarg.h and
    stddef.h.
    Edmund
    *** precomp/admin/pcscfg.cfg.org Tue Jun 22 12:13:58 1999
    --- precomp/admin/pcscfg.cfg Tue Jun 22 12:15:09 1999
    *** 1,4 ****
    sys_include=($ORACLE_HOME/precomp/public,/usr/lib/gcc-lib/i386-redhat-linux/2.7.2.3/include/,/usr/
    nclude)
    include=($ORACLE_HOME/precomp/public)
    include=$ORACLE_HOME/precomp/hdrs
    include=$ORACLE_HOME/tpcc2x_2/src
    --- 1,4 ----
    sys_include=($ORACLE_HOME/precomp/public,/usr/lib/gcc-lib/i386-glibc20-linux/egcs-2.90.29/include/
    /usr/include)
    include=($ORACLE_HOME/precomp/public)
    include=$ORACLE_HOME/precomp/hdrs
    include=$ORACLE_HOME/tpcc2x_2/src
    null

    I tried it, it worked!
    You have a beer waiting for you in Vancouver BC.
    thewils
    Edmund Mergl (guest) wrote:
    : BugFix for ProC, Oracle 8.0.5 on RedHat 6.0
    : since gcc-2.7.x is not part of RH6.0, the include
    : path in the config specs for the pre-processor has
    : to be updated. If the include path is not correct,
    : any inclusion of stdio.h will produce errors,
    : that the pre-processor can not find stdarg.h and
    : stddef.h.
    : Edmund
    : *** precomp/admin/pcscfg.cfg.org Tue Jun 22 12:13:58
    1999
    : --- precomp/admin/pcscfg.cfg Tue Jun 22 12:15:09 1999
    : *** 1,4 ****
    : sys_include=($ORACLE_HOME/precomp/public,/usr/lib/gcc-lib/i386-
    redhat-linux/2.7.2.3/include/,/usr/include)
    : include=($ORACLE_HOME/precomp/public)
    : include=$ORACLE_HOME/precomp/hdrs
    : include=$ORACLE_HOME/tpcc2x_2/src
    : --- 1,4 ----
    : sys_include=($ORACLE_HOME/precomp/public,/usr/lib/gcc-lib/i386-
    glibc20-linux/egcs-2.90.29/include/,/usr/include)
    : include=($ORACLE_HOME/precomp/public)
    : include=$ORACLE_HOME/precomp/hdrs
    : include=$ORACLE_HOME/tpcc2x_2/src
    null

  • ** How to use TO_DATE function in Stored Proc. for JDBC in ABAP-XSL mapping

    Hi friends,
    I use ABAP-XSL mapping to insert records in Oracle table. My Sender is File and receiver is JDBC. We use Oracle 10g database. All fields in table are VARCHAR2 except one field; this is having type 'DATE'.
    I use Stored procedure to update the records in table. I have converted my string into date using the Oracle TO_DATE function. But, when I use this format, it throws an error in the Receiver CC. (But, the message is processed successfully in SXMB_MONI).
    The input format I formed like below:
    <X_EMP_START_DT hasQuot="No" isInput="1" type="DATE">
    Value in Payload is like below.
    <X_EMP_START_DT hasQuot="No" isInput="1" type="DATE">TO_DATE('18-11-1991','DD-MM-YYYY')</X_EMP_START_DT>
    Error in CC comes as below:
    Error processing request in sax parser: Error when executing statement for table/stored proc. 'SP_EMP_DETAILS' (structure 'STATEMENT'): java.lang.NumberFormatException: For input string: "TO_DATE('18"
    Friends, I have tried, but unable to find the correct solution to insert.
    Kindly help me to solve this issue.
    Kind Regards,
    Jegathees P.
    (But, the same is working fine if we use direct method in ABAP-XSL ie. not thru Stored Procedure)

    Hi Sinha,
    Thanks for your reply.
    I used the syntax
    <xsl:call-template name="date:format-date">
       <xsl:with-param name="date-time" select="string" />
       <xsl:with-param name="pattern" select="string" />
    </xsl:call-template>
    in my Abap XSL.  But, its not working correctly. The problem is 'href' function to import "date.xsl" in my XSLT is not able to do that. The system throws an error. Moreover, it is not able to write the command 'extension-element-prefixes' in my <xsl:stylesheet namespace>
    May be I am not able to understand how to use this.
    Anyway, I solved this problem by handling date conversion inside Oracle Stored Procedure. Now, its working fine.
    Thank you.

  • Replacing null values in optional prompts and passing to stored proc

    Hi,
    I want to create a stored procedure with OPTIONAL prompts. When user does not pass a value for that parameter, I want to set the value for that parameter by selecting from a column in table then I WANT to use that paramvalue in sql within cursor of stored proc. How do I do that?
    In short, I want to do the following Here is the psuedocode:
    Create or replace procedure test (param IN varchar2 DEFAULT NULL)
    As
    var_param varchar(20);
    select param into var_param from dual;
    If param is null then select custid from table1 else var_param
    OPen ref_cursor for
    Select xyz from table2
    where fyy = var_para
    Can someone let me know the syntax on how to do this in stored proc?
    Regards,
    hena
    Edited by: 904385 on Dec 25, 2011 7:04 AM

    Hi,
    Merry Christmas, and welcome to the forum!
    Here's one way to do what you requested:
    CREATE OR REPLACE PROCEDURE     test
    (    param     IN     VARCHAR2     DEFAULT     NULL
    AS
        ref_cursor     SYS_REFCURSOR;
        var_param     VARCHAR2 (20)     := param;
    BEGIN
        IF  var_param  IS NULL
        THEN
         SELECT     custid
         INTO     var_param
         FROM     table1
    --     WHERE     ...     -- Unless table1 has only 1 row
        END IF;
        OPEN  ref_cursor
        FOR   SELECT  xyz
           FROM       table2
           WHERE       fyy     = var_param;
    END     test;Whatever you're trying to do, this is probably niot the simplest or most efficient way to do it.

  • Text/Caption in Web Dyn Pro? (Newline possible?)

    Is it possible to add a new line for text in caption in web dyn pro?
    In Java, I tried storing the string as "Result.\nPass" but it seems when being displayed, the new line is not shown but it is only shown in one whole line.
    Any advise?

    Hi
    Good problem is solved.
    Your question usage of setLabel? What label is being set when you refer to "currentContextElement()" ?
    1Actually for your concern I did one test in my NWDS ,Its a wrong naming convention thats why u confused.
    (instead of label i have to use say InputCaption because label is standard used by framework or its common )
    2. I have created one context attribute named label and one UI of TextView ,associated its value property to
        this context.
    and accessed this through currentContextElement()
    Best Regards
    Satish Kumar

  • Which Mac Pro? More cores=slower speeds? And most of us know the speed matters or FPU for music and I don't understand the faster is for the least amount of procs. And while I get the whole rendering thing and why it makes sense.

    Which Mac Pro? More cores=slower speeds? And most of us know the speed matters or FPU for music and I don't understand the faster is for the least amount of procs. And while I get the whole rendering thing and why it makes sense.
    The above is what the bar says. It's been a while and wondered, maybe Apple changed the format for forums. Then got this nice big blank canvas to air my concerns. Went to school for Computer Science, BSEE, even worked at Analog Devices in Newton Massachusetts, where they make something for apple. 
    The bottom line is fast CPU = more FPU = more headroom and still can't figure out why the more cores= the slower it gets unless it's to get us in to a 6 core then come out with faster cores down the road or a newer Mac that uses the GPU. Also. Few. I'm the guy who said a few years ago Mac has an FCP that looks like iMovie on Steroids. Having said that I called the campus one day to ask them something and while I used to work for Apple, I think she thought I still did as she asked me, "HOW ARE THE 32 CORES/1DYE COMING ALONG? Not wanting to embarrass her I said fine, fine and then hung up.  Makes the most sense as I never quite got the 2,6,12 cores when for years everything from memory to CPU's have been, in sets of 2 to the 2nd power.  2,4,8,16,32,64,120,256,512, 1024, 2048,4196,8192, 72,768.  Wow. W-O-W and will be using whatever I get with Apollo Quad. 
    Peace to all and hope someone can point us in THE RIGHT DIRECTION.  THANK YOU

    Thanks for your reply via email/msg. He wrote:
    If you are interested in the actual design data for the Xeon processor, go to the Intel site and the actual CPU part numbers are:
    Xeon 4 core - E5.1620v2
    Xeon 6 core - E5.1650v2
    Xeon 8 core - E5.1680v2
    Xeon 12 core - E5.2697v2
    I read that the CPU is easy to swap out but am sure something goes wrong at a certain point - even if solderedon they make material to absorb the solder, making your work area VERY clean.
    My Question now is this, get an 8 core, then replace with 2 3.7 QUAD CHIPS, what would happen?
    I also noticed that the 8 core Mac Pro is 3.0 when in fact they do have a 3.4 8 core chip, so 2 =16? Or if correct, wouldn't you be able to replace a QUAD CHIP WITH THAT?  I;M SURE THEY ARE UO TO SOMETHING AS 1) WE HAVE SEEN NO AUDIO FPU OR PERHAPS I SHOULD CHECK OUT PC MAKERS WINDOWS machines for Sisoft Sandra "B-E-N-C-H-M-A-R-K-S" -
    SOMETHINGS UP AND AM SURE WE'LL ALL BE PLEASED, AS the mac pro      was announced Last year, barely made the December mark, then pushed to January, then February and now April.
    Would rather wait and have it done correct than released to early only to have it benchmarked in audio and found to be slower in a few areas- - - the logical part of my brain is wondering what else I would have to swap out as I am sure it would run, and fine for a while, then, poof....
    PEACE===AM SURE APPLE WILL BLOW US AWAY - they have to figure out how to increase the power for 150 watts or make the GPU work which in regard to FPU, I thought was NVIDIA?

  • CONFIRMATION OF PROCES ORDER

    What do we confirm during confirmation of proces order?

    Hi,
    Transaction CORK is used for confirmation of process order.
    Pl. refer,
    http://help.sap.com/saphelp_46c/helpdata/en/05/603bc6462311d182b50000e829fbfe/frameset.htm
    Goto Process order>Completion confirmation of process order
    Regards,
    Senthilkumar

  • Passing sysdate in milliseconds from OAF page to PL/Sql proc

    Hi All,
    I have a requirement wherein I need to pass SYSDATE in milliseconds from OAF page to the PL/SQL package.
    Basically I will be calling a PL/SQL api from AM . So here I need to pass SYSDATE in milliseconds as one of the PL/SQL proc parameters.
    How do you I go about this ?
    Any help is aprreciated.
    Thanks in Advance

    get the current database date by
    oracle.sql.date currentDate=OADBTransaction's method getCurrenctDBDate ()
    (OADBTransaction object can be obtained from AM Object itself).
    Now you may convert this currentDate to java date object.
    currentDateObjAsJavaDate=currentDate.toDate()
    now miliseconds (since1970, I remember so, please see documentation) =currentDateObjAsJavaDate.getTime();

  • Concurrent HOST program calling a proc to log using fnd_file.put_line

    Hello all,
    I have a concurrent HOST program that does 3 main things
    1. Calls a sqlplus program to do some initializing. This program is a proc in a package.
    2. Runs sqlldr to load data to custom tables.
    3. Calls a sqlplus program to do manipulate the data. This program is a proc in a package.
    In step 3 of above, the package procedue does a "submit_request" to call the "Supplier Open Interface Import". This
    request actually fires. However my problem is the subsequent call to fnd_file.put_line(fnd_file.log, 'Test message'), does not get logged
    to the log file of the HOST program, nor to the log file of the "Supplier Open Interfface Import" log file. A check
    of $APPLPTMP (or /usr/tmp) shows that a file of say " l0023761.tmp" contains my 'Test message' text.
    I believe the problem is that the put_line() call has no association with the HOST or the "Supplier Open Interface Import. How
    do I associate the logging to either program? Is it even possible? I want the logging, so as to see the progress
    of the HOST program.
    The sniippet of proc code is:
    PROCEDURE abc() IS
    BEGIN
    request_id:= FND_REQUEST.SUBMIT_REQUEST
    (Application => 'SQLAP'
    ,Program => 'APXSUIMP'
    ,Description => NULL
    ,Start_time => SYSDATE
    ,Sub_Request => FALSE
    ,Argument1 => 'ALL'
    ,Argument2 => 1000
    ,Argument3 => 'N'
    ,Argument4 => 'N'
    ,Argument5 => 'N'
    fnd_file.put_line (fnd_file.log,'Test message');
    COMMIT;
    END abc;
    Alex.

    Shell scripts are very hard to develop and maintain. Many things that developers previously had to do in shell scripts, developers can now do in PL/SQL. Hence, I recommend that you avoid shell scripts as much as possible.
    As well, SQL*Loader is an old, inflexible tool. Instead, define your OS file as an external table, and then extract from the external table using a normal select statement. http://www.orafaq.com/node/848 I recommend that you avoid SQL*Loader and use external tables instead.
    Using PL/SQL and external tables - and avoiding the shell script and SQL*Loader - a much better way to accomplish the same thing all inside one packaged procedure that is registered as a concurrent program:
    - initialize
    - select from the external table
    - manipulate the data

  • How to pass a structure in PL/SQL external proc.

    This is for educational purpose only. I am trying to implement kernel32.dll and shell32.dll in PL/SQL using external proc. Everything is working fine, except When there is a structure in OUT parameter.
    My database version.
    SQL> 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 - ProductionI have set up the listner.ora and tnsnames.ora and written a package called dbms_kernel32sb.
    There are 9 program units.
    1. CreateFile -- working fine
    2. CloseFile -- working fine
    3. GetSize -- working fine
    4. FindFirstFile -- NOT working, because one OUT parameter has the structure type WIN32_FIND_DATA.
    5. GetFileTime -- NOT working, because one OUT parameter has the structure type FILETIME
    6. GetDiskFreeSpace -- working fine
    7. GetDriveType -- working fine.
    8. GetLastError -- working fine
    9. ExecuteCommand -- working fine.
    Here is the package specification:
    CREATE OR REPLACE PACKAGE dbms_kernel32sb AS
        Name: dbms_kernel32sb.pks
        Author: Saubhik Banerjee
        Date: 24th Jan 2011
        Version: 1.0
        Comment: This package is to implement some functionality from kernel32.dll.
                 Usng extproc
    OPEN_EXISTING_FILE CONSTANT PLS_INTEGER :=3;
    FILE_ATTRIBUTE_NORMAL CONSTANT PLS_INTEGER :=128;
    DISABLE_FILE_SHARE_MODE CONSTANT PLS_INTEGER :=0;
    NO_FILE_SECURITY_ATTRIBUTE CONSTANT PLS_INTEGER :=0;
    NO_TEMPLATE_FILE CONSTANT PLS_INTEGER :=0;
    GENERIC_FILE_ACCESS CONSTANT PLS_INTEGER :=0;
    FILE_SIZE_HIGH CONSTANT PLS_INTEGER :=400000000;
    EXECUTE_FILE CONSTANT VARCHAR2(4):='open';
    PRINT_FILE CONSTANT VARCHAR2(5):='print';
    NO_PARAMATER CONSTANT VARCHAR2(2):=' ';
    FUNCTION CreateFile(pi_FileName VARCHAR2 --1, File name
                ,pi_DesiredAccess BINARY_INTEGER --2, Type of access required (read/write ect)
                ,pi_ShareMode BINARY_INTEGER --3,  share mode
                ,pi_SecurityAttributes BINARY_INTEGER --4, securoty attribute
                ,pi_CreationDisposition BINARY_INTEGER --5, open existing, create new etc
                ,pi_FlagsAndAttributes BINARY_INTEGER --6, File attribute- normal
                ,pi_TemplateFile BINARY_INTEGER) --Not required.
        Return BINARY_INTEGER;
    FUNCTION CloseFile (pi_FileHandle BINARY_INTEGER)
                         Return BINARY_INTEGER;
    FUNCTION GetSize (pi_FileHandle BINARY_INTEGER,
                       pio_FileSizeHigh IN OUT BINARY_INTEGER)
                   RETURN BINARY_INTEGER;
    FUNCTION FindFirstFile ( pi_FileName VARCHAR2
                             ,pio_Win32_Find_data OUT 
                                 WIN32_FIND_DATA
    RETURN BINARY_INTEGER;                                             
    FUNCTION GetFileTime ( pi_FileHandle BINARY_INTEGER
                           ,pio_FileCreationTime IN OUT FILETIME
                           ,pio_LastAccessTime   IN OUT FILETIME
                           ,pio_LastWriteTime    IN OUT FILETIME
    RETURN BINARY_INTEGER;
    FUNCTION GetDiskFreeSpace ( pi_RootPathName VARCHAR2
                                ,pio_SectorsPerCluster  OUT BINARY_INTEGER
                                ,pio_BytesPerSector   OUT BINARY_INTEGER
                                ,pio_NumberOfFreeClusters  OUT BINARY_INTEGER
                                ,pio_TotalNumberOfClusters  OUT BINARY_INTEGER
    RETURN BINARY_INTEGER;    
    FUNCTION GetDriveType( pi_driveLetter VARCHAR2) RETURN VARCHAR2;
    FUNCTION GetLastError RETURN BINARY_INTEGER;   
    FUNCTION ExecuteCommand ( pi_OperationType VARCHAR2
                              ,pi_FileName VARCHAR2
                              ,pi_Parameters VARCHAR2
                              ,pi_DefaultDirectory VARCHAR2
    RETURN VARCHAR2;
    END dbms_kernel32sb;
    Here is the package body:
    CREATE OR REPLACE PACKAGE BODY dbms_kernel32sb AS
    /* Name: dbms_kernel32sb.pkb
        Author: Saubhik Banerjee
        Date: 24th Jan 2011
        Version: 1.0
        Comment: This package is to implement some functionality from kernel32.dll.
                 Usng extproc
      FUNCTION
      CreateFile( pi_FileName VARCHAR2 --1
                , pi_DesiredAccess BINARY_INTEGER --2
                , pi_ShareMode BINARY_INTEGER --3
                , pi_SecurityAttributes BINARY_INTEGER --4
                , pi_CreationDisposition BINARY_INTEGER --5
                , pi_FlagsAndAttributes BINARY_INTEGER --6
                , pi_TemplateFile BINARY_INTEGER) --7
        Return BINARY_INTEGER IS EXTERNAL LIBRARY kernel32 Name "CreateFileA"
        PARAMETERS(  pi_FileName STRING
                   , pi_DesiredAccess long
                   , pi_ShareMode long
                   , pi_SecurityAttributes long
                   , pi_CreationDisposition long
                   , pi_FlagsAndAttributes long
                   , pi_TemplateFile long
                   , return long);
    FUNCTION CloseFile (pi_FileHandle BINARY_INTEGER)
                         Return BINARY_INTEGER
         IS EXTERNAL
         LIBRARY kernel32 Name "CloseHandle"
         PARAMETERS (pi_FileHandle long, return long);
    FUNCTION GetSize (pi_FileHandle BINARY_INTEGER,
                       pio_FileSizeHigh IN OUT BINARY_INTEGER)
                   RETURN BINARY_INTEGER
         IS EXTERNAL
        LIBRARY kernel32 NAME "GetFileSize"
        PARAMETERS (pi_FileHandle long, pio_FileSizeHigh long, return long );
      FUNCTION GetFileTime ( pi_FileHandle BINARY_INTEGER
                           ,pio_FileCreationTime IN OUT FILETIME
                           ,pio_LastAccessTime   IN OUT FILETIME
                           ,pio_LastWriteTime    IN OUT FILETIME
       RETURN BINARY_INTEGER
         IS EXTERNAL
        LIBRARY kernel32 NAME "GetFileTime"
        WITH CONTEXT
        PARAMETERS ( CONTEXT,
                      pi_FileHandle long
                    , pio_FileCreationTime  OCIColl
                    , pio_FileCreationTime INDICATOR SHORT
                    , pio_LastAccessTime  OCIColl
                   , pio_LastAccessTime INDICATOR SHORT
                    , pio_LastWriteTime OCIColl
                    , pio_LastWriteTime INDICATOR SHORT
                    , return long );                  
    FUNCTION FindFirstFile ( pi_FileName VARCHAR2
                             ,pio_Win32_Find_data OUT 
                                 WIN32_FIND_DATA
    RETURN BINARY_INTEGER
    IS EXTERNAL
        LIBRARY kernel32 NAME "FindFirstFileA"
        --WITH CONTEXT
        PARAMETERS
                    ( --CONTEXT,
                     pi_FileName STRING--, pi_FileName INDICATOR SHORT
                    , pio_Win32_Find_data  BY REFERENCE OCIColl--,pio_Win32_Find_data INDICATOR long
                    , return long );
    FUNCTION GetDiskFreeSpace ( pi_RootPathName VARCHAR2
                                ,pio_SectorsPerCluster  OUT BINARY_INTEGER
                                ,pio_BytesPerSector   OUT BINARY_INTEGER
                                ,pio_NumberOfFreeClusters  OUT BINARY_INTEGER
                                ,pio_TotalNumberOfClusters  OUT BINARY_INTEGER
    RETURN BINARY_INTEGER
      IS EXTERNAL
        LIBRARY kernel32 NAME "GetDiskFreeSpaceA"
        PARAMETERS (  pi_RootPathName STRING
                    , pio_SectorsPerCluster BY REFERENCE long
                    , pio_BytesPerSector BY REFERENCE long
                    , pio_NumberOfFreeClusters BY REFERENCE long
                    , pio_TotalNumberOfClusters BY REFERENCE long
                    , return long );   
      FUNCTION GetDriveTypeA( pi_driveLetter VARCHAR2) RETURN BINARY_INTEGER   
      IS EXTERNAL
      LIBRARY kernel32 NAME "GetDriveTypeA"
      PARAMETERS (pi_driveLetter STRING, RETURN long);
    FUNCTION GetDriveType( pi_driveLetter VARCHAR2) RETURN VARCHAR2 IS
    BEGIN
      CASE  GetDriveTypeA(pi_driveLetter) 
       WHEN 2 THEN RETURN 'Removable';
       WHEN 3 THEN RETURN 'Drive Fixed';
       WHEN 4 THEN RETURN 'Remote';
       WHEN 5 THEN RETURN 'Cd-Rom';
       WHEN 6 THEN RETURN 'Ram disk';
       ELSE RETURN 'Unrecognized';
    END CASE;                              
    END;
    FUNCTION GetLastError  RETURN BINARY_INTEGER
    IS EXTERNAL
    LIBRARY kernel32 NAME "GetLastError"
    PARAMETERS (return long);
    FUNCTION ShellExecute( pi_Hwnd BINARY_INTEGER
                          ,pi_Operation VARCHAR2
                          ,pi_FileName VARCHAR2
                          ,pi_Parameters VARCHAR2
                          ,pi_DefaultDirectory  VARCHAR2
                          ,pi_ShowCmd BINARY_INTEGER
                          ) RETURN BINARY_INTEGER
    IS EXTERNAL
    LIBRARY SHELL32 NAME "ShellExecuteA"
    PARAMETERS (pi_Hwnd long,pi_Operation STRING,pi_FileName STRING
                 ,pi_Parameters STRING,pi_DefaultDirectory STRING
                 ,pi_ShowCmd long, return long
    FUNCTION ExecuteCommand ( pi_OperationType VARCHAR2
                              ,pi_FileName VARCHAR2
                              ,pi_Parameters VARCHAR2
                              ,pi_DefaultDirectory VARCHAR2
    RETURN VARCHAR2 IS
      v_return_val BINARY_INTEGER;
    BEGIN
      v_return_val:= ShellExecute(0,pi_OperationType
                                 ,pi_FileName,pi_Parameters
                                 ,pi_DefaultDirectory,0
      IF v_return_val <=32 THEN
       RETURN 'Error!';
      ELSE RETURN 'Success!';
      END IF;
    END;
    END dbms_kernel32sb;
    Now the working demos:
    SQL> SET SERVEROUT ON
    SQL> /* Demo I:- How to obtain file size */
    SQL> DECLARE
      2    v_FileSize BINARY_INTEGER;
      3    v_FileSizeHigh PLS_INTEGER;
      4    v_FileHandle BINARY_INTEGER;
      5    v_filename VARCHAR2(500) :='C:\test2.csv';
      6    v_dummy BINARY_INTEGER;
      7  BEGIN
      8    v_FileSizeHigh := DBMS_KERNEL32SB.FILE_SIZE_HIGH;
      9    v_FileHandle:=DBMS_KERNEL32SB.CreateFile(v_filename -- File name
    10                            ,DBMS_KERNEL32SB.GENERIC_FILE_ACCESS
    11                            ,DBMS_KERNEL32SB.DISABLE_FILE_SHARE_MODE
    12                            ,DBMS_KERNEL32SB.NO_FILE_SECURITY_ATTRIBUT
    13                            ,DBMS_KERNEL32SB.OPEN_EXISTING_FILE
    14                            ,DBMS_KERNEL32SB.FILE_ATTRIBUTE_NORMAL
    15                            ,DBMS_KERNEL32SB.NO_TEMPLATE_FILE);
    16   v_FileSize := DBMS_KERNEL32SB.Getsize(v_FileHandle, v_FileSizeHigh)
    17   DBMS_OUTPUT.put_line('File Size in Bytes: ' ||v_FileSize);
    18   v_dummy:=DBMS_KERNEL32SB.CloseFile(v_FileHandle);
    19  END;
    20  /
    File Size in Bytes: 61
    PL/SQL procedure successfully completed.
    SQL>
    SQL> /* Demo II:- How to find free disk space  */
    SQL> DECLARE
      2    v_rootpath VARCHAR2(500) :='C:\';
      3    v_dummy BINARY_INTEGER;
      4    v_sectorspercluster BINARY_INTEGER;
      5    v_bytespersector BINARY_INTEGER;
      6    v_numberoffreeclusters BINARY_INTEGER;
      7    v_totalnumberofclusters BINARY_INTEGER;
      8    v_freespace NUMBER;
      9    v_totalspace NUMBER;
    10  BEGIN
    11    v_dummy:=DBMS_KERNEL32SB.GetDiskFreeSpace(v_rootpath
    12                                              ,v_sectorspercluster
    13                                              ,v_bytespersector
    14                                              ,v_numberoffreeclusters
    15                                              ,v_totalnumberofclusters
    16                                              );
    17                                              
    18    DBMS_OUTPUT.put_line('Sector pre Cluster: ' ||v_sectorspercluster);
    19    DBMS_OUTPUT.put_line('Bytes per sector: ' ||v_bytespersector);
    20    DBMS_OUTPUT.put_line('Number Of Free Clusters: ' ||v_numberoffreeclusters);
    21    DBMS_OUTPUT.put_line('Total Number Of Clusters: ' ||v_totalnumberofclusters);
    22    v_freespace:=v_numberoffreeclusters/1024/1024/1024;
    23    v_freespace:=ROUND(v_freespace*v_sectorspercluster*v_bytespersector,3);
    24    v_totalspace:=v_totalnumberofclusters/1024/1024/1024;
    25    v_totalspace:=ROUND(v_totalspace*v_sectorspercluster*v_bytespersector,3);
    26    DBMS_OUTPUT.put_line('Total Space (GB):' ||v_totalspace);
    27    DBMS_OUTPUT.put_line('Total number of Free space (GB): '||v_freespace );
    28  END;
    29  /
    Sector pre Cluster: 8
    Bytes per sector: 512
    Number Of Free Clusters: 739477
    Total Number Of Clusters: 9765622
    Total Space (GB):37.253
    Total number of Free space (GB): 2.821
    PL/SQL procedure successfully completed.
    SQL>
    SQL> /* Demo IV:- How to get drive type*/
    SQL> SELECT dbms_kernel32sb.GetDriveType('C:\') FROM dual;
    DBMS_KERNEL32SB.GETDRIVETYPE('C:\')
    Drive Fixed
    SQL> SELECT dbms_kernel32sb.GetDriveType('D:\') FROM dual;
    DBMS_KERNEL32SB.GETDRIVETYPE('D:\')
    Cd-Rom
    SQL> SELECT dbms_kernel32sb.GetDriveType('E:\') FROM dual;
    DBMS_KERNEL32SB.GETDRIVETYPE('E:\')
    Unrecognized
    SQL>
    SQL> /* Demo V:- How to execute an Operating System Command*/
    SQL> DECLARE
      2   v_FileToExecute VARCHAR2(20):='test.bat';
      3   v_Parameter VARCHAR2(20):='test1.csv';--dbms_kernel32sb.NO_PARAMATER
      4   v_DefaultDirectory VARCHAR2(20):='C:\';
      5   v_ReturnValue VARCHAR2(20);
      6  BEGIN
      7    v_ReturnValue:=dbms_kernel32sb.ExecuteCommand(dbms_kernel32sb.EXECUTE_FILE
      8                                                  ,v_FileToExecute
      9                                                  ,v_Parameter
    10                                                  ,v_DefaultDirectory
    11                                                  );
    12   DBMS_OUTPUT.put_line('Status: '||v_ReturnValue);                               
    13  END;
    14  /
    Status: Success!
    PL/SQL procedure successfully completed.
    SQL> Now the sub programs with structures are NOT getting called successfully.
    SQL> /* Demo III:- How to obtain file time */
    SQL> DECLARE
      2    v_FileHandle BINARY_INTEGER;
      3    v_filename VARCHAR2(500) :='C:\test2.csv';
      4    v_dummy BINARY_INTEGER;
      5    v_filecreationtime FILETIME;
      6    v_lastaccesstime FILETIME;
      7    v_lastwritetime FILETIME;
      8    v_err BINARY_INTEGER;
      9  BEGIN
    10    v_FileHandle:=DBMS_KERNEL32SB.CreateFile(v_filename -- File name
    11                            ,DBMS_KERNEL32SB.GENERIC_FILE_ACCESS
    12                            ,DBMS_KERNEL32SB.DISABLE_FILE_SHARE_MODE
    13                            ,DBMS_KERNEL32SB.NO_FILE_SECURITY_ATTRIBUTE
    14                            ,DBMS_KERNEL32SB.OPEN_EXISTING_FILE
    15                            ,DBMS_KERNEL32SB.FILE_ATTRIBUTE_NORMAL
    16                            ,DBMS_KERNEL32SB.NO_TEMPLATE_FILE);
    17   v_dummy := DBMS_KERNEL32SB.GetFileTime( v_FileHandle
    18                                          ,v_filecreationtime
    19                                          ,v_lastaccesstime
    20                                          ,v_lastwritetime
    21                                          );
    22   v_err:=DBMS_KERNEL32SB.GetLastError;                                
    23   DBMS_OUTPUT.put_line('File Size in Bytes: ' ||v_dummy);
    24   DBMS_OUTPUT.put_line('Error:'||v_err);
    25   v_dummy:=DBMS_KERNEL32SB.CloseFile(v_FileHandle);
    26  END;
    27  /
    File Size in Bytes: 0
    Error:203
    PL/SQL procedure successfully completed.
    SQL> So, I have noticed that, Where ever a STRUCTURE is involved in external routine, there is a problem. I want to know, How to implement functions with STRUCTURE as OUT parameter.
    Forgot to mention: This is my FILETIME object which corresponds to FILETIME structure of win32.
    CREATE OR REPLACE TYPE FILETIME_rec IS OBJECT
                              ( LowDateTime NUMBER
                               ,HighDateTime NUMBER
    CREATE OR REPLACE TYPE FILETIME IS TABLE OF  FILETIME_rec;Edited by: Saubhik on Feb 1, 2011 4:15 PM

    Saubhik wrote:
    This is for educational purpose only. I am trying to implement kernel32.dll and shell32.dll in PL/SQL using external proc. Interesting. Familiar with the Wn32 API, but do not run Oracle on Windows and never looked at this aspect of integration.
    So, I have noticed that, Where ever a STRUCTURE is involved in external routine, there is a problem. I want to know, How to implement functions with STRUCTURE as OUT parameter.
    Forgot to mention: This is my FILETIME object which corresponds to FILETIME structure of win32.The problem is that this passes the parameter by reference and not value. In a vanilla C/C++/Delphi program, you will create a variable of that struct and then pass a long pointer to that variable when making the API call. That pointer will be dereferenced and the memory it points to, populated. This is not a problem as the underlying DLL you call that does this, uses your process's data segment.
    Extproc is different. In order to protect the integrity of the database server process, an external call is done by a "proxy" process. It acts as the interface between your PL/SQL code and the actual external call.
    In this case, this "proxy" process will be doing the implicit LoadLibrary() call to load kernel32.dll interface - and the DLL will expect to dereference and access this process's memory struct to populate it. This "proxy" process in turn needs to know that despite it calling the interface by reference, it needs to return that parameter to PL/SQL by value - as your PL/SQL code cannot dereference a pointer passed back by that "proxy" process and access its memory to gain access to that struct.
    In basic terms - that argument is a 32 bit number containing a pointer. That is what the "proxy" process needs to pass to the interface call. Your code is passing a struct and not a pointer, right?
    And that is the basic problem I believe. How to address this.. not sure. You can have your own DLL as interface that does not use pointers but expect arguments to be passed by value. But this will suck as you then need to include a custom DLL to deploy and have PL/SQL call that, instead of simply accessing and calling the native kernel interface.
    Doubt that many Win32 programmers with OCI (Oracle Call Interface) frequents this forum. So perhaps this is not the best place to ask. I would be hitting Metalink (support.oracle.com) search function in your sho3s though as there should be support notes dealing with this subject matter.

  • Oracle Proc in edmx via add function import is not working

    I have a mandate to call a external oracle package from my local oracle db proc using Entity Framework. I have created a synonym for that. When I am trying to polpulate the oracle procedure data in my mvc screen using odp.net. The screen is closing automatically when I am trying to retive the column info by clicking "get column information" under "Add Function Import" in model browser.
    Following is my code snipet
    1. created a oracle stored proc to call the external proc
    CREATE OR REPLACE PROCEDURE USP_GET_DETAILS
    IN_ID IN NUMBER,
    OUT_RESULT OUT SYS_REFCURSOR
    IS
    OUT_FED_TAX_ID_NO VARCHAR2(50);
    OUT_PARTY_ID_NO NUMBER;
    OUT_PARTY_TYP_CD NUMBER;
    BEGIN
    PKG_GET_DETAILS.USP_GET_DETAILS_INFO (IN_ID, OUT_FED_TAX_ID_NO, OUT_PARTY_ID_NO);
    OPEN OUT_RESULT FOR
         SELECT OUT_FED_TAX_ID_NO, OUT_PARTY_ID_NO FROM DUAL;
    END USP_GET_DETAILS;
    2. added the proc "USP_GET_DETAILS" using "Update model using database" in my edmx file
    3. Now proc has been added to my edmx file under SSDL
    <Function Name="USP_GET_DETAILS" Aggregate="false" BuiltIn="false" NiladicFunction="false" IsComposable="false" ParameterTypeSemantics="AllowImplicitConversion" Schema="BCS_OWNER">
    <Parameter Name="IN_ID" Type="number" Mode="In" />
    </Function>
    4. added following code to my web.config file
    <oracle.dataaccess.client>
    <settings>
    <add name="BCS_OWNER.USP_GET_DETAILS.RefCursor.OUT_RESULT" value="implicitRefCursor bindinfo='mode=Output'" />
    <add name="BCS_OWNER.USP_GET_DETAILS.RefCursorMetaData.OUT_RESULT.Column.0" value="implicitRefCursor metadata='ColumnName=OUT_FED_TAX_ID_NO;NATIVEDATATYPE=Varchar2;ProviderType=Varchar2'" />
    <add name="BCS_OWNER.USP_GET_DETAILS.RefCursorMetaData.OUT_RESULT.Column.1" value="implicitRefCursor metadata='ColumnName=OUT_PARTY_ID_NO;NATIVEDATATYPE=Number;ProviderType=Decimal'" />
    </settings>
    </oracle.dataaccess.client>
    5. underModel Browser try to add the procedure under "Add Import Function", select "Complex Type". when i am clicking on "Get column information" button, the screen blank for some time and then auto closing the screen without displaying any column info. I would like to know if any thing wrong i am doing on my steps? please help?

    I managed to workaround this problem.
    I add the function with no return value. Then in the Model Explorer you go to the properties of the imported function and edit the return type property, the same dialog appears, but this time it works as expected(considering you have set all the values correctly on your config file).

  • ORA-00604: error occurred at recursive SQL when calling proc via db_link

    Hi,
    I'm on 9.2.0.8 and got strange issue with simple test case
    on source db:
    CREATE OR REPLACE PROCEDURE ADMIN.gg_ref(out_tokens OUT SYS_REFCURSOR) is
      BEGIN
      OPEN out_tokens for select dummy from dual;
    END ;
    Now testing code localy:
    SQL> var r refcursor
    SQL> declare
      2   output sys_refcursor;
      3  begin
      4   adminx.gg_ref(output);
      5  :r:=output;
      6  end;
      7  /
    PL/SQL procedure successfully completed.
    SQL> print r
    D
    X
    So its working.
    I've got db_link to that db , and now call that proc via dblink from other 9.2.0.8 DB:
    var r refcursor
      1  declare
      2   output sys_refcursor;
      3  begin
      4   admin.gg_ref@LINK_NAME(output);
      5  :r:=output;
      6* end;
    SQL> /
    declare
    ERROR at line 1:
    ORA-00604: error occurred at recursive SQL level 1
    ORA-00900: invalid SQL statementWhats wrong with my code ?
    Are there any restriction I'm not aware of ?
    Regards
    GregG

    GregG wrote:
    What should my code look like now ?
    Should I rewrite this as function returning index by collection or something ?You can use DBMS_SQL - but use the remote package and not the local one. This is a little bit more complex ito call interface than using a ref cursor, but is the very same thing on the server side. DBMS_SQL also provides a more comprehensive set of features than using the ref cursor interface.
    The main issue though is additional coding - as DBMS_SQL is a lower level interface (a lot closer to the real Oracle Call Interface/OCI):
    --// on remote database the procedure returns a DBMS_SQL cursor instead of a ref cursor
    SQL> create or replace procedure FooProc( cur in out number, deptID number ) is
      2          rc      number;
      3  begin
      4          cur := DBMS_SQL.open_cursor;
      5 
      6          DBMS_SQL.parse(
      7                  cur,
      8                  'select ename from emp where deptno = :deptID',
      9                  DBMS_SQL.native
    10          );
    11 
    12          DBMS_SQL.Bind_Variable( cur, 'deptID', deptID );
    13 
    14          rc := DBMS_SQL.Execute( cur );
    15  end;
    16  /
    Procedure created.
    --// from the local database side we call this remote proc
    SQL> declare
      2          c               number;  --// instead of using sys_refcursor
      3          empName         varchar2(10); --// buffer to fetch column into
      4  begin
      5          FooProc@testdb( c, 10 );  --/ call the proc that creates the cursor
      6 
      7          --// we need to define our fetch buffer for the 1st column in the
      8          --// SQL projection of that cursor (10 byte fetch buffer for 1st column)
      9          DBMS_SQL.define_column@testdb( c, 1, empName, 10 );
    10 
    11          --// we now fetch from this cursor, but via the DBMS_SQL
    12          --// interface
    13          loop
    14                  --// fetch the row (exit when 0 rows are fetched)
    15                  exit when DBMS_SQL.Fetch_Rows@testdb( c ) = 0;
    16 
    17                  --// copy value of 1st column in row into the local PL/SQL buffer
    18                  DBMS_SQL.column_value@testdb( c, 1, empName );
    19 
    20                  --// record value it via dbms output
    21                  DBMS_OUTPUT.put_line( 'name='||empName||' deptID=10' );
    22          end loop;
    23 
    24          --// close it explicitly as you would a ref cursor
    25          DBMS_SQL.Close_Cursor@testdb( c );
    26  end;
    27  /
    name=CLARK deptID=10
    name=KING deptID=10
    name=MILLER deptID=10
    PL/SQL procedure successfully completed.
    SQL>

  • Tuning a procedure and using dbms_job.submit proc that call's functions

    Hi
    I have Procedure that have 3 curosrs which are nested one below with in each other
    and it looks as below
    it's structure will look some thing look like this
    declare
    empno_fetch number;
    CURSOR deu_process IS
    SELECT empno
    FROM emp
    WHERE flg_process = 'N'
    AND ROWNUM <= 5000
    ORDER BY empno;
    CURSOR dup_all IS --c1 fetch around 400000 records
    (select empno
    from emp
    where empno>l_empno
    order by empno
    where rownum<=empno_fetch;
    CURSOR rules IS --c2
    SELECT rule_id, rule_score, name_Of_func
    FROM rule;
    begin
    l_count := 1;
    OPEN dedupe_rule_attr;
    LOOP
    BEGIN
    Here one loop is used for fetching 5000 records at time and
    Here deu_process cursor is opened ,assume it fetches one record
    Here another cursor dup_all is used for fetching the records and assume it fetched 400000 then
    Here another cursor is opened name where it fetches 10 rows
    Here logic is if first row then
    call's stored function which has following functionalty
    it compares fields such as address of outer most cursor i.e deu_process with all the address of the other rows i.e 400000 rows and return a number
    if second row then
    call's another stored function which has
    compares other fields such as first name,last name
    if third then other field
    so on ....
    up to 10
    and then finally ends
    so if i comment all the rules loop then it takes only one min to execute .If it validaes all of them if takes 14 minutes to execute .so there is problem in that 10 procedures to execute
    So i found an approach to run all the rules simultaneously using dbms_job .But i face a problem that i can't uderstand how to send the input and out put parameter's to calling procedure.And these parameter's must be passed by variable from called procedure to calling procedure
    Please suggest me what is the syntax of dbms_job with input and output parameters with variable's that must be passed as formal parameter's
    Regarding DBMS_JOB.SUBMIT I am getting following error
    Declare
    x number:=1;
    b number;
    jobnumber number;
    BEGIN
    DBMS_JOB.SUBMIT(JOB => jobnumber,
    WHAT => 'vamsi_proc1('||x||');',
    NEXT_DATE => (sysdate+1/(86400)),
    INTERVAL => null);
    --dbms_output.put_line('value of b is '||b);
    COMMIT;
    END;
    Declare
    ERROR at line 1:
    ORA-06550: line 1, column 107:
    PLS-00103: Encountered the symbol ")" when expecting one of the following:
    ( - + case mod new not null others <an identifier>
    <a double-quoted delimited-identifier> <a bind variable> avg
    count current exists max min prior sql stddev sum variance
    execute forall merge time timestamp interval date
    <a string literal with character set specification>
    <a number> <a single-quoted SQL string> pipe
    The symbol "null" was substituted for ")" to continue.
    ORA-06512: at "SYS.DBMS_JOB", line 79
    ORA-06512: at "SYS.DBMS_JOB", line 136
    ORA-06512: at line 5
    create or replace procedure vamsi_proc1(v in out number) as
    x number(4);
    begin
    --a:=1;
    insert into emp_vamsi(select 677,ENAME,SAL,DEPTNO,MANAGER from emp where empno=v);
    commit;
    --a:=2;
    --x:=a;
    end;
    using dbms_job.submit proc that call's functions which returns out and in parameters to calling procedure environment .I can't get this with out using data base table's.
    If you have any method for this Plese suggest
    And also please suggest me weather using job's is a good idea ,If not than suggest me what ever will the other approach.
    Thank's and Regard's
    vamsi krishna

    Hi <br>
    I have looked at all sql trace file ,<br>
    I found that there is no problem in sql statemens all of them are using proper <br>indexes execpt the folllowing statement<br>
    <br>
    SELECT nvl(COUNT(ref_appln_no),0)<br>
    FROM ci_cust_dedupe_mast<br>
    WHERE flg_mnt_status='A'<br>
    <br>
    This statement executes only once for 1*3,77000*10 times <br>
    The function that i had sent previously executes more than 4000000*20 times .<br>
    I think all it takes is only for iterations that are caused<br>
    <br>
    I am also sending sql trace for reference
         <br>
    TKPROF: Release 9.2.0.4.0 - Production on Mon Aug 14 17:30:50 2006     <br>
         <br>
    Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.     <br>
         <br>
    Trace file: afhuat_ora_2204.trc     <br>
    Sort options: default     <br>
         <br>
    ********************************************************************************     <br>
    count = number of times OCI procedure was executed     <br>
    cpu = cpu time in seconds executing      <br>
    elapsed = elapsed time in seconds executing     <br>
    disk = number of physical reads of buffers from disk     <br>
    query = number of buffers gotten for consistent read     <br>
    current = number of buffers gotten in current mode (usually for update)     <br>
    rows = number of rows processed by the fetch or execute call     <br>
    ********************************************************************************     <br>
         <br>
    alter session set sql_trace=true     <br>
         <br>
         <br>
    call count cpu elapsed disk query current rows     <br>
    ------- ------ -------- ---------- ---------- ---------- ---------- ----------     <br>
    Parse 0 0.00 0.00 0 0 0 0     <br>
    Execute 1 0.00 0.00 0 0 0 0     <br>
    Fetch 0 0.00 0.00 0 0 0 0     <br>
    ------- ------ -------- ---------- ---------- ---------- ---------- ----------     <br>
    total 1 0.00 0.00 0 0 0 0     <br>
         <br>
    Misses in library cache during parse: 0     <br>
    Misses in library cache during execute: 1     <br>
    Optimizer goal: CHOOSE     <br>
    Parsing user id: 61      <br>
    ********************************************************************************     <br>
         <br>
    declare     <br>
    x varchar2(100);     <br>
    y varchar2(100);     <br>
    ap number;     <br>
    begin     <br>
    x:=to_char(sysdate,'dd-mon-rrrr hh:mi:ss');     <br>
    ap:=ap_ci_dedupe_proc;     <br>
    y:=to_char(sysdate,'dd-mon-rrrr hh:mi:ss');     <br>
    dbms_output.put_line(x||' '||ap);     <br>
    dbms_output.put_line(y||' '||ap);     <br>
    end;     <br>
         <br>
    call count cpu elapsed disk query current rows     <br>
    ------- ------ -------- ---------- ---------- ---------- ---------- ----------     <br>
    Parse 1 0.00 0.00 0 0 0 0     <br>
    Execute 1 0.00 820.23 0 0 0 1     <br>
    Fetch 0 0.00 0.00 0 0 0 0     <br>
    ------- ------ -------- ---------- ---------- ---------- ---------- ----------     <br>
    total 2 0.00 820.23 0 0 0 1     <br>
         <br>
    Misses in library cache during parse: 0     <br>
    Optimizer goal: CHOOSE     <br>
    Parsing user id: 61      <br>
    ********************************************************************************     <br>
         <br>
    select user#      <br>
    from     <br>
    sys.user$ where name = 'OUTLN'     <br>
         <br>
         <br>
    call count cpu elapsed disk query current rows     <br>
    ------- ------ -------- ---------- ---------- ---------- ---------- ----------     <br>
    Parse 1 0.00 0.00 0 0 0 0     <br>
    Execute 1 0.00 0.00 0 0 0 0     <br>
    Fetch 1 0.00 0.00 0 2 0 1     <br>
    ------- ------ -------- ---------- ---------- ---------- ---------- ----------     <br>
    total 3 0.00 0.00 0 2 0 1     <br>
         <br>
    Misses in library cache during parse: 0     <br>
    Optimizer goal: CHOOSE     <br>
    Parsing user id: SYS (recursive depth: 2)     <br>
         <br>
    Rows Row Source Operation     <br>
    ------- ---------------------------------------------------     <br>
    1 TABLE ACCESS BY INDEX ROWID USER$ (cr=2 r=0 w=0 time=31 us)     <br>
    1 INDEX UNIQUE SCAN I_USER1 (cr=1 r=0 w=0 time=18 us)(object id 44)     <br>
         <br>
    ********************************************************************************     <br>
         <br>
    SELECT *     <br>
    FROM ci_dedupe_rule_attr     <br>
    ORDER BY cod_rule_attr_id     <br>
         <br>
    call count cpu elapsed disk query current rows     <br>
    ------- ------ -------- ---------- ---------- ---------- ---------- ----------     <br>
    Parse 1 0.00 0.06 0 0 0 0     <br>
    Execute 1 0.00 0.00 0 0 0 0     <br>
    Fetch 21 0.00 0.01 1 3 0 20     <br>
    ------- ------ -------- ---------- ---------- ---------- ---------- ----------     <br>
    total 23 0.00 0.07 1 3 0 20     <br>
         <br>
    Misses in library cache during parse: 0     <br>
    Optimizer goal: CHOOSE     <br>
    Parsing user id: 61 (recursive depth: 1)     <br>
    ********************************************************************************     <br>
         <br>
    SELECT COUNT(1)     <br>
    FROM ci_cust_dedupe_mast     <br>
    WHERE flg_process = 'N'     <br>
    AND     <br>
    AND     <br>
         <br>
    call count cpu elapsed disk query current rows     <br>
    ------- ------ -------- ---------- ---------- ---------- ---------- ----------     <br>
    Parse 1 0.00 0.00 0 0 0 0     <br>
    Execute 1 0.00 0.00 0 0 0 0     <br>
    Fetch 1 0.00 0.00 0 22 0 1     <br>
    ------- ------ -------- ---------- ---------- ---------- ---------- ----------     <br>
    total 3 0.00 0.00 0 22 0 1     <br>
         <br>
    Misses in library cache during parse: 0     <br>
    Optimizer goal: CHOOSE     <br>
    Parsing user id: 61 (recursive depth: 1)     <br>
    ********************************************************************************     <br>
         <br>
    SELECT nvl(COUNT(ref_appln_no),0)     <br>
    FROM ci_cust_dedupe_mast     <br>
    WHERE flg_mnt_status='A'     <br>
         <br>
    call count cpu elapsed disk query current rows     <br>
    ------- ------ -------- ---------- ---------- ---------- ---------- ----------     <br>
    Parse 1 0.00 0.00 0 0 0 0     <br>
    Execute 1 0.00 0.00 0 0 0 0     <br>
    Fetch 1 1.68 3.03 18867 21183 0 1     <br>
    ------- ------ -------- ---------- ---------- ---------- ---------- ----------     <br>
    total 3 1.68 3.03 18867 21183 0 1     <br>
         <br>
    Misses in library cache during parse: 0     <br>
    Optimizer goal: CHOOSE     <br>
    Parsing user id: 61 (recursive depth: 1)     <br>
    ********************************************************************************     <br>
         <br>
    SELECT ref_appln_no     <br>
    FROM ci_cust_dedupe_mast     <br>
    WHERE flg_process = 'N'     <br>
    AND     <br>
    AND     <br>
    AND     <br>
    ORDER BY ref_appln_no     <br>
         <br>
    call count cpu elapsed disk query current rows     <br>
    ------- ------ -------- ---------- ---------- ---------- ---------- ----------     <br>
    Parse 1 0.00 0.00 0 0 0 0     <br>
    Execute 2 0.00 0.00 0 0 0 0     <br>
    Fetch 3 0.00 0.09 18 43 0 1     <br>
    ------- ------ -------- ---------- ---------- ---------- ---------- ----------     <br>
    total 6 0.00 0.09 18 43 0 1     <br>
         <br>
    Misses in library cache during parse: 0     <br>
    Optimizer goal: CHOOSE     <br>
    Parsing user id: 61 (recursive depth: 1)     <br>
    ********************************************************************************     <br>
         <br>
    SELECT     <br>
    FROM     <br>
    WHERE     <br>
    AND     <br>
         <br>
    call count cpu elapsed disk query current rows     <br>
    ------- ------ -------- ---------- ---------- ---------- ---------- ----------     <br>
    Parse 1 0.00 0.00 0 0 0 0     <br>
    Execute 377709 8.71 7.64 0 0 0 0     <br>
    Fetch 377709 18.18 60.19 19802 1510836 0 377709     <br>
    ------- ------ -------- ---------- ---------- ---------- ---------- ----------     <br>
    total 755419 26.90 67.84 19802 1510836 0 377709     <br>
         <br>
    Misses in library cache during parse: 0     <br>
    Optimizer goal: CHOOSE     <br>
    Parsing user id: 61 (recursive depth: 1)     <br>
    ********************************************************************************     <br>
         <br>
    SELECT NVL(MAX(cod_serial_no),0) + 1     <br>
    FROM ci_dedupe_details_mast     <br>
    WHERE ref_appln_no = :b1     <br>
         <br>
    call count cpu elapsed disk query current rows     <br>
    ------- ------ -------- ---------- ---------- ---------- ---------- ----------     <br>
    Parse 1 0.00 0.00 0 0 0 0     <br>
    Execute 1 0.00 0.00 0 0 0 0     <br>
    Fetch 1 0.00 0.01 2 2 0 1     <br>
    ------- ------ -------- ---------- ---------- ---------- ---------- ----------     <br>
    total 3 0.00 0.01 2 2 0 1     <br>
         <br>
    Misses in library cache during parse: 0     <br>
    Optimizer goal: CHOOSE     <br>
    Parsing user id: 61 (recursive depth: 1)     <br>
    ********************************************************************************     <br>
         <br>
    SELECT COUNT(1)     <br>
    FROM ci_dedupe_details_mast     <br>
    WHERE ref_appln_no = :b1     <br>
    AND     <br>
    AND flg_mnt_status = 'A'     <br>
         <br>
    call count cpu elapsed disk query current rows     <br>
    ------- ------ -------- ---------- ---------- ---------- ---------- ----------     <br>
    Parse 1 0.00 0.00 0 0 0 0     <br>
    Execute 1 0.00 0.00 0 0 0 0     <br>
    Fetch 1 0.00 0.00 0 3 0 1     <br>
    ------- ------ -------- ---------- ---------- ---------- ---------- ----------     <br>
    total 3 0.00 0.00 0 3 0 1     <br>
         <br>
    Misses in library cache during parse: 0     <br>
    Optimizer goal: CHOOSE     <br>
    Parsing user id: 61 (recursive depth: 1)     <br>
    ********************************************************************************     <br>
         <br>
    SELECT ref_appln_no FROM     <br>
    (     <br>
    SELECT ref_appln_no     <br>
    FROM ci_cust_dedupe_mast     <br>
    WHERE     <br>
    AND     <br>
    ORDER BY ref_appln_no     <br>
    )     <br>
    WHERE ROWNUM <= :b2     <br>
         <br>
    call count cpu elapsed disk query current rows     <br>
    ------- ------ -------- ---------- ---------- ---------- ---------- ----------     <br>
    Parse 1 0.00 0.00 0 0 0 0     <br>
    Execute 77 0.01 0.00 0 0 0 0     <br>
    Fetch 377786 10.21 12.33 908 377865 0 377709     <br>
    ------- ------ -------- ---------- ---------- ---------- ---------- ----------     <br>
    total 377864 10.23 12.33 908 377865 0 377709     <br>
         <br>
    Misses in library cache during parse: 0     <br>
    Optimizer goal: CHOOSE     <br>
    Parsing user id: 61 (recursive depth: 1)     <br>
    ********************************************************************************     <br>
         <br>
    SELECT cod_rule_id, cod_rule_score, nam_rule_func     <br>
    FROM ci_dedupe_rule_defn     <br>
    WHERE flg_valid = 'Y'     <br>
         <br>
    call count cpu elapsed disk query current rows     <br>
    ------- ------ -------- ---------- ---------- ---------- ---------- ----------     <br>
    Parse 1 0.00 0.00 0 0 0 0     <br>
    Execute 377708 5.50 4.03 0 0 0 0     <br>
    Fetch 4154788 62.79 54.04 16 4532496 0 3777080     <br>
    ------- ------ -------- ---------- ---------- ---------- ---------- ----------     <br>
    total 4532497 68.29 58.07 16 4532496 0 3777080     <br>
         <br>
    Misses in library cache during parse: 0     <br>
    Optimizer goal: CHOOSE     <br>
    Parsing user id: 61 (recursive depth: 1)     <br>
    ********************************************************************************     <br>
         <br>
    select con#,obj#,rcon#,enabled,nvl(defer,0)      <br>
    from     <br>
    cdef$ where robj#=:1     <br>
         <br>
         <br>
    call count cpu elapsed disk query current rows     <br>
    ------- ------ -------- ---------- ---------- ---------- ---------- ----------     <br>
    Parse 2 0.00 0.00 0 0 0 0     <br>
    Execute 2 0.00 0.00 0 0 0 0     <br>
    Fetch 2 0.00 0.01 1 2 0 0     <br>
    ------- ------ -------- ---------- ---------- ---------- ---------- ----------     <br>
    total 6 0.00 0.01 1 2 0 0     <br>
         <br>
    Misses in library cache during parse: 0     <br>
    Optimizer goal: CHOOSE     <br>
    Parsing user id: SYS (recursive depth: 2)     <br>
    ********************************************************************************     <br>
         <br>
    select con#,type#,condlength,intcols,robj#,rcon#,match#,refact,nvl(enabled,0),     <br>
    rowid,cols,nvl(defer,0),mtime,nvl(spare1,0)      <br>
    from     <br>
    cdef$ where obj#=:1     <br>
         <br>
         <br>
    call count cpu elapsed disk query current rows     <br>
    ------- ------ -------- ---------- ---------- ---------- ---------- ----------     <br>
    Parse 2 0.00 0.00 0 0 0 0     <br>
    Execute 2 0.00 0.00 0 0 0 0     <br>
    Fetch 2 0.00 0.01 2 4 0 0     <br>
    ------- ------ -------- ---------- ---------- ---------- ---------- ----------     <br>
    total 6 0.00 0.01 2 4 0 0     <br>
         <br>
    Misses in library cache during parse: 0     <br>
    Optimizer goal: CHOOSE     <br>
    Parsing user id: SYS (recursive depth: 2)     <br>
    ********************************************************************************     <br>
         <br>
    select u.name,o.name, t.update$, t.insert$, t.delete$, t.enabled      <br>
    from     <br>
    obj$ o,user$ u,trigger$ t where t.baseobject=:1 and t.obj#=o.obj# and      <br>
    o.owner#=u.user# order by o.obj#     <br>
         <br>
         <br>
    call count cpu elapsed disk query current rows     <br>
    ------- ------ -------- ---------- ---------- ---------- ---------- ----------     <br>
    Parse 3 0.00 0.00 0 0 0 0     <br>
    Execute 3 0.00 0.00 0 0 0 0     <br>
    Fetch 4 0.00 0.05 6 9 0 1     <br>
    ------- ------ -------- ---------- ---------- ---------- ---------- ----------     <br>
    total 10 0.00 0.05 6 9 0 1     <br>
         <br>
    Misses in library cache during parse: 1     <br>
    Optimizer goal: CHOOSE     <br>
    Parsing user id: SYS (recursive depth: 2)     <br>
         <br>
    Rows Row Source Operation     <br>
    ------- ---------------------------------------------------     <br>
    0 SORT ORDER BY (cr=1 r=1 w=0 time=4772 us)     <br>
    0 NESTED LOOPS (cr=1 r=1 w=0 time=4747 us)     <br>
    0 NESTED LOOPS (cr=1 r=1 w=0 time=4744 us)     <br>
    0 TABLE ACCESS BY INDEX ROWID TRIGGER$ (cr=1 r=1 w=0 time=4740 us)     <br>
    0 INDEX RANGE SCAN I_TRIGGER1 (cr=1 r=1 w=0 time=4736 us)(object id 130)     <br>
    0 TABLE ACCESS BY INDEX ROWID OBJ$ (cr=0 r=0 w=0 time=0 us)     <br>
    0 INDEX UNIQUE SCAN I_OBJ1 (cr=0 r=0 w=0 time=0 us)(object id 36)     <br>
    0 TABLE ACCESS CLUSTER USER$ (cr=0 r=0 w=0 time=0 us)     <br>
    0 INDEX UNIQUE SCAN I_USER# (cr=0 r=0 w=0 time=0 us)(object id 11)     <br>
         <br>
    ********************************************************************************     <br>
         <br>
    select o.owner#,o.name,o.namespace,o.remoteowner,o.linkname,o.subname,     <br>
    o.dataobj#,o.flags      <br>
    from     <br>
    obj$ o where o.obj#=:1     <br>
         <br>
         <br>
    call count cpu elapsed disk query current rows     <br>
    ------- ------ -------- ---------- ---------- ---------- ---------- ----------     <br>
    Parse 2 0.00 0.00 0 0 0 0     <br>
    Execute 3 0.00 0.00 0 0 0 0     <br>
    Fetch 3 0.00 0.02 5 9 0 3     <br>
    ------- ------ -------- ---------- ---------- ---------- ---------- ----------     <br>
    total 8 0.00 0.02 5 9 0 3     <br>
         <br>
    Misses in library cache during parse: 0     <br>
    Optimizer goal: CHOOSE     <br>
    Parsing user id: SYS (recursive depth: 3)     <br>
    ********************************************************************************     <br>
         <br>
    select col#, grantee#, privilege#,max(mod(nvl(option$,0),2))      <br>
    from     <br>
    objauth$ where obj#=:1 and col# is not null group by privilege#, col#,      <br>
    grantee# order by col#, grantee#     <br>
         <br>
         <br>
    call count cpu elapsed disk query current rows     <br>
    ------- ------ -------- ---------- ---------- ---------- ---------- ----------     <br>
    Parse 3 0.00 0.00 0 0 0 0     <br>
    Execute 3 0.00 0.00 0 0 0 0     <br>
    Fetch 3 0.00 0.01 2 6 0 0     <br>
    ------- ------ -------- ---------- ---------- ---------- ---------- ----------     <br>
    total 9 0.00 0.02 2 6 0 0     <br>
         <br>
    Misses in library cache during parse: 1     <br>
    Optimizer goal: CHOOSE     <br>
    Parsing user id: SYS (recursive depth: 2)     <br>
    ********************************************************************************     <br>
         <br>
    INSERT INTO ci_dedupe_details_mast     <br>
    VALUES     <br>
    (     <br>
    :b6,     <br>
    :b5,     <br>
    :b4,     <br>
    :b3,     <br>
    'Y',     <br>
    'N',     <br>
    '',     <br>
    0,     <br>
    SYSDATE,     <br>
    'A',     <br>
    ' ',     <br>
    :b2,     <br>
    'SYSTEM',     <br>
    :b1,     <br>
    1     <br>
    )     <br>
         <br>
    call count cpu elapsed disk query current rows     <br>
    ------- ------ -------- ---------- ---------- ---------- ---------- ----------     <br>
    Parse 1 0.00 0.01 3 3 0 0     <br>
    Execute 1 0.00 0.01 4 1 6 1     <br>
    Fetch 0 0.00 0.00 0 0 0 0     <br>
    ------- ------ -------- ---------- ---------- ---------- ---------- ----------     <br>
    total 2 0.00 0.02 7 4 6 1     <br>
         <br>
    Misses in library cache during parse: 1     <br>
    Optimizer goal: CHOOSE     <br>
    Parsing user id: 61 (recursive depth: 1)     <br>
    ********************************************************************************     <br>
         <br>
    select obj#,type#,ctime,mtime,stime,status,dataobj#,flags,oid$, spare1,      <br>
    spare2      <br>
    from     <br>
    obj$ where owner#=:1 and name=:2 and namespace=:3 and remoteowner is null      <br>
    and linkname is null and subname is null     <br>
         <br>
         <br>
    call count cpu elapsed disk query current rows     <br>
    ------- ------ -------- ---------- ---------- ---------- ---------- ----------     <br>
    Parse 1 0.00 0.00 0 0 0 0     <br>
    Execute 1 0.00 0.00 0 0 0 0     <br>
    Fetch 1 0.00 0.01 2 3 0 1     <br>
    ------- ------ -------- ---------- ---------- ---------- ---------- ----------     <br>
    total 3 0.00 0.01 2 3 0 1     <br>
         <br>
    Misses in library cache during parse: 0     <br>
    Optimizer goal: CHOOSE     <br>
    Parsing user id: SYS (recursive depth: 2)     <br>
    ********************************************************************************     <br>
         <br>
    select audit$,options      <br>
    from     <br>
    procedure$ where obj#=:1     <br>
         <br>
         <br>
    call count cpu elapsed disk query current rows     <br>
    ------- ------ -------- ---------- ---------- ---------- ---------- ----------     <br>
    Parse 1 0.00 0.00 0 0 0 0     <br>
    Execute 1 0.00 0.00 0 0 0 0     <br>
    Fetch 1 0.00 0.01 3 3 0 1     <br>
    ------- ------ -------- ---------- ---------- ---------- ---------- ----------     <br>
    total 3 0.00 0.01 3 3 0 1     <br>
         <br>
    Misses in library cache during parse: 0     <br>
    Optimizer goal: CHOOSE     <br>
    Parsing user id: SYS (recursive depth: 2)     <br>
         <br>
    Rows Row Source Operation     <br>
    ------- ---------------------------------------------------     <br>
    1 TABLE ACCESS BY INDEX ROWID PROCEDURE$ (cr=3 r=3 w=0 time=14110 us)     <br>
    1 INDEX UNIQUE SCAN I_PROCEDURE1 (cr=2 r=2 w=0 time=13871 us)(object id 115)     <br>
         <br>
    ********************************************************************************     <br>
         <br>
    select owner#,name,namespace,remoteowner,linkname,p_timestamp,p_obj#,      <br>
    d_owner#, nvl(property,0),subname      <br>
    from     <br>
    dependency$,obj$ where d_obj#=:1 and p_obj#=obj#(+) order by order#     <br>
         <br>
         <br>
    call count cpu elapsed disk query current rows     <br>
    ------- ------ -------- ---------- ---------- ---------- ---------- ----------     <br>
    Parse 1 0.00 0.00 0 0 0 0     <br>
    Execute 1 0.00 0.00 0 0 0 0     <br>
    Fetch 4 0.00 0.07 8 12 0 3     <br>
    ------- ------ -------- ---------- ---------- ---------- ---------- ----------     <br>
    total 6 0.00 0.07 8 12 0 3     <br>
         <br>
    Misses in library cache during parse: 0     <br>
    Optimizer goal: CHOOSE     <br>
    Parsing user id: SYS (recursive depth: 2)     <br>
         <br>
    Rows Row Source Operation     <br>
    ------- ---------------------------------------------------     <br>
    3 SORT ORDER BY (cr=12 r=8 w=0 time=72867 us)     <br>
    3 NESTED LOOPS OUTER (cr=12 r=8 w=0 time=72813 us)     <br>
    3 TABLE ACCESS BY INDEX ROWID DEPENDENCY$ (cr=4 r=4 w=0 time=41297 us)     <br>
    3 INDEX RANGE SCAN I_DEPENDENCY1 (cr=3 r=3 w=0 time=25897 us)(object id 127)     <br>
    3 TABLE ACCESS BY INDEX ROWID OBJ$ (cr=8 r=4 w=0 time=31484 us)     <br>
    3 INDEX UNIQUE SCAN I_OBJ1 (cr=5 r=2 w=0 time=14872 us)(object id 36)     <br>
         <br>
    ********************************************************************************     <br>
         <br>
    select order#,columns,types      <br>
    from     <br>
    access$ where d_obj#=:1     <br>
         <br>
         <br>
    call count cpu elapsed disk query current rows     <br>
    ------- ------ -------- ---------- ---------- ---------- ---------- ----------     <br>
    Parse 1 0.00 0.00 0 0 0 0     <br>
    Execute 1 0.00 0.00 0 0 0 0     <br>
    Fetch 2 0.00 0.02 3 4 0 1     <br>
    ------- ------ -------- ---------- ---------- ---------- ---------- ----------     <br>
    total 4 0.00 0.02 3 4 0 1     <br>
         <br>
    Misses in library cache during parse: 0     <br>
    Optimizer goal: CHOOSE     <br>
    Parsing user id: SYS (recursive depth: 2)     <br>
         <br>
    Rows Row Source Operation     <br>
    ------- ---------------------------------------------------     <br>
    1 TABLE ACCESS BY INDEX ROWID ACCESS$ (cr=4 r=3 w=0 time=27026 us)     <br>
    1 INDEX RANGE SCAN I_ACCESS1 (cr=3 r=2 w=0 time=21717 us)(object id 129)     <br>
         <br>
    ********************************************************************************     <br>
         <br>
    select /*+ index(idl_sb4$ i_idl_sb41) +*/ piece#,length,piece      <br>
    from     <br>
    idl_sb4$ where obj#=:1 and part=:2 and version=:3 order by piece#     <br>
         <br>
         <br>
    call count cpu elapsed disk query current rows     <br>
    ------- ------ -------- ---------- ---------- ---------- ---------- ----------     <br>
    Parse 2 0.00 0.00 0 0 0 0     <br>
    Execute 2 0.00 0.00 0 0 0 0     <br>
    Fetch 3 0.00 0.02 3 7 0 1     <br>
    ------- ------ -------- ---------- ---------- ---------- ---------- ----------     <br>
    total 7 0.00 0.02 3 7 0 1     <br>
         <br>
    Misses in library cache during parse: 0     <br>
    Optimizer goal: CHOOSE     <br>
    Parsing user id: SYS (recursive depth: 2)     <br>
         <br>
    Rows Row Source Operation     <br>
    ------- ---------------------------------------------------     <br>
    0 TABLE ACCESS BY INDEX ROWID IDL_SB4$ (cr=2 r=2 w=0 time=19830 us)     <br>
    0 INDEX RANGE SCAN I_IDL_SB41 (cr=2 r=2 w=0 time=19826 us)(object id 123)     <br>
         <br>
    ********************************************************************************     <br>
         <br>
    select /*+ index(idl_ub1$ i_idl_ub11) +*/ piece#,length,piece      <br>
    from     <br>
    idl_ub1$ where obj#=:1 and part=:2 and version=:3 order by piece#     <br>
         <br>
         <br>
    call count cpu elapsed disk query current rows     <br>
    ------- ------ -------- ---------- ---------- ---------- ---------- ----------     <br>
    Parse 2 0.00 0.00 0 0 0 0     <br>
    Execute 2 0.00 0.00 0 0 0 0     <br>
    Fetch 3 0.00 0.03 3 9 0 2     <br>
    ------- ------ -------- ---------- ---------- ---------- ---------- ----------     <br>
    total 7 0.00 0.03 3 9 0 2     <br>
         <br>
    Misses in library cache during parse: 0     <br>
    Optimizer goal: CHOOSE     <br>
    Parsing user id: SYS (recursive depth: 2)     <br>
         <br>
    Rows Row Source Operation     <br>
    ------- ---------------------------------------------------     <br>
    0 TABLE ACCESS BY INDEX ROWID IDL_UB1$ (cr=2 r=2 w=0 time=21757 us)     <br>
    0 INDEX RANGE SCAN I_IDL_UB11 (cr=2 r=2 w=0 time=21753 us)(object id 120)     <br>
         <br>
    ********************************************************************************     <br>
         <br>
    select /*+ index(idl_char$ i_idl_char1) +*/ piece#,length,piece      <br>
    from     <br>
    idl_char$ where obj#=:1 and part=:2 and version=:3 order by piece#     <br>
         <br>
         <br>
    call count cpu elapsed disk query current rows     <br>
    ------- ------ -------- ---------- ---------- ---------- ---------- ----------     <br>
    Parse 2 0.00 0.00 0 0 0 0     <br>
    Execute 2 0.00 0.00 0 0 0 0     <br>
    Fetch 2 0.00 0.01 2 4 0 0     <br>
    ------- ------ -------- ---------- ---------- ---------- ---------- ----------     <br>
    total 6 0.00 0.01 2 4 0 0     <br>
         <br>
    Misses in library cache during parse: 0     <br>
    Optimizer goal: CHOOSE     <br>
    Parsing user id: SYS (recursive depth: 2)     <br>
         <br>
    Rows Row Source Operation     <br>
    ------- ---------------------------------------------------     <br>
    0 TABLE ACCESS BY INDEX ROWID IDL_CHAR$ (cr=2 r=2 w=0 time=19465 us)     <br>
    0 INDEX RANGE SCAN I_IDL_CHAR1 (cr=2 r=2 w=0 time=19461 us)(object id 121)     <br>
         <br>
    ********************************************************************************     <br>
         <br>
    select /*+ index(idl_ub2$ i_idl_ub21) +*/ piece#,length,piece      <br>
    from     <br>
    idl_ub2$ where obj#=:1 and part=:2 and version=:3 order by piece#     <br>
         <br>
         <br>
    call count cpu elapsed disk query current rows     <br>
    ------- ------ -------- ---------- ---------- ---------- ---------- ----------     <br>
    Parse 2 0.00 0.00 0 0 0 0     <br>
    Execute 2 0.00 0.00 0 0 0 0     <br>
    Fetch 2 0.00 0.01 2 4 0 0     <br>
    ------- ------ -------- ---------- ---------- ---------- ---------- ----------     <br>
    total 6 0.00 0.01 2 4 0 0     <br>
         <br>
    Misses in library cache during parse: 0     <br>
    Optimizer goal: CHOOSE     <br>
    Parsing user id: SYS (recursive depth: 2)     <br>
         <br>
    Rows Row Source Operation     <br>
    ------- ---------------------------------------------------     <br>
    0 TABLE ACCESS BY INDEX ROWID IDL_UB2$ (cr=2 r=2 w=0 time=15070 us)     <br>
    0 INDEX RANGE SCAN I_IDL_UB21 (cr=2 r=2 w=0 time=15066 us)(object id 122)     <br>
         <br>
    ********************************************************************************     <br>
         <br>
    select baseobject,type#,update$,insert$,delete$,refnewname,refoldname,     <br>
    whenclause,definition,enabled,property,sys_evts,nttrigcol,nttrigatt,     <br>
    refprtname,rowid      <br>
    from     <br>
    trigger$ where obj# =:1     <br>
         <br>
         <br>
    call count cpu elapsed disk query current rows     <br>
    ------- ------ -------- ---------- ---------- ---------- ---------- ----------     <br>
    Parse 1 0.00 0.00 0 0 0 0     <br>
    Execute 1 0.00 0.00 0 0 0 0     <br>
    Fetch 1 0.00 0.00 1 2 0 1     <br>
    ------- ------ -------- ---------- ---------- ---------- ---------- ----------     <br>
    total 3 0.00 0.00 1 2 0 1     <br>
         <br>
    Misses in library cache during parse: 1     <br>
    Optimizer goal: CHOOSE     <br>
    Parsing user id: SYS (recursive depth: 2)     <br>
         <br>
    Rows Row Source Operation     <br>
    ------- ---------------------------------------------------     <br>
    1 TABLE ACCESS BY INDEX ROWID TRIGGER$ (cr=2 r=1 w=0 time=9352 us)     <br>
    1 INDEX UNIQUE SCAN I_TRIGGER2 (cr=1 r=1 w=0 time=9340 us)(object id 131)     <br>
         <br>
    ********************************************************************************     <br>
         <br>
    select owner#      <br>
    from     <br>
    obj$ o where obj# = :1     <br>
         <br>
         <br>
    call count cpu elapsed disk query current rows     <br>
    ------- ------ -------- ---------- ---------- ---------- ---------- ----------     <br>
    Parse 1 0.00 0.00 0 0 0 0     <br>
    Execute 1 0.00 0.00 0 0 0 0     <br>
    Fetch 1 0.00 0.00 0 3 0 1     <br>
    ------- ------ -------- ---------- ---------- ---------- ---------- ----------     <br>
    total 3 0.00 0.00 0 3 0 1     <br>
         <br>
    Misses in library cache during parse: 1     <br>
    Optimizer goal: CHOOSE     <br>
    Parsing user id: SYS (recursive depth: 2)     <br>
         <br>
    Rows Row Source Operation     <br>
    ------- ---------------------------------------------------     <br>
    1 TABLE ACCESS BY INDEX ROWID OBJ$ (cr=3 r=0 w=0 time=15 us)     <br>
    1 INDEX UNIQUE SCAN I_OBJ1 (cr=2 r=0 w=0 time=7 us)(object id 36)     <br>
         <br>
    ********************************************************************************     <br>
         <br>
    select tc.type#,tc.intcol#,tc.position#,c.type#, c.length,c.scale,     <br>
    c.precision#,c.charsetid,c.charsetform      <br>
    from     <br>
    triggercol$ tc,col$ c ,trigger$ tr where tc.obj#=:1 and c.obj#=:2 and      <br>
    tc.intcol#=c.intcol# and tr.obj# = tc.obj# and (bitand(tr.property,32) !=      <br>
    32 or bitand(tc.type#,20) = 20) union select type#,intcol#,position#,69,0,0,     <br>
    0,0,0 from triggercol$ where obj#=:3 and intcol#=1001 union select tc.type#,     <br>
    tc.intcol#,tc.position#,121,0,0,0,0,0 from triggercol$ tc,trigger$ tr where      <br>
    tr.obj# = tc.obj# and bitand(tr.property,32) = 32 and tc.obj# = :4 and      <br>
    bitand(tc.type#,20) != 20     <br>
         <br>
         <br>
    call count cpu elapsed disk query current rows     <br>
    ------- ------ -------- ---------- ---------- ---------- ---------- ----------     <br>
    Parse 1 0.00 0.00 0 0 0 0     <br>
    Execute 1 0.00 0.00 0 0 0 0     <br>
    Fetch 34 0.00 0.05 8 236 0 33     <br>
    ------- ------ -------- ---------- ---------- ---------- ---------- ----------     <br>
    total 36 0.00 0.05 8 236 0 33     <br>
         <br>
    Misses in library cache during parse: 1     <br>
    Optimizer goal: CHOOSE     <br>
    Parsing user id: SYS (recursive depth: 2)     <br>
         <br>
    Rows Row Source Operation     <br>
    ------- ---------------------------------------------------     <br>
    33 SORT UNIQUE (cr=236 r=8 w=0 time=54877 us)     <br>
    33 UNION-ALL (cr=236 r=8 w=0 time=54606 us)     <br>
    33 NESTED LOOPS (cr=197 r=8 w=0 time=53779 us)     <br>
    33 NESTED LOOPS (cr=162 r=8 w=0 time=53053 us)     <br>
    77 TABLE ACCESS CLUSTER COL$ (cr=83 r=6 w=0 time=40045 us)     <br>
    1 INDEX UNIQUE SCAN I_OBJ# (cr=2 r=2 w=0 time=13764 us)(object id 3)     <br>
    33 INDEX RANGE SCAN I_TRIGGERCOL2 (cr=79 r=2 w=0 time=12523 us)(object id 133)     <br>
    33 TABLE ACCESS BY INDEX ROWID TRIGGER$ (cr=35 r=0 w=0 time=466 us)     <br>
    33 INDEX UNIQUE SCAN I_TRIGGER2 (cr=2 r=0 w=0 time=152 us)(object id 131)     <br>
    0 INDEX RANGE SCAN I_TRIGGERCOL2 (cr=2 r=0 w=0 time=5 us)(object id 133)     <br>
    0 NESTED LOOPS (cr=37 r=0 w=0 time=574 us)     <br>
    33 INDEX RANGE SCAN I_TRIGGERCOL2 (cr=2 r=0 w=0 time=81 us)(object id 133)     <br>
    0 TABLE ACCESS BY INDEX ROWID TRIGGER$ (cr=35 r=0 w=0 time=350 us)     <br>
    33 INDEX UNIQUE SCAN I_TRIGGER2 (cr=2 r=0 w=0 time=139 us)(object id 131)     <br>
         <br>
    ********************************************************************************     <br>
         <br>
    select grantee#,privilege#,nvl(col#,0),max(mod(nvl(option$,0),2))     <br>
    from     <br>
    objauth$ where obj#=:1 group by grantee#,privilege#,nvl(col#,0) order by      <br>
    grantee#     <br>
         <br>
         <br>
    call count cpu elapsed disk query current rows     <br>
    ------- ------ -------- ---------- ---------- ---------- ---------- ----------     <br>
    Parse 3 0.00 0.00 0 0 0 0     <br>
    Execute 3 0.00 0.00 0 0 0 0     <br>
    Fetch 3 0.00 0.00 0 6 0 0     <br>
    ------- ------ -------- ---------- ---------- ---------- ---------- ----------     <br>
    total 9 0.00 0.00 0 6 0 0     <br>
         <br>
    Misses in library cache during parse: 1     <br>
    Optimizer goal: CHOOSE     <br>
    Parsing user id: SYS (recursive depth: 2)     <br>
    ********************************************************************************     <br>
         <br>
    UPDATE     <br>
    SET     <br>
    WHERE ref_appln_no = :b1     <br>
    AND flg_mnt_status = 'A'     <br>
         <br>
    call count cpu elapsed disk query current rows     <br>
    ------- ------ -------- ---------- ---------- ---------- ---------- ----------     <br>
    Parse 1 0.00 0.00 0 0 0 0     <br>
    Execute 1 0.00 0.16 9 8 17 1     <br>
    Fetch 0 0.00 0.00 0 0 0 0     <br>
    ------- ------ -------- ---------- ---------- ---------- ---------- ----------     <br>
    total 2 0.00 0.16 9 8 17 1     <br>
         <br>
    Misses in library cache during parse: 1     <br>
    Optimizer goal: CHOOSE     <br>
    Parsing user id: 61 (recursive depth: 1)     <br>
    ********************************************************************************     <br>
         <br>
    select type#,blocks,extents,minexts,maxexts,extsize,extpct,user#,iniexts,     <br>
    NVL(lists,65535),NVL(groups,65535),cachehint,hwmincr, NVL(spare1,0)      <br>
    from     <br>
    seg$ where ts#=:1 and file#=:2 and block#=:3     <br>
         <br>
         <br>
    call count cpu elapsed disk query current rows     <br>
    ------- ------ -------- ---------- ---------- ---------- ---------- ----------     <br>
    Parse 3 0.00 0.00 0 0 0 0     <br>
    Execute 3 0.00 0.00 0 0 0 0     <br>
    Fetch 3 0.00 0.01 3 9 0 3     <br>
    ------- ------ -------- ---------- ---------- ---------- ---------- ----------     <br>
    total 9 0.00 0.01 3 9 0 3     <br>
         <br>
    Misses in library cache during parse: 0     <br>
    Optimizer goal: CHOOSE     <br>
    Parsing user id: SYS (recursive depth: 2)     <br>
         <br>
    Rows Row Source Operation     <br>
    ------- ---------------------------------------------------     <br>
    1 TABLE ACCESS CLUSTER SEG$ (cr=3 r=3 w=0 time=17332 us)     <br>
    1 INDEX UNIQUE SCAN I_FILE#_BLOCK# (cr=2 r=2 w=0 time=10258 us)(object id 9)     <br>
         <br>
    ********************************************************************************     <br>
         <br>
    INSERT INTO ci_dedupe_details     <br>
    VALUES     <br>
    (     <br>
    :b31,     <br>
    :b32,     <br>
    :b31,     <br>
    :b30,     <br>
    :b29,     <br>
    :b28,     <br>
    :b27,     <br>
    :b26,     <br>
    :b25,     <br>
    :b24,     <br>
    :b23,     <br>
    :b22,     <br>
    :b21,     <br>
    :b20,     <br>
    :b19,     <br>
    :b18,     <br>
    :b17,     <br>
    :b16,     <br>
    :b15,     <br>
    :b14,     <br>
    :b13,     <br>
    :b12,     <br>
    :b11,     <br>
    :b10,     <br>
    :b9,     <br>
    :b8,     <br>
    :b7,     <br>
    :b6,     <br>
    :b5,     <br>
    :b4,     <br>
    :b3,     <br>
    :b2,     <br>
    :b1,     <br>
    'N',     <br>
    0,     <br>
    'E' )     <br>
         <br>
    call count cpu elapsed disk query current rows     <br>
    ------- ------ -------- ---------- ---------- ---------- ---------- ----------     <br>
    Parse 1 0.00 0.00 0 0 0 0     <br>
    Execute 1 0.01 0.03 4 1 5 1     <br>
    Fetch 0 0.00 0.00 0 0 0 0     <br>
    ------- ------ -------- ---------- ---------- ---------- ---------- ----------     <br>
    total 2 0.01 0.03 4 1 5 1     <br>
         <br>
    Misses in library cache during parse: 1     <br>
    Optimizer goal: CHOOSE     <br>
    Parsing user id: 61 (recursive depth: 1)     <br>
    ********************************************************************************     <br>
         <br>
    select /*+ rule */ bucket_cnt, row_cnt, cache_cnt, null_cnt, timestamp#,      <br>
    sample_size, minimum, maximum, distcnt, lowval, hival, density, col#,      <br>
    spare1, spare2, avgcln      <br>
    from     <br>
    hist_head$ where obj#=:1 and intcol#=:2     <br>
         <br>
         <br>
    call count cpu elapsed disk query current rows     <br>
    ------- ------ -------- ---------- ---------- ---------- ---------- ----------     <br>
    Parse 1 0.00 0.00 0 0 0 0     <br>
    Execute 36 0.00 0.00 0 0 0 0     <br>
    Fetch 36 0.00 0.02 3 108 0 36     <br>
    ------- ------ -------- ---------- ---------- ---------- ---------- ----------     <br>
    total 73 0.00 0.02 3 108 0 36     <br>
         <br>
    Misses in library cache during parse: 1     <br>
    Optimizer goal: RULE     <br>
    Parsing user id: SYS (recursive depth: 2)     <br>
    ********************************************************************************     <br>
         <br>
    COMMIT     <br>
         <br>
         <br>
    call count cpu elapsed disk query current rows     <br>
    ------- ------ -------- ---------- ---------- ---------- ---------- ----------     <br>
    Parse 2 0.00 0.00 0 0 0 0     <br>
    Execute 2 0.00 0.01 0 0 1 0     <br>
    Fetch 0 0.00 0.00 0 0 0 0     <br>
    ------- ------ -------- ---------- ---------- ---------- ---------- ----------     <br>
    total 4 0.00 0.01 0 0 1 0     <br>
         <br>
    Misses in library cache during parse: 1     <br>
    Optimizer goal: CHOOSE     <br>
    Parsing user id: 61 (recursive depth: 1)     <br>
    ********************************************************************************     <br>
         <br>
    BEGIN DBMS_OUTPUT.GET_LINES(:LINES, :NUMLINES); END;     <br>
         <br>
         <br>
    call count cpu elapsed disk query current rows     <br>
    ------- ------ -------- ---------- ---------- ---------- ---------- ----------     <br>
    Parse 1 0.00 0.00 0 0 0 0     <br>
    Execute 1 0.00 0.00 0 0 0 1     <br>
    Fetch 0 0.00 0.00 0 0 0 0     <br>
    ------- ------ -------- ---------- ---------- ---------- ---------- ----------     <br>
    total 2 0.00 0.00 0 0 0 1     <br>
         <br>
    Misses in library cache during parse: 1     <br>
    Optimizer goal: CHOOSE     <br>
    Parsing user id: 61      <br>
         <br>
         <br>
         <br>
    ********************************************************************************     <br>
         <br>
    OVERALL TOTALS FOR ALL NON-RECURSIVE STATEMENTS     <br>
         <br>
    call count cpu elapsed disk query current rows     <br>
    ------- ------ -------- ---------- ---------- ---------- ---------- ----------     <br>
    Parse 2 0.00 0.00 0 0 0 0     <br>
    Execute 3 0.00 820.23 0 0 0 2     <br>
    Fetch 0 0.00 0.00 0 0 0 0     <br>
    ------- ------ -------- ---------- ---------- ---------- ---------- ----------     <br>
    total 5 0.00 820.23 0 0 0 2     <br>
         <br>
    Misses in library cache during parse: 1     <br>
    Misses in library cache during execute: 1     <br>
         <br>
         <br>
    OVERALL TOTALS FOR ALL RECURSIVE STATEMENTS     <br>
         <br>
    call count cpu elapsed disk query current rows     <br>
    ------- ------ -------- ---------- ---------- ---------- ---------- ----------     <br>
    Parse 49 0.00 0.10 3 3 0 0     <br>
    Execute 755577 14.25 11.90 17 10 29 3     <br>
    Fetch 4910422 92.89 130.18 39671 6442895 0 4532611     <br>
    ------- ------ -------- ---------- ---------- ---------- ---------- ----------     <br>
    total 5666048 107.14 142.19 39691 6442908 29 4532614     <br>
         <br>
    Misses in library cache during parse: 11     <br>
         <br>
    17 user SQL statements in session.     <br>
    35 internal SQL statements in session.     <br>
    52 SQL statements in session.     <br>
    ********************************************************************************     <br>
    Trace file: afhuat_ora_2204.trc     <br>
    Trace file compatibility: 9.00.01     <br>
    Sort options: default     <br>
         <br>
    1 session in tracefile.     <br>
    17 user SQL statements in trace file.     <br>
    35 internal SQL statements in trace file.     <br>
    52 SQL statements in trace file.     <br>
    36 unique SQL statements in trace file.     <br>
    5666466 lines in trace file.     <br>
    Regards<br>
    vamsi krishna<br>

Maybe you are looking for

  • When Time Machine is backing up files, I can't work on other apps

    When Time Machine backs up files, I am not able to work on other apps such as Safari.  I try to cancel the back up but nothing happens.  Then the rainbow-colored wheel appears and I can't do anything.  I have turn off the computer and the external ha

  • Swapping out iBook G4 video card?

    Is it possible to swap out the video card in my 1.33GHz iBook G4 14.1"? If so, what sort of video card do I need? Thanks in advance!

  • Keytool problem

    Hello, I have a keystore and its instance is ("JCEKS","SunJCE"). I am creating secret keys and privatekeys and store them inside my keystore. When I try to reach this keystore by using "keytool" application, I get the following error: java.io.IOExcep

  • What is the standard on using some jsp tags?

    Has it become an industry standard to not use scriplets, expressions and declarative tags in jsp or is it all dependant on the scale of the application and the preference of the developer. I have seen the arguments for not using these tags and while

  • Column Filterring and Mapping using SQLEXEC in Golden Gate

    I am trying to execute a Stored procedure using SQLEXEC command. The procedure scott.get_script_id (replicat side) updates the columns based on the values came from source (extract side). But I am getting following error: create or replace procedure