Help with Stored Procs.

Hello All,
Orcl Version:
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
PL/SQL Release 11.2.0.2.0 - Production
"CORE     11.2.0.2.0     Production"
TNS for Linux: Version 11.2.0.2.0 - Production
NLSRTL Version 11.2.0.2.0 - Production
I have a scenario, where I've to run the procedures from a package multiple times with different input parameter(key) primary key of one of the tables used inside the proc.
For ex,
pkg1
proc1(Key);
proc2(Key);
proc3(Key);
proc30(Key);
Engine(Main code) runs these procs multiple times with different params. Sometimes a proc runs more than 4000 times with different param value(key). I have 2 questions.
1. A proc when run for the first time, it is compiled and for the next time it will be in compiled form. I'm not sure how it works for the second run. Is the query in the proc cached and helps improve the performance?
2. Are there any ways to improve the performance?
Like, I'm hitting the base tables everytime a proc is run. Is there any advantage of creating MV's or something like that?
Thanks
Shank.

Hi, Shank,
SamFisher wrote:
Orcl Version:
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production ...
Thanks for including that!
I have a scenario, where I've to run the procedures from a package multiple times with different input parameter(key) primary key of one of the tables used inside the proc.
For ex,
pkg1
proc1(Key);
proc2(Key);
proc3(Key);
proc30(Key);
Engine(Main code) runs these procs multiple times with different params. Sometimes a proc runs more than 4000 times with different param value(key). I have 2 questions.
1. A proc when run for the first time, it is compiled and for the next time it will be in compiled form. Not usually. A stored procedure is compiled when it is created, that is, when you run the CREATE OR REPLACE PROCEDURE (or CREATE OR REPLACE PACKAGE) command.
It may be automatically re-compiled when you call it the first time. For example, if procedure A calls some other procedure B, and B has been re-compiled since A was created, then A will be re-compiled when you run it the first time.
I'm not sure how it works for the second run. Is the query in the proc cached and helps improve the performance? Performance may be a little faster after the first call, because the procedure, and the objects it references (such as table blocks) may already be cached in memory.
2. Are there any ways to improve the performance?
Like, I'm hitting the base tables everytime a proc is run. Is there any advantage of creating MV's or something like that? If the package body contains a BEGIN section, then that section is run the first time the package is used , but not again in the same session. You can use that section to initialize package variables (or SYS_CONTEXT variables, or global temporary tables) so you don't have to re-compute them every time you call the package.
For example, I have a package called pk_mail. The package body looks like this:
CREATE OR REPLACE PACKAGE BODY     pk_mail
AS
mail_host_name     VARCHAR2 (30);
PROCEDURE   add_recipient    -- First procedure
END  send_to_all;            -- Last procedure
-- The following is run the first time the package is used in a given session:
BEGIN
     SELECT     txt
     INTO     mail_host_name
     FROM     constant_tbl
     WHERE     ent_name     = 'MAIL_HOST_NAME'
     AND     status_txt     = 'ACTIVE'
     AND     ROWNUM     = 1;
EXCEPTION
     WHEN     NO_DATA_FOUND
     THEN
          mail_host_name := 'itd-smtp-out.foo.bar.com;             -- Default value
END     pk_mail;
/The package variable mail_host_name, which is used in various procedures in the package, is set the first time the package is used. After the first call, the code that gives it a value is not run again.
Edited by: Frank Kulash on Jul 6, 2012 1:21 PM
Added pk_mail example.

Similar Messages

  • How to declare a cursor with stored proc?

    Hi All,
    Can we declare a cursor with stored proc?
    For Example -
    CREATE PROCEDURE DDL_proc() LANGUAGE SQLSCRIPT AS
        CURSOR c_cursor1 (v_isbn VARCHAR(20)) FOR CALL SYS.GET_OBJECT_DEFINITION(<SCHEMA_NAME>, <TABLE_NAME>).;
         BEGIN
              FOR cur_row as c_cursor1 DO
              END FOR;
         END;
    Could you please have a look on the same?
    Thank you,
    Vijeesh

    Oracle PL/SQL also has a select into statement which is described in the same manual the link takes you to part of.
    select column_list
    into variable_list
    from table(s)
    where conditions
    The PL/SQL Users Guide is something you are going to want to have gone over cover to cover before you start converting because so that you make the best choices for how to rewrite the code: select into, explicit cursor, implicit cursor, for loop, simple loop, while loop, collections,bulk load, etc ....
    HTH -- Mark D Powell --

  • Help with stored function

    Hi...I was wondering if I could get help with this function. How do i write a function to return hours between a begin date and an end date for an employee. Thanks so much

    EdStevens wrote:
    AlexeyDev wrote:
    sb92075 wrote:
    select (date2-date1)*24 from dual;not as above but as below
    select (date2-date1)/24 from dual;date2-date1 is amount of days. Divide it by 24 and what? if you multiply it on 24 you will have a chance to know how many hours between these two dates. :-)Don't forget that a DATE type also includes a time component.I suppose it doesn't matter if you did a difference between two dates. The result is always number of days.

  • Inserting XML String into Table with help of Stored Proc

    I will be getting XML String from JAVA, which I have to insert in Table A, XML String is as follows
    <?xml version = '1.0'?>
    < TableA>
    <mappings Record="3">
    < MESSAGEID >1</ MESSAGEID >
    < MESSAGE >This  is available at your address!</ MESSAGE>
    </mappings>
    <mappings Record="3">
    < MESSAGEID >2</ MESSAGEID>
    < MESSAGE >This isn’t available at your address. </ MESSAGE>
    </mappings>
    </ TableA >
    Table Structure*
    MESSAGEID     VARCHAR2(15 BYTE)
    MESSAGE     VARCHAR2(500 BYTE)
    This is the stored procedure which I have written to insert data into TableA, V_MESSAGE will be input parameter for inserting XML String 
    create or replace procedure   AP_DBI_PS_MESSAGE_INSERT
    V_MESSAGE VARCHAR2(1024)
    AS
    declare
    charString varchar2(80);
    finalStr varchar2(4000) := null;
    rowsp integer;
    V_FILEHANDLE UTL_FILE.FILE_TYPE;
    begin
    -- the name of the table as specified in our DTD
    xmlgen.setRowsetTag('TableA');
    -- the name of the data set as specified in our DTD
    xmlgen.setRowTag('mappings');
    -- for getting the output on the screen
    dbms_output.enable(1000000);
    -- open the XML document in read only mode
    v_FileHandle := utl_file.fopen(V_MESSAGE);
    --v_FileHandle := V_MESSAGE;
    loop
    BEGIN
    utl_file.get_line(v_FileHandle, charString);
    exception
    when no_data_found then
    utl_file.fclose(v_FileHandle);
    exit;
    END;
    dbms_output.put_line(charString);
    if finalStr is not null then
    finalStr := finalStr || charString;
    else
    finalStr := charString;
    end if;
    end loop;
    -- for inserting the XML data into the table
    rowsp := xmlgen.insertXML('ONE.TableA',finalStr);
    dbms_output.put_line('INSERT DONE '||TO_CHAR(rowsp));
    xmlgen.resetOptions;
    end;Please Help
    Edited by: 846857 on Jul 18, 2011 10:55 PM

    with t as (select xmltype('<TableA >
                               <mappings Record="3">
                               <MessageId>1</MessageId>
                               <Message> This bundle is available at your address!</Message>
                               </mappings>
                               <mappings Record="3">
                               <MessageId>2</MessageId>
                               <Message>This isn’t available at your address. </Message>
                               </mappings>
                               </TableA  >') col FROM dual)
      --End Of sample data creation with subquery factoring.
      --You can use the query from here with your table and column name.
    select EXTRACTVALUE(X1.column_value,'/mappings/MessageId') MESSAGEID
          ,EXTRACTVALUE(X1.column_value,'/mappings/Message') MESSAGE
    from t,table(XMLSEQUENCE(extract(t.COL,'/TableA/mappings'))) X1;Above Code works as i get result
    MESSAGEID     MESSAGE
    1             This bundle is available at your address!
    2             This isn’t available at your address.
    _____________________________________________ now I want to insert the result into Table A... How to proceed... Please help
    Edited by: 846857 on Jul 19, 2011 12:15 AM

  • Report with stored proc running multiple stored procedures with insert statement

    Hi,
    I wonder if this is possible in SSRS ... I use the 2012 version (Data Tools).
    I have a report that triggers a stored procedure. See below.
    Within this SP there are 2 insert statements getting data from 2 other SP's.
    When I make a dataset referring to the main SP below, SSRS does not show me any fields at all.
    Is this because it's a SP with insert statements and nested SP's?
    At the end of the SP I make a select so it should see all the fields.
    The parameters @month and @costcenter are multivalue params. I use a special function to convert the multivalues, selected in the report, into a string to pass it correctly to the query (comma separated).
    USE [TestDB]
    GO
    /****** Object:  StoredProcedure [dbo].[_Pink_SP_StandingsRegisterDataset]    Script Date: 15-4-2014 13:31:30 ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    ALTER PROCEDURE [dbo].[_Pink_SP_StandingsRegisterDataset]
    @year INT,
    @month NVARCHAR(50),
    @costcenter NVARCHAR(500),
    @GLaccount NVARCHAR(9)
    AS
    BEGIN
    /* Remove existing content*/
    DELETE FROM _Pink_TB_StandingsRegister
    /* Add records part 1 */
    INSERT INTO _Pink_TB_StandingsRegister
    EXEC _Pink_SP_StandingsRegister @year, @month, @costcenter, @GLaccount
    /* Add records part 2 */
    INSERT INTO _Pink_TB_StandingsRegister
    Type,
    Row,
    Year,
    Month,
    YearDatetable,
    MonthDatetable
    EXEC _Pink_SP_StandingsRegisterDatetable @year
    /* Select all records */
    SELECT *
    FROM _Pink_TB_StandingsRegister
    END
    GO

    Hi bijntjede2e,
    After testing a similar scenario in my own environment, it works well in Reporting Services. In my test, the stored procedure returns all the fields from _Pink_TB_StandingsRegister table in the dataset. Then I select some values from year, month, costcenter
    and Glaccount parameters, it inserts some values in the _Pink_TB_StandingsRegister table. So we can use this stored procedure as the dataset in the report.
    In order to solve the problem more efficiently, I need to clarify some information.
    Are you pass multiple values parameter to one stored procedure correctly? We can refer to the following thread:
    http://social.technet.microsoft.com/Forums/en-US/dbdfa101-cccc-4e9f-aa50-566dc5ebcc27/ssrs-2008-r2-report-dataset-call-a-stored-procedure?forum=sqlrep
    What results are you get when executing the stored procedure in SQL Server Management Studio? Is it works well? We should double those stored procedures.
    If there are any misunderstanding, please elaborate the issue for further investigation.
    Thanks,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • Please help with this ProC error

    Here's what I'm getting:
    [oracle@dodona proc]$ make -f demo_proc.mk sample1
    make -f /oradb01/app/oracle/product/8.1.6/precomp/demo/proc/demo_proc.mk OBJS=sample1.o EXE=sample1 build
    make[1]: Entering directory `/usr/local/oracle816/app/oracle/product/8.1.6/precomp/demo/proc'
    proc iname=sample1
    proc: error in loading shared libraries: libclntsh.so.8.0: cannot read file data: No such file or directory
    make[1]: *** [sample1.o] Error 127
    make[1]: Leaving directory `/usr/local/oracle816/app/oracle/product/8.1.6/precomp/demo/proc'
    make: *** [sample1] Error 2
    My LD_LIBRARY_PATH is set. LIBHOME used in the demo makefile is set in $ORACLE_HOME/precomp/lib/env_precomp.mk as $(ORACLE_HOME)/lib/.

    You should find a symbolic link in your $ORACLE_HOME/lib directory:
    libclntsh.so -> libclntsh.so.8.0
    If the file or the link doesn't exist for some reason (maybe an installation problem), you can run $ORACLE_HOME/bin/genclntsh to recreate them.
    I also still had problems getting the makefile to find this file, so I modified the $ORACLE_HOME/lib/sysliblist file and added -lclntsh to the end, which works fine for me now.
    Hope this helps... Frank

  • Help with linking ProC sample1.pc

    Hi, I can precompile and compile the demo program sample1.pc,
    but when I link it fails. Here is the command I'm using:
    proc MODE=ORACLE sample1.pc
    gcc -I$ORACLE_HOME/precomp/public -L$ORACLE_HOME/lib -lsql
    sample1.c
    The error I get is
    In function 'sq_error':
    undefined reference to 'sqlglm'
    undefined reference to 'sqlcxt'
    In function 'main':
    undefined reference to 'sqlcxt'
    undefined reference to 'sqlcxt'
    undefined reference to 'sqlcxt'
    sqlcxt is a function in the sql lib, so I thought the linker
    might not be finding the library, but it is. I get an error if
    I try making the library path incorrect and using -lsql
    I'm using gcc 2.7.2.3 and RedHat 5.2
    If anyone can tell me what I need to do or change I would really
    appreciate it.
    Thanks! R. Patton
    null

    Valeri Velkov (guest) wrote:
    : Hi there ,
    : I'm sory I added an extra message repeating yours !
    : I'm using RedHat 5.1 and the same gcc 2.7.2.3.
    : As some of the header files were not in the /usr/include
    : I created symbolic links to the correct directory in the
    : /usr/include .
    : But my problem is even worse than yours !!!
    : proc core-dumps BIG TIME !
    : Any help on this will be appreciated !
    : Thanks
    : Valeri
    : : I'm using gcc 2.7.2.3 and RedHat 5.2
    : : If anyone can tell me what I need to do or change I would
    : really
    : : appreciate it.
    : : Thanks! R. Patton
    Whenever proc core-dumps, the first thing to check is that
    LD_LIBRARY_PATH contains $ORACLE_HOME/lib.
    Then check that $ORACLE_HOME/precomp/admin/pcscfg.cfg is
    correct (I needed to expand $ORACLE_HOME to get it working).
    And finally, you NEED to use the supplied makefile (demo_proc.mk)
    to call proc. (do a "make -f demo_proc.mk myfile.c"
    instead of "proc myfile")
    I have been using Pro*C on Linux for some time, and it worked
    fine until I upgraded gcc (I now have gcc 2.8.1 installed, and
    Pro*C hasn't worked since - so beware)
    null

  • Insert With Stored Procs

    Hello All!
    I want to do an insert into my database using Stored procedures. I already know how to delete and select.. i'm gonna post part of my code in wich i make a select to give u gives an idea of how im doing the statements.. if there's anything wrong please let me know.
    private void MostrarActionPerformed(java.awt.event.ActionEvent evt) {                                       
        Connection conexion;
        Statement sentencia;
        ResultSet resultado;
        try{
            Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
         catch (Exception e){
        System.out.println("No se pudo conectar con el JDBC-ODBC");     
         return;
        try{
            conexion = DriverManager.getConnection("jdbc:odbc:con_sql","",""  );
            sentencia = conexion.createStatement();
             String a = ID_E.getText();
             int Empleado_ID = Integer.parseInt(a);
             resultado = sentencia.executeQuery("exec x "+a);
            while(resultado.next() ){
               String Name = resultado.getString("Nombre");
               String LastName = resultado.getString("Apellido");
               Nom.setText(Name);
               Ape.setText(LastName);
    catch( Exception e ) {
             System.out.println( e );
             return;
        }   

    you may have better luck at a good answer from the DataBase Forum. See http://forum.java.sun.com/forum.jspa?forumID=48

  • Stored proc returns zero result

    Hello, please help me. I am quite new to oracle stored
    procedures. I have a proc that returns data to cfm but it keeps
    giving zero results. But if i don't use stored proc, the same query
    gives me something. please help. my stored proc and cfm goes
    something like below:
    ************************************ stored procedures
    CREATE OR REPLACE PACKAGE PACK_REFCURSOR_NHM_TRANSACTION AS
    TYPE TRANS_TableRows IS REF CURSOR;
    PROCEDURE REFCUR_NHM_TRANSACTION (
    IN_sTMPACC IN varchar2,
    IN_sITEM_TYPES IN varchar2,
    OUT_TRANS OUT TRANS_TableRows);
    END PACK_REFCURSOR_NHM_TRANSACTION ;
    CREATE OR REPLACE PACKAGE BODY PACK_REFCURSOR_NHM_TRANSACTION
    AS
    PROCEDURE REFCUR_NHM_TRANSACTION (
    IN_sTMPACC IN varchar2,
    IN_sITEM_TYPES varchar2,
    OUT_TRANS OUT TRANS_TableRows)
    IS
    BEGIN
    OPEN OUT_TRANS FOR
    SELECT T.TRANSACTION_ID, T.TRANSACTION_TYPE,
    T.TRANSACTION_DATE, T.TRANSACTION_TIME,
    T.ITEM_CODE, 0 OE_DETAIL_ID,
    T.QUANTITY, T.LIST_PRICE, T.DISCOUNT, T.SALE_PRICE,
    T.GST_AMOUNT, 'I' INSURER_TYPE
    FROM NHM_TRANSACTION T
    WHERE DISPENSED_FLG = 'Y'
    AND T.ACCOUNT_ID = IN_sTMPACC
    AND T.TRANSACTION_TYPE IN ('01','02', '09')
    AND NVL(T.STATUS,'F') != 'C'
    AND T.BILLED_FLG = 'N'
    AND T.ITEM_TYPE IN (IN_sITEM_TYPES)
    AND T.BILL_ITEM_FLG = 'Y'
    UNION ALL
    SELECT T.OE_TRANSACTION_ID TRANSACTION_ID, TRANSACTION_TYPE,
    T.TRANSACTION_DATE,
    T.TRANSACTION_TIME, NVL(T.ITEM_CODE,T.PACKAGE_CODE)
    ITEM_CODE, T.OE_DETAIL_ID,
    T.QUANTITY, T.LIST_PRICE, T.DISCOUNT, T.SALE_PRICE,
    T.GST_AMOUNT, 'S' INSURER_TYPE
    FROM NHC_OE_TRANSACTION T, NHC_MASTER_ITEM M, NHM_PACKAGE P
    WHERE T.ACCOUNT_ID = IN_sTMPACC
    AND T.ITEM_CODE = M.ITEM_CODE(+)
    AND T.PACKAGE_CODE = P.PACKAGE_CODE(+)
    AND (DECODE(T.ITEM_CODE,NULL,P.BILL_OPTION,M.BILL_OPTION) in
    ('P','O','F'))
    AND NVL(T.STATUS,'F') != 'C'
    AND T.BILLED_FLG = 'N'
    AND ((T.TRANSACTION_TYPE = '09' AND STATUS IN ('P','R'))
    OR T.TRANSACTION_TYPE IN ('01','02','11','12', '10'))
    AND T.BILL_ITEM_FLG = 'Y'
    AND T.ITEM_TYPE IN (IN_sITEM_TYPES) ;
    END REFCUR_NHM_TRANSACTION ;
    END PACK_REFCURSOR_NHM_TRANSACTION ;
    *************** the cfm code (note: i am using coldfusion
    MX************
    <cfstoredproc datasource="#application.datasource#"
    procedure="NSCOCT.PACK_REFCURSOR_NHM_TRANSACTION.REFCUR_NHM_TRANSACTION">
    <cfprocparam type="IN" cfsqltype="CF_SQL_VARCHAR"
    value="#TMPACC#" dbvarname="IN_sTMPACC">
    <cfprocparam type="IN" cfsqltype="CF_SQL_VARCHAR"
    value="#QRYLOCITEM.ITEM_TYPE#" dbvarname="IN_sITEM_TYPES">
    <cfprocresult name="getPrescItems">
    </cfstoredproc>
    ***** i dumped getPrescItems and returns no data. it's
    suppose to return something . Any help is much appreciated. Thank
    you. *********

    just an update. i found out that it has something to do with
    the condition "IN". the values there is supposed to be a list (e.g.
    a,b,c,d,e,f,g). What I suspect is that when in stored proc, it
    interprets in the query as "IN('a,b,c,d,e,f,g')" instead of
    "IN('a','b','c','d','e','f','g')" which is what I actually want.
    I have also tried the quotedvaluelist in cfm but still no
    result, so i suspect again, using quotedvaluelist, that it
    interprets in the proc as "IN(''a','b','c','d','e','f','g'')".
    Can anybody help me whit this so i can have the proc
    interpret my IN condition as "IN('a','b','c','d','e','f','g')"?
    Thanks.

  • Stored Proc?

    Hi All!
    I want to write a Stored Procedure(Oracle)
    I have a table 'rejrea' as follows:
    Name NULL? Type
    TCT_IK NOT NULL NUMBER(8)
    TRJ_TRAN_SEQ_NB NOT NULL NUMBER(8)
    LTRR_REJ_RSN_NB NOT NULL NUMBER(4)
    I have table 'REJTAB'
    NAME NULL? TYPE
    TCT_IK NOT NULL NUMBER(8)
    TRJ_TRAN_SEQ_NB NOT NULL NUMBER(8)
    pur_id NOT NULL NUMBER(12)
    I have table 'look;
    NAME NULL? TYPE
    LTRR_REJ_RSN_NB NOT NULL NUMBER(4)
    LTRR_REJ_RSN_DS NOT NULL VARCHAR2(40)
    LTRR_UPDT_USR_ID NOT NULL VARCHAR2(10)
    LTRR_UPDT_TS NOT NULL DATE
    I have table purchase:
    NAME NULL? TYPE
    pur_id NOT NULL NUMBER(12)
    The stored peocedure when invoked from my java code,
    should be able to read a record from rejtab. Pickup pur_id from that
    record. Check if same pur_id value is present in purchase table,
    If not present, should look into 'look' table and get 'LTRR_REJ_RSN_NB'
    from look table for the given 'LTRR_REJ_RSN_DS('purchaser not found'). And then insert a record
    in rejrea table for that TCT_IK. It should do this for all the records
    found in 'REJTAB'.
    How can I achieve this. Any help with stored procedure appreciated.
    regards,
    sapa

    Hi
    This question of yours would be better answered in some Oracle forum, you are in a wrong place to look for an answer.
    Swaraj

  • Stored Proc with SSRS multi value parameter gives " Must Declare scalar Varaiable @StateID

    Hi All,
    I have one stored proc with @fromDate , @Todate and multivalue input
    parameter@StateID of type integer.
    When I run below stored proc via SSRS by selecting multiple values thru multiValue parameter into @StateID...it gives error saying "Must Declare scalar variable @StateID"
    Not sure what is wrong with the input parameters.
    ID is Integer type in all the 3 tables - dbo.EastCities, dbo.WestCities  , dbo.Country
    I need help fixing this  "Must Declare scalar variable @StateID" error
    This is the UDF split() I am using..
    Function:
    CREATE FUNCTION dbo.SplitStateID
    (    @List VARCHAR(MAX))
    RETURNS TABLE
    AS   
    RETURN   
    (        SELECT DISTINCT [Value] = CONVERT(INT, LTRIM(RTRIM(CONVERT( VARCHAR(12),SUBSTRING(@List, Number, CHARINDEX(',', @List + ',', Number) - Number))))
     FROM  dbo.Numbers       
     WHERE Number <= CONVERT(INT, LEN(@List))AND SUBSTRING(',' + @List, Number, 1) = ','    );
     GO
     SELECT [Value] FROM dbo.SplitStateID('10,30,50');
    Also, I have created dbo.Numbers table which is used in udf..
    reference url -- > 
    http://sqlblog.com/blogs/aaron_bertrand/archive/2009/08/01/processing-a-list-of-integers-my-approach.aspx
    SET NOCOUNT ON;
    DECLARE @UpperLimit INT;
    SET @UpperLimit = 10000;
    WITH n AS(   
    SELECT        rn = ROW_NUMBER() OVER        (ORDER BY s1.[object_id])   
    FROM sys.objects AS s1   
    CROSS JOIN sys.objects AS s2   
    CROSS JOIN sys.objects AS s3)
    SELECT [Number] = rn - 1
    INTO dbo.Numbers FROM n
    WHERE rn <= @UpperLimit + 1;
    CREATE UNIQUE CLUSTERED INDEX n ON dbo.Numbers([Number]);
    Stored procedure:
    Create Procedure dbo.CountrySelection
    ( @FromDate Date, @ToDate Date, @StateID Int)
    AS
    BEGIN
    set nocount on;
    SELECT * INTO #EastCities
    FROM (
    SELECT ID,Description from dbo.EastCities
    Where ID IN (SELECT Value from dbo.SplitStateID(@StateID))
    ) AS A
    SELECT * INTO #WestCities
    FROM (
    SELECT ID,Description from dbo.WestCities
    Where ID IN (SELECT Value from dbo.SplitStateID(@StateID))
    ) AS B
    SELECT * INTO #Country
    FROM (
    SELECT ID , Description, State,Country From dbo.Country
    ) AS C
    SELECT EC.ID AS East, WC.ID AS West , EC.Description AS EastDesc, WC.Description AS WestDesc, CT.State, CT.Country
    FROM #Country CT
    LEFT JOIN #EastCities EC ON CT.ID=EC.ID
    LEFT JOIN #WestCities WC ON CT.ID=WC.ID
    DROP TABLE #EastCities
    DROP TABLE #WestCities
    DROP TABLE #Country
    END
    Above 3 temp tables are joined by #Country.ID key
    It works fine when single value is passed in @StateID
    Exec dbo.CountrySelection '01/01/2010','02/01/2010',10
    It fails when multi value passed into @StateID
    Exec dbo.CountrySelection '01/01/2010','02/01/2010','10,30,40'
    SSRS error log shows "Must declare scalar variable @StateID"
    Need help in fixing this issue.
    Thanks,
    RH
    sql

    Visakh,
    I changed @StateID date type to varchar(max) and still I get this error.  
    System.Data.SqlClient.SqlException: Must declare the scalar variable "@StateID".
       at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
       at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
    I am running this SO in SSRS quert Type =Text
    Actually sp created on db2 database and due to some limitations I am running(via SSRS) this from different db1 database data source within the same db server. When I run this sp from SSRS query designer(edit query designer button) and pass
    multivalue parameters to @StateID as 10 , 20 it works and gives expected resultset.
    Thanks,
    RH
    sql

  • Table names in generated stored procs are qualified with sa schema name

    I am using OMW 9.2.0.1.2 with the 9.2.0.1.3 SQL Serevr plugin to help with a SQL Server 7 to Oracle 9.2.0.1 migration on NT.
    As is common with SQL Server databases, the dbo is sa. I don't want my Oracle schema to be called sa. I have succesfully gotten around this by renaming the sa user in the Oracle model in OMW.
    However, the stored procedure code that OMW generates has table names qualified with sa as the schema (the tables names in the original T/SQL procs were not qualified).
    How can I stop OMW from generating table names qualified with sa?
    Thanks.

    Hi,
    this is a bug in the OMWB. As a workaround, you can generate the migration scripts (see reference guide and user guide for more information) from the OMWB Oracle Model and then edit these scripts to ensure that the 'sa' prefix does not appear in the text of the stored procedures. Then use these scripts to generate the schema in your database.
    An alternative is to migrate the stored procedures, schema and data over to the Oracle database using OMWB and then open each procedure in Enterprise Manager, remove the references to the 'sa' prefix and re-compile the procedure.
    I will keep you updated on the release this fix will appear in.
    I hope this helps,
    Tom.

  • BPC5.1 - Data manager package to Stored proc with custom return codes

    Hi all,
    Does anyone have experience passing the return codes from a stored procedure back into the eData "view status" package progress or event log details?
    When my stored procedure throws errors, the offending SQL code shows up in the pacakge details, which is helpful. But what I'd really like is to structure my stored proc with return codes
    0 = everything's wonderful
    1 = invalid category / time combination
    2 = unauthorized
    3 = no data to process
    And then handle these codes as either "completed" "warning" or "error" in the package progress.
    And ideally, I'd like to put some meaningful message about the warnings & errors, directly into the log details, so the user can fix the problem themselves rather than ask the IT guy to trouble-shoot.
    Any tips? I've started playing with using the on-complete, on-success, on-failure routing of different tasks within the DTSX package (SQL 2005), but I'm just working on a trial-and-error basis right now. (With # of errors = # of trials.)
    Thanks,
    Tim

    In case anyone's interested, I've solved this by tracking my return codes as a package variable.
    Within the package, I have conditional logic moving from task to task, evaluating the return code to check for various conditions, and selecting which tasks to perform accordingly.
    In the last task, I run a final stored procedure which posts some data (completion time & status) to a custom transaction log table, and then if the return code is not zero, I script and execute some SQL which I know will throw a "fake" error. The SQL statement itself includes the key information I want the end user to see. For example
    Select InvalidEntitySelection [USEast1],TransactionID [12340]  from ThisTableDoesntExist
    Select UnauthorizedUser [Tim], TransactionID [12345] from ThisTableDoesntExist
    Select WorkStatusIsLocked [USEast1 Actual 2008], TransactionID [12345] from ThisTableDoesntExist
    It's not exactly elegant, but it gets the message across, which is all that I need. In this way, the end user sees that the package failed with an error, and when they look at the package details, they can see the problem. They can pass on the transaction ID to an administrator to look into the details, if they can't figure it out on their own.
    Sorin, I never managed to figure out how to use a VB task to send the information back to the user, plus force the package to end in an error. I'm sure there's a way to do so, but this seems to work for my requirement.
    I'm not entirely happy with the "fake error" approach, but I don't know if BPC has any support for "intentional" programming of errors in the DTS scripting toolset.
    Thanks,
    Tim

  • ORA-03113 with pool and stored proc

    We are experiencing a strange error when calling a stored procedure using a
    connection pool (WLS 5.1 SP10, Oracle 8). Everything works fine until the
    stored procedure raises a user-defined exception. When the connection is
    used again, we get the 03113 error. It appears that the connection is OK
    due to the testConnsOnReserve not returning an error, but on the next stored
    procedure call, the error happens. The database guys have no answers. Does
    anyone have a clue?
    Here is an ouput log showing what happens (this was done with a pool with
    only one connection):
    Got the exception for no BPI Record
    getConnection returning
    driver[className=weblogic.jdbc.pool.Driver,weblogic.jdbc.pool.Driver@d6b11fc
    7]
    Executing: begin pkg_BPI.p_getBPITrckIdForDataTblPk(:1, :2, :3, :4, :5, :6,
    :7, :8); end;
    SQLException: SQLState() vendor code(20003)
    java.sql.SQLException: ORA-20003: Error at step- Select..,procedure
    p_getBPITrckIdForDataTblPk No BPI Record Found...
    ORA-01403: no data found
    ORA-06512: at "CIFPROC.PKG_UTIL", line 381
    ORA-06512: at "CIFPROC.PKG_BPI", line 901
    ORA-06512: at line 1
    at weblogic.db.oci.OciCursor.getCDAException(OciCursor.java:230)
    at weblogic.jdbcbase.oci.Statement.executeUpdate(Statement.java,
    Compiled Code)
    at weblogic.jdbcbase.oci.Statement.execute(Statement.java, Compiled
    Code)
    at
    weblogic.jdbc.pool.PreparedStatement.execute(PreparedStatement.java,
    Compiled Code)
    at com.juniper.core.comm.JDBCProcHelper.execute(JDBCProcHelper.java,
    Compiled Code)
    at
    com.juniper.core.tracking.BusinessProcess.loadByKey(BusinessProcess.java,
    Compiled Code)
    at
    com.juniper.core.tracking.BusinessProcess.findProcessByKey(BusinessProcess.j
    ava, Compiled Code)
    at
    com.juniper.core.tracking.test.TestBusinessProcess.doGet(TestBusinessProcess
    .java, Compiled Code)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:865)
    at
    weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
    :120)
    at
    weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImp
    l.java:922)
    at
    weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImp
    l.java:886)
    at
    weblogic.servlet.internal.ServletContextManager.invokeServlet(ServletContext
    Manager.java:269)
    at
    weblogic.socket.MuxableSocketHTTP.invokeServlet(MuxableSocketHTTP.java:380)
    at
    weblogic.socket.MuxableSocketHTTP.execute(MuxableSocketHTTP.java:268)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java, Compiled
    Code)
    Release test worked!
    Parsing: select count(*) from dual
    Executing: select count(*) from dual
    Obtain the connection again
    DriverManager.getConnection("jdbc:weblogic:pool:CifPool")
    trying
    driver[className=weblogic.jdbc.pool.Driver,weblogic.jdbc.pool.Driver@d6b11fc
    7]
    Reserve test worked!
    Parsing: select count(*) from dual
    Executing: select count(*) from dual
    getConnection returning
    driver[className=weblogic.jdbc.pool.Driver,weblogic.jdbc.pool.Driver@d6b11fc
    7]
    Calling stored proc and get comm error
    Executing: begin pkg_BPI.p_getBPITrckIdForDataTblPk(:1, :2, :3, :4, :5, :6,
    :7, :8); end;
    SQLException: SQLState() vendor code(3113)
    java.sql.SQLException: ORA-03113: end-of-file on communication channel
    at weblogic.db.oci.OciCursor.getCDAException(OciCursor.java:230)
    at weblogic.jdbcbase.oci.Statement.executeUpdate(Statement.java,
    Compiled Code)
    at weblogic.jdbcbase.oci.Statement.execute(Statement.java, Compiled
    Code)
    at
    weblogic.jdbc.pool.PreparedStatement.execute(PreparedStatement.java,
    Compiled Code)
    at com.juniper.core.comm.JDBCProcHelper.execute(JDBCProcHelper.java,
    Compiled Code)
    at
    com.juniper.core.tracking.BusinessProcess.loadByKey(BusinessProcess.java,
    Compiled Code)
    at
    com.juniper.core.tracking.BusinessProcess.findProcessByKey(BusinessProcess.j
    ava, Compiled Code)
    at
    com.juniper.core.tracking.test.TestBusinessProcess.doGet(TestBusinessProcess
    .java, Compiled Code)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:865)
    at
    weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
    :120)
    at
    weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImp
    l.java:922)
    at
    weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImp
    l.java:886)
    at
    weblogic.servlet.internal.ServletContextManager.invokeServlet(ServletContext
    Manager.java:269)
    at
    weblogic.socket.MuxableSocketHTTP.invokeServlet(MuxableSocketHTTP.java:380)
    at
    weblogic.socket.MuxableSocketHTTP.execute(MuxableSocketHTTP.java:268)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java, Compiled
    Code)
    Release test fails!
    Parsing: select count(*) from dual
    SQLException: SQLState() vendor code(3114)
    java.sql.SQLException: ORA-03114: not connected to ORACLE
    at weblogic.db.oci.OciCursor.getCDAException(OciCursor.java:230)
    at weblogic.jdbcbase.oci.Statement.execute(Statement.java, Compiled
    Code)
    at
    weblogic.jdbc.common.internal.ConnectionEnv.test(ConnectionEnv.java,
    Compiled Code)
    at
    weblogic.common.internal.ResourceAllocator.release(ResourceAllocator.java,
    Compiled Code)
    at
    weblogic.common.internal.ResourceAllocator.release(ResourceAllocator.java,
    Compiled Code)
    at
    weblogic.jdbc.common.internal.ConnectionPool.release(ConnectionPool.java,
    Compiled Code)
    at weblogic.jdbcbase.pool.Connection.close(Connection.java, Compiled
    Code)
    at
    com.juniper.core.comm.JDBCProcHelper.closeConnection(JDBCProcHelper.java,
    Compiled Code)
    at
    com.juniper.core.tracking.BusinessProcess.closeConnection(BusinessProcess.ja
    va, Compiled Code)
    at
    com.juniper.core.tracking.BusinessProcess.loadByKey(BusinessProcess.java,
    Compiled Code)
    at
    com.juniper.core.tracking.BusinessProcess.findProcessByKey(BusinessProcess.j
    ava, Compiled Code)
    at
    com.juniper.core.tracking.test.TestBusinessProcess.doGet(TestBusinessProcess
    .java, Compiled Code)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:865)
    at
    weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
    :120)
    at
    weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImp
    l.java:922)
    at
    weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImp
    l.java:886)
    at
    weblogic.servlet.internal.ServletContextManager.invokeServlet(ServletContext
    Manager.java:269)
    at
    weblogic.socket.MuxableSocketHTTP.invokeServlet(MuxableSocketHTTP.java:380)
    at
    weblogic.socket.MuxableSocketHTTP.execute(MuxableSocketHTTP.java:268)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java, Compiled
    Code)
    Regenerating connection
    DriverManager.getDriver("jdbc20:weblogic:oracle:DCIF")
    trying
    driver[className=weblogic.jdbc.pool.Driver,weblogic.jdbc.pool.Driver@d6b11fc
    7]
    trying
    driver[className=weblogic.jdbc20.oci.Driver,weblogic.jdbc20.oci.Driver@d63d1
    fcf]
    getDriver returning
    driver[className=weblogic.jdbc20.oci.Driver,weblogic.jdbc20.oci.Driver@d63d1
    fcf]
    weblogic.jdbcbase.oci.Driver checking: jdbc20:weblogic:oracle:DCIF
    Connecting to database using: bmgr/********@DCIF at 0
    SQLException: SQLState() vendor code(1012)
    java.sql.SQLException: ORA-01012: not logged on - (bmgr/********@DCIF)
    at
    weblogic.db.oci.OciConnection.getLDAException(OciConnection.java:143)
    at weblogic.jdbcbase.oci.Driver.connect(Driver.java:157)
    at
    weblogic.jdbc.common.internal.ConnectionEnvFactory.makeConnection(Connection
    EnvFactory.java:153)
    at
    weblogic.jdbc.common.internal.ConnectionEnvFactory.refreshResource(Connectio
    nEnvFactory.java:207)
    at
    weblogic.jdbc.common.internal.ConnectionEnv.refresh(ConnectionEnv.java:677)
    at
    weblogic.common.internal.ResourceAllocator.resetThisOne(ResourceAllocator.ja
    va, Compiled Code)
    at
    weblogic.common.internal.ResourceAllocator.release(ResourceAllocator.java,
    Compiled Code)
    at
    weblogic.common.internal.ResourceAllocator.release(ResourceAllocator.java,
    Compiled Code)
    at
    weblogic.jdbc.common.internal.ConnectionPool.release(ConnectionPool.java,
    Compiled Code)
    at weblogic.jdbcbase.pool.Connection.close(Connection.java, Compiled
    Code)
    at
    com.juniper.core.comm.JDBCProcHelper.closeConnection(JDBCProcHelper.java,
    Compiled Code)
    at
    com.juniper.core.tracking.BusinessProcess.closeConnection(BusinessProcess.ja
    va, Compiled Code)
    at
    com.juniper.core.tracking.BusinessProcess.loadByKey(BusinessProcess.java,
    Compiled Code)
    at
    com.juniper.core.tracking.BusinessProcess.findProcessByKey(BusinessProcess.j
    ava, Compiled Code)
    at
    com.juniper.core.tracking.test.TestBusinessProcess.doGet(TestBusinessProcess
    .java, Compiled Code)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:865)
    at
    weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
    :120)
    at
    weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImp
    l.java:922)
    at
    weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImp
    l.java:886)
    at
    weblogic.servlet.internal.ServletContextManager.invokeServlet(ServletContext
    Manager.java:269)
    at
    weblogic.socket.MuxableSocketHTTP.invokeServlet(MuxableSocketHTTP.java:380)
    at
    weblogic.socket.MuxableSocketHTTP.execute(MuxableSocketHTTP.java:268)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java, Compiled
    Code)
    weblogic.jdbcbase.oci.Driver checking: jdbc20:weblogic:oracle:DCIF
    Connecting to database using: bmgr/********@DCIF at 0
    Connected to database at: 160
    Parsing: select length(SYSDATE) from dual
    Executing: select length(SYSDATE) from dual
    Parsing: select VALUE from V$NLS_PARAMETERS where
    PARAMETER='NLS_NUMERIC_CHARACTERS'
    Executing: select VALUE from V$NLS_PARAMETERS where
    PARAMETER='NLS_NUMERIC_CHARACTERS'
    Done logging in at: 170
    Connection: using OCI API: OCI8
    Done with connection regen
    DriverManager.getConnection("jdbc:weblogic:pool:CifPool")
    trying
    driver[className=weblogic.jdbc.pool.Driver,weblogic.jdbc.pool.Driver@d6b11fc
    7]
    Parsing: select count(*) from dual
    Executing: select count(*) from dual
    getConnection returning
    driver[className=weblogic.jdbc.pool.Driver,weblogic.jdbc.pool.Driver@d6b11fc
    7]
    Parsing: begin pkg_BPI.p_getBPITrckIdForDataTblPk(:1, :2, :3, :4, :5, :6,
    :7, :8); end;
    Executing: begin pkg_BPI.p_getBPITrckIdForDataTblPk(:1, :2, :3, :4, :5, :6,
    :7, :8); end;
    Parsing: select count(*) from dual
    Executing: select count(*) from dual
    DriverManager.getConnection("jdbc:weblogic:pool:CifPool")
    trying
    driver[className=weblogic.jdbc.pool.Driver,weblogic.jdbc.pool.Driver@d6b11fc
    7]
    Parsing: select count(*) from dual
    Executing: select count(*) from dual
    getConnection returning
    driver[className=weblogic.jdbc.pool.Driver,weblogic.jdbc.pool.Driver@d6b11fc
    7]
    Parsing: begin pkg_BPI.p_getBPIStates(:1, :2); end;
    Executing: begin pkg_BPI.p_getBPIStates(:1, :2); end;
    Parsing: select count(*) from dual
    Executing: select count(*) from dual
    DriverManager.getConnection("jdbc:weblogic:pool:CifPool")
    trying
    driver[className=weblogic.jdbc.pool.Driver,weblogic.jdbc.pool.Driver@d6b11fc
    7]
    Parsing: select count(*) from dual

    Well, this seems to do the trick. We'll keep testing, but the errors have
    now disappeared for all instances of this problem.
    Thanks for the help!
    JDB
    "John Bauer" <[email protected]> wrote in message
    news:[email protected]...
    We'll try this, but it seems to be connection-oriented. If we have a pool
    of 5 connections, and an exception happens, only that connection seems tobe
    affected. The other connections in the pool work fine, and the proc works
    for those connections.
    "Joseph Weinstein" <[email protected]> wrote in message
    news:[email protected]...
    Hi.
    The issue is likely related to our caching of PreparedStatements
    for performance. If some DBMS failure occurs which could invalidate
    a PreparedStatement/cursor such that it could never be re-used,
    even after clearParameters) are called etc, then this case might
    occur. Please take the attached jar file, and add it to the
    weblogic.classpath ahead of the standard weblogic stuff, by
    editing your startWebLogic script. This will turn off caching, and
    should make the problem go away. Let me know...
    Joe
    John Bauer wrote:
    Here is our configuration.
    weblogic.jdbc.connectionPool.CifPool=\
    url=jdbc20:weblogic:oracle:QCIF,\
    driver=weblogic.jdbc20.oci.Driver,\
    loginDelaySecs=1,\
    initialCapacity=5,\
    maxCapacity=20,\
    capacityIncrement=2,\
    allowShrinking=true,\
    shrinkPeriodMins=30,\
    testTable=dual,\
    testConnsOnRelease=true,\
    props=user=BMGR;password=djr0t$
    We are using OCI 8.1.6
    "Maria Salzberger" <[email protected]> wrote in message
    news:[email protected]...
    Hi John,
    I have researched about this - but could not find a known issue
    which
    may
    be
    related to this.
    Which JDBC driver are you using?
    Kind Regards
    Maria Salzberger
    Developer Relations Engineer
    BEA Customer Support
    John Bauer schrieb in Nachricht <[email protected]>...
    We are experiencing a strange error when calling a stored procedure
    using
    a
    connection pool (WLS 5.1 SP10, Oracle 8). Everything works fine
    until
    the
    stored procedure raises a user-defined exception. When the
    connection is
    used again, we get the 03113 error. It appears that the connectionis OK
    due to the testConnsOnReserve not returning an error, but on the
    next
    stored
    procedure call, the error happens. The database guys have no
    answers.
    Does
    anyone have a clue?
    Here is an ouput log showing what happens (this was done with a
    pool
    with
    only one connection):
    Got the exception for no BPI Record
    getConnection returningdriver[className=weblogic.jdbc.pool.Driver,weblogic.jdbc.pool.Driver@d6b11f
    c
    7]
    Executing: begin pkg_BPI.p_getBPITrckIdForDataTblPk(:1, :2, :3, :4,
    :5,
    :6,
    :7, :8); end;
    SQLException: SQLState() vendor code(20003)
    java.sql.SQLException: ORA-20003: Error at step- Select..,procedure
    p_getBPITrckIdForDataTblPk No BPI Record Found...
    ORA-01403: no data found
    ORA-06512: at "CIFPROC.PKG_UTIL", line 381
    ORA-06512: at "CIFPROC.PKG_BPI", line 901
    ORA-06512: at line 1
    at
    weblogic.db.oci.OciCursor.getCDAException(OciCursor.java:230)
    atweblogic.jdbcbase.oci.Statement.executeUpdate(Statement.java,
    Compiled Code)
    at weblogic.jdbcbase.oci.Statement.execute(Statement.java,Compiled
    Code)
    at
    weblogic.jdbc.pool.PreparedStatement.execute(PreparedStatement.java,
    Compiled Code)
    atcom.juniper.core.comm.JDBCProcHelper.execute(JDBCProcHelper.java,
    Compiled Code)
    at
    com.juniper.core.tracking.BusinessProcess.loadByKey(BusinessProcess.java,
    Compiled Code)
    at
    com.juniper.core.tracking.BusinessProcess.findProcessByKey(BusinessProcess.
    j
    ava, Compiled Code)
    at
    com.juniper.core.tracking.test.TestBusinessProcess.doGet(TestBusinessProces
    s
    .java, Compiled Code)
    at
    javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
    atjavax.servlet.http.HttpServlet.service(HttpServlet.java:865)
    atweblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.jav
    a
    :120)
    at
    weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextIm
    p
    l.java:922)
    at
    weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextIm
    p
    l.java:886)
    at
    weblogic.servlet.internal.ServletContextManager.invokeServlet(ServletContex
    t
    Manager.java:269)
    at
    weblogic.socket.MuxableSocketHTTP.invokeServlet(MuxableSocketHTTP.java:380)
    atweblogic.socket.MuxableSocketHTTP.execute(MuxableSocketHTTP.java:268)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java,Compiled
    Code)
    Release test worked!
    Parsing: select count(*) from dual
    Executing: select count(*) from dual
    Obtain the connection again
    DriverManager.getConnection("jdbc:weblogic:pool:CifPool")
    tryingdriver[className=weblogic.jdbc.pool.Driver,weblogic.jdbc.pool.Driver@d6b11f
    c
    7]
    Reserve test worked!
    Parsing: select count(*) from dual
    Executing: select count(*) from dual
    getConnection returning
    driver[className=weblogic.jdbc.pool.Driver,weblogic.jdbc.pool.Driver@d6b11f
    c
    7]
    Calling stored proc and get comm error
    Executing: begin pkg_BPI.p_getBPITrckIdForDataTblPk(:1, :2, :3, :4,
    :5,
    :6,
    :7, :8); end;
    SQLException: SQLState() vendor code(3113)
    java.sql.SQLException: ORA-03113: end-of-file on communication
    channel
    atweblogic.db.oci.OciCursor.getCDAException(OciCursor.java:230)
    atweblogic.jdbcbase.oci.Statement.executeUpdate(Statement.java,
    Compiled Code)
    at weblogic.jdbcbase.oci.Statement.execute(Statement.java,Compiled
    Code)
    at
    weblogic.jdbc.pool.PreparedStatement.execute(PreparedStatement.java,
    Compiled Code)
    atcom.juniper.core.comm.JDBCProcHelper.execute(JDBCProcHelper.java,
    Compiled Code)
    at
    com.juniper.core.tracking.BusinessProcess.loadByKey(BusinessProcess.java,
    Compiled Code)
    at
    com.juniper.core.tracking.BusinessProcess.findProcessByKey(BusinessProcess.
    j
    ava, Compiled Code)
    at
    com.juniper.core.tracking.test.TestBusinessProcess.doGet(TestBusinessProces
    s
    .java, Compiled Code)
    at
    javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
    atjavax.servlet.http.HttpServlet.service(HttpServlet.java:865)
    atweblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.jav
    a
    :120)
    at
    weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextIm
    p
    l.java:922)
    at
    weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextIm
    p
    l.java:886)
    at
    weblogic.servlet.internal.ServletContextManager.invokeServlet(ServletContex
    t
    Manager.java:269)
    at
    weblogic.socket.MuxableSocketHTTP.invokeServlet(MuxableSocketHTTP.java:380)
    atweblogic.socket.MuxableSocketHTTP.execute(MuxableSocketHTTP.java:268)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java,Compiled
    Code)
    Release test fails!
    Parsing: select count(*) from dual
    SQLException: SQLState() vendor code(3114)
    java.sql.SQLException: ORA-03114: not connected to ORACLE
    atweblogic.db.oci.OciCursor.getCDAException(OciCursor.java:230)
    at weblogic.jdbcbase.oci.Statement.execute(Statement.java,Compiled
    Code)
    at
    weblogic.jdbc.common.internal.ConnectionEnv.test(ConnectionEnv.java,
    Compiled Code)
    atweblogic.common.internal.ResourceAllocator.release(ResourceAllocator.java,
    Compiled Code)
    atweblogic.common.internal.ResourceAllocator.release(ResourceAllocator.java,
    Compiled Code)
    atweblogic.jdbc.common.internal.ConnectionPool.release(ConnectionPool.java,
    Compiled Code)
    at weblogic.jdbcbase.pool.Connection.close(Connection.java,Compiled
    Code)
    at
    com.juniper.core.comm.JDBCProcHelper.closeConnection(JDBCProcHelper.java,
    Compiled Code)
    at
    com.juniper.core.tracking.BusinessProcess.closeConnection(BusinessProcess.j
    a
    va, Compiled Code)
    at
    com.juniper.core.tracking.BusinessProcess.loadByKey(BusinessProcess.java,
    Compiled Code)
    at
    com.juniper.core.tracking.BusinessProcess.findProcessByKey(BusinessProcess.
    j
    ava, Compiled Code)
    at
    com.juniper.core.tracking.test.TestBusinessProcess.doGet(TestBusinessProces
    s
    .java, Compiled Code)
    at
    javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
    atjavax.servlet.http.HttpServlet.service(HttpServlet.java:865)
    atweblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.jav
    a
    :120)
    at
    weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextIm
    p
    l.java:922)
    at
    weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextIm
    p
    l.java:886)
    at
    weblogic.servlet.internal.ServletContextManager.invokeServlet(ServletContex
    t
    Manager.java:269)
    at
    weblogic.socket.MuxableSocketHTTP.invokeServlet(MuxableSocketHTTP.java:380)
    atweblogic.socket.MuxableSocketHTTP.execute(MuxableSocketHTTP.java:268)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java,Compiled
    Code)
    Regenerating connection
    DriverManager.getDriver("jdbc20:weblogic:oracle:DCIF")
    tryingdriver[className=weblogic.jdbc.pool.Driver,weblogic.jdbc.pool.Driver@d6b11f
    c
    7]
    trying
    driver[className=weblogic.jdbc20.oci.Driver,weblogic.jdbc20.oci.Driver@d63d
    1
    fcf]
    getDriver returning
    driver[className=weblogic.jdbc20.oci.Driver,weblogic.jdbc20.oci.Driver@d63d
    1
    fcf]
    weblogic.jdbcbase.oci.Driver checking: jdbc20:weblogic:oracle:DCIF
    Connecting to database using: bmgr/********@DCIF at 0
    SQLException: SQLState() vendor code(1012)
    java.sql.SQLException: ORA-01012: not logged on -
    (bmgr/********@DCIF)
    atweblogic.db.oci.OciConnection.getLDAException(OciConnection.java:143)
    at weblogic.jdbcbase.oci.Driver.connect(Driver.java:157)
    atweblogic.jdbc.common.internal.ConnectionEnvFactory.makeConnection(Connectio
    n
    EnvFactory.java:153)
    at
    weblogic.jdbc.common.internal.ConnectionEnvFactory.refreshResource(Connecti
    o
    nEnvFactory.java:207)
    at
    weblogic.jdbc.common.internal.ConnectionEnv.refresh(ConnectionEnv.java:677)
    atweblogic.common.internal.ResourceAllocator.resetThisOne(ResourceAllocator.j
    a
    va, Compiled Code)
    at
    weblogic.common.internal.ResourceAllocator.release(ResourceAllocator.java,
    Compiled Code)
    atweblogic.common.internal.ResourceAllocator.release(ResourceAllocator.java,
    Compiled Code)
    atweblogic.jdbc.common.internal.ConnectionPool.release(ConnectionPool.java,
    Compiled Code)
    at weblogic.jdbcbase.pool.Connection.close(Connection.java,Compiled
    Code)
    at
    com.juniper.core.comm.JDBCProcHelper.closeConnection(JDBCProcHelper.java,
    Compiled Code)
    at
    com.juniper.core.tracking.BusinessProcess.closeConnection(BusinessProcess.j
    a
    va, Compiled Code)
    at
    com.juniper.core.tracking.BusinessProcess.loadByKey(BusinessProcess.java,
    Compiled Code)
    at
    com.juniper.core.tracking.BusinessProcess.findProcessByKey(BusinessProcess.
    j
    ava, Compiled Code)
    at
    com.juniper.core.tracking.test.TestBusinessProcess.doGet(TestBusinessProces
    s
    .java, Compiled Code)
    at
    javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
    atjavax.servlet.http.HttpServlet.service(HttpServlet.java:865)
    atweblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.jav
    a
    :120)
    at
    weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextIm
    p
    l.java:922)
    at
    weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextIm
    p
    l.java:886)
    at
    weblogic.servlet.internal.ServletContextManager.invokeServlet(ServletContex
    t
    Manager.java:269)
    at
    weblogic.socket.MuxableSocketHTTP.invokeServlet(MuxableSocketHTTP.java:380)
    atweblogic.socket.MuxableSocketHTTP.execute(MuxableSocketHTTP.java:268)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java,Compiled
    Code)
    weblogic.jdbcbase.oci.Driver checking: jdbc20:weblogic:oracle:DCIF
    Connecting to database using: bmgr/********@DCIF at 0
    Connected to database at: 160
    Parsing: select length(SYSDATE) from dual
    Executing: select length(SYSDATE) from dual
    Parsing: select VALUE from V$NLS_PARAMETERS where
    PARAMETER='NLS_NUMERIC_CHARACTERS'
    Executing: select VALUE from V$NLS_PARAMETERS where
    PARAMETER='NLS_NUMERIC_CHARACTERS'
    Done logging in at: 170
    Connection: using OCI API: OCI8
    Done with connection regen
    DriverManager.getConnection("jdbc:weblogic:pool:CifPool")
    tryingdriver[className=weblogic.jdbc.pool.Driver,weblogic.jdbc.pool.Driver@d6b11f
    c
    7]
    Parsing: select count(*) from dual
    Executing: select count(*) from dual
    getConnection returning
    driver[className=weblogic.jdbc.pool.Driver,weblogic.jdbc.pool.Driver@d6b11f
    c
    7]
    Parsing: begin pkg_BPI.p_getBPITrckIdForDataTblPk(:1, :2, :3, :4,
    :5,
    :6,
    :7, :8); end;
    Executing: begin pkg_BPI.p_getBPITrckIdForDataTblPk(:1, :2, :3, :4,:5,
    :6,
    :7, :8); end;
    Parsing: select count(*) from dual
    Executing: select count(*) from dual
    DriverManager.getConnection("jdbc:weblogic:pool:CifPool")
    trying
    driver[className=weblogic.jdbc.pool.Driver,weblogic.jdbc.pool.Driver@d6b11f
    c
    7]
    Parsing: select count(*) from dual
    Executing: select count(*) from dual
    getConnection returning
    driver[className=weblogic.jdbc.pool.Driver,weblogic.jdbc.pool.Driver@d6b11f
    c
    7]
    Parsing: begin pkg_BPI.p_getBPIStates(:1, :2); end;
    Executing: begin pkg_BPI.p_getBPIStates(:1, :2); end;
    Parsing: select count(*) from dual
    Executing: select count(*) from dual
    DriverManager.getConnection("jdbc:weblogic:pool:CifPool")
    trying
    driver[className=weblogic.jdbc.pool.Driver,weblogic.jdbc.pool.Driver@d6b11f
    c
    7]
    Parsing: select count(*) from dual
    B.E.A. is now hiring! (12/14/01) If interested send a resume to
    [email protected]
    DIRECTOR OF PRODUCT PLANS AND STRATEGY San Francisco,
    CA
    E-SALES BUSINESS DEVELOPMENT REPRESENTATIVE Dallas, TX
    SOFTWARE ENGINEER (DBA) Liberty Corner,NJ
    SENIOR WEB DEVELOPER San Jose, CA
    SOFTWARE ENGINEER (ALL LEVELS), CARY, NORTHCAROLINA San Jose, CA
    SR. PRODUCT MANAGER Bellevue, WA
    SR. WEB DESIGNER San Jose, CA
    Channel Marketing Manager - EMEA Region London, GBR
    DIRECTOR OF MARKETING STRATEGY, APPLICATION SERVERS San Jose, CA
    SENIOR SOFTWARE ENGINEER (PLATFORM) San Jose, CA
    E-COMMERCE INTEGRATION ARCHITECT San Jose, CA
    QUALITY ASSURANCE ENGINEER Redmond, WA
    Services Development Manager (Business Development Manager - Services)Paris, FRA; Munich, DEU
    SENIOR SOFTWARE ENGINEER (PLATFORM) Redmond, WA
    E-Marketing Programs Specialist EMEA London, GBR
    BUSINESS DEVELOPMENT DIRECTOR - E COMMERCE INTEGRATION San Jose, CA
    MANAGER, E-SALES Plano, TX

  • Need Help With a Stored Procedure

    Help With a Stored Procedure
    Hi everyone.
    I am quite new relative to creating stored procedures, so I anticipate that whatever help I could get here would be very much helpful.
    Anyway, here is my case:
    I have a table where I need to update some fields with values coming from other tables. The other tables, let us just name as tblRef1, tblRef2 and tblRef3. For clarity, let us name tblToUpdate as my table to update. tblToUpdate has the following fields.
    PlanID
    EmployeeIndicator
    UpdatedBy
    CreatedBy
    tblRef1, tblRef2 and tblRef3 has the following fields:
    UserName
    EmpIndicator
    UserID
    In my stored procedure, I need to perform the following:
    1. Check each row in the tblToUpdate table. Get the CreatedBy value and compare the same to the UserName and UserID field of tblRef1. If no value exists in tblRef1, I then proceed to check if the value exists in the same fields in tblRef2 and tblRef3.
    2. If the value is found, then I would update the EmployeeIndicator field in tblToUpdate with the value found on either tblRef1, tblRef2 or tblRef3.
    I am having some trouble writing the stored procedure to accomplish this. So far, I have written is the following:
    CREATE OR REPLACE PROCEDURE Proc_Upd IS v_rec NUMBER;
    v_plan_no tblToUpdate.PLANID%TYPE;
    v_ref_ind tblToUpdate.EMPLOYEEINDICATOR%TYPE;
    v_update_user tblToUpdate.UPDATEDBY%TYPE;
    v_created_by tblToUpdate.CREATEDBY%TYPE;
    v_correct_ref_ind tblToUpdate.EMPLOYEEIDICATOR%TYPE;
    CURSOR cur_plan IS SELECT PlanID, EmployeeIndicator, UPPER(UpdatedBy), UPPER(CreatedBy) FROM tblToUpdate;
    BEGIN
    Open cur_plan;
         LOOP
         FETCH cur_plan INTO v_plan_no, v_ref_ind, v_update_user, v_created_by;
              EXIT WHEN cur_plan%NOTFOUND;
              BEGIN
              -- Check if v_created_by has value.
                   IF v_created_by IS NOT NULL THEN
                   -- Get the EmpIndicator from the tblRef1, tblRef2 or tblRef3 based on CreatedBy
                   SELECT UPPER(EmpIndicator)
                        INTO v_correct_ref_ind
                        FROM tblRef1
                        WHERE UPPER(USERNAME) = v_created_by
                        OR UPPER(USERID) = v_created_by;
                        IF v_correct_ref_ind IS NOT NULL THEN
                        -- Update the Reference Indicator Field in the table TRP_BUSPLAN_HDR_T.
                             UPDATE TRP_BUSPLAN_HDR_T SET ref_ind = v_correct_ref_ind WHERE plan_no = v_plan_no;
                        ELSIF
                        -- Check the Other tables here????
                        END IF;
                   ELSIF v_created_by IS NULL THEN
                   -- Get the EmpIndicator based on the UpdatedBy
                        SELECT UPPER(EmpIndicator)
                        INTO v_correct_ref_ind
                        FROM tblRef1
                        WHERE UPPER(USERNAME) = v_update_user
                        OR UPPER(USERID) = v_created_by;
                        IF v_correct_ref_ind IS NOT NULL THEN
                        -- Update the Reference Indicator Field in the table TRP_BUSPLAN_HDR_T.
                             UPDATE TRP_BUSPLAN_HDR_T SET ref_ind = v_correct_ref_ind WHERE plan_no = v_plan_no;
                        ELSIF
                        -- Check the Other tables here????
                        END IF;
                   END IF;
              END;
         END LOOP;
         CLOSE cur_plan;
         COMMIT;
    END
    Please take note that the values in the column tblToUpdate.UpdatedBy or tblToUpdate.CreatedBy could match either the UserName or the UserID of the table tblRef1, tblRef2, or tblRef3.
    Kindly provide more insight. When I try to execute the procedure above, I get a DATA NOT FOUND ERROR.
    Thanks.

    Ah, ok; I got the updates the wrong way round then.
    BluShadow's single update sounds like what you need then.
    I also suggest you read this AskTom link to help you see why you should choose to write DML statements before choosing to write cursor + loops.
    In general, when you're being asked to update / insert / delete rows into a table or several tables, your first reaction should be: "Can I do this in SQL?" If you can, then putting it into a stored procedure is usually just a case of putting the sql statement inside the procedure header/footers - can't really get much more simple than that! *{;-)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

Maybe you are looking for

  • Crystal Reports To Oracle Reports (2.5 - 3.0)

    Hi Pals, We are working on converting VB Crystal Reports to Oracle reports 2.5 or 3.0. If some body could throw some light on how to get the work done, we would be very appreciative of the effort. Thanking you in advance! with thank, Jose. null

  • I can't sign into FaceTime or iMessage using my Apple ID.

    I Have been trying to sign into both iMessage and FaceTime on all my apple devices. And it won't sign into either one of them. I know the password is correct because I am able to use iTunes and iCloud. but its only with my Apple ID. I signed into Fac

  • What are the effects in processing office 2007 document filtering in Oracle

    Does any one know what are the effects or changes in Oracle text (9i - 9.2.0.4.0) while handling the MS office 2007 file formats? Does Oracle 10g solves the problem or will there be any patches released for this issue?

  • The "Scheduler" service is not in my management panel

    I'm trying to use /sign up for the scheduler service but I can't find it in my account. Basically it doesn't show up ( http://www.windowsazure.com/en-us/services/scheduler/ ) . 

  • Fastest Core 2 Duo or Quad for 965 Platinum?

    I've got a 965 Platinum running an e6700 core 2 duo with 4GB of 800 MHz memory.... I'll be going to to Windows 7 64-bit and since I'm using Photoshop CS4 and Lightroom I'd like to put in more horsepower and memory.  I looked at the CPU compatibility