Exel to SQL DFTask loads some Null records

I have an SSIS package to import Excel data into SQL. When I look at Excel I dont see ANY Null rows. However when I run the SSIS package and check SQL, It loads some NULL RECORDS IN SQL. WHy is that It loads Null records in SQL, When i cannot see the Null
recs In Excel?

That's because the person who created the Excel file and added the data to it pressed the "Enter" key on some of the empty cells under that specific column. In excel, such a row might look like any other empty, non-data row but for SSIS, its an
actual data row except that it doesn't have any value. SSIS treats a missing data value as a DBNULL and that's what you saw.
There are multiple ways of fixing this. 
1. Educate the creator of the excel to be more careful at the time of data entry.
2. Make that target column in the DB table as NOT NULL. 
3. Handle such "empty" data values as exception inside your SSIS (using a data flow task and ignoring such rows).
4. Switch to using CSV file format instead of excel format.
5. All of the above :)
Hope this helps.
Cheers!
Muqadder.

Similar Messages

  • Loading some records into Custom-R/3 table manually

    Hai
    I created one custom R/3 table. One of my friend load some records into that cutom table manaully. I want to load some more records manually.
    So how can i load some records into the custom R/3 Table manully . Please let me know
    i ll assing the points
    kumar

    Hi,
    you can do it with SE16 / SE16N or, if exists, via the maintenance tool SM30.
    Out of an excel sheet with the same structure can can copy the entries completey by cut & paste.

  • (8I) SQL*LOADER에서 | (PIPE LINE)을 RECORD SEPARATOR로 사용하기

    제품 : ORACLE SERVER
    작성날짜 : 2003-10-21
    ===============================================================
    (8I) SQL*LOADER에서 | (PIPE LINE)을 RECORD SEPARATOR로 사용하기
    ===============================================================
    PURPOSE
    Oracle8i부터는 , SQL*Loader을 사용할때 record terminator을 지정할 수 있게
    되었다.
    Explanation
    Oracle8i 이전에는 record seperator로 default로 linefeed(carriage return,
    newline 등)였다. 이전에는 VAR 또는 FIX 등의 적당한 file을 다루기 위한 옵션을
    주어야 하기 때문에 복잡한 감이 있었고 flexible하지 못했다.
    Oracle8i부터는 , SQL*Loader을 사용할때 record terminator을 지정할 수 있게
    되었다. newline 또는 carriage return 문자를 포함하는 data 또는 special 문자를
    포함하는 data를 load하고자 할때 record terminator를 hexadecimal로 지정하여 활용할 수 있다.
    Example
    다음의 예제는 '|' (pipe line)을 record separator로 사용한다.
    record separator를 사용하기 위해서 SQL*Loader의 control file에 'infile'절에 적당한 값을 지정하여야 한다.
    아래의 예는 '|' (pipe line)을 사용하기 위해서
    "str X'7c0a'"을 'infile'절에 지정하였다.
    --controlfile : test.ctl
    load data
    infile 'test.dat' "str X'7c0a'"
    into table test
    fields terminated by ',' optionally enclosed by '"'
    (col1, col2)
    --datafile: test.dat
    1,this is the first line of the first record
    this is the second|
    2,this is the first line of the second record
    this is the second|
    SQL> desc test
    Name Null? Type
    COL1 VARCHAR2(4)
    COL2 VARCHAR2(100)
    $ sqlldr scott/tiger control=test.ctl log=test.log
    load된 data을 보면 아래와 같이 carriage return이 들어가 있는 data가 한 column에
    제대로 들어간 것을 볼 수 있다.
    SQL> select * from test;
    COL1
    COL2
    1
    this is the first line of the first record
    this is the second
    2
    this is the first line of the second record
    this is the second
    RELATED DOCUMENT
    <Note:74719.1>

  • SQL*Loader-510: Physical record in data file (clob_table.ldr) is long

    If I generate loader / Insert script from Raptor, it's not working for Clob columns.
    I am getting error:
    SQL*Loader-510: Physical record in data file (clob_table.ldr) is long
    er than the maximum(1048576)
    What's the solution?
    Regards,

    Hi,
    Has the file been somehow changed by copying it between windows and unix? Ora file transfer done as binary or ASCII? The most common cause of your problem. Is if the end of line carriage return characters have been changed so they are no longer /n/r could this have happened? Can you open the file in a good editor or do an od command in unix to see what is actually present?
    Regards,
    Harry
    http://dbaharrison.blogspot.co.uk/

  • How to insert null record (some col) in table using loop

    Hi,
    How to insert null record (for some columns) in table using loop.
    sample data of x_tab
    order_id order_name
    231 xxx
    123
    345
    111 vvvv
    Thanks,
    Lakshman
    Edited by: kolipaka on Jul 5, 2012 1:37 PM

    You have a table
       CREATE TABLE tab (
          col1  NUMBER,
          col2  NUMBER,
          col3  NUMBER,
          col4  NUMBER
          col5  NUMBER)Now you insert:
       INSERT INTO tab (col2, col4) VALUES (5, 7);col1, col3 and col5 are NULL by default (there is no DEFAULT clause for these columns so they are NULL).

  • SQL History null records

    SQL Developer version 2.1.0.63, converted from 1.5.
    Conversion worked great, history came over. Perfect.
    When I run a query and it produces the first 50 records, it logs my command in history. When I scroll down and it retrieves the next 50 records, it inserts a null entry in history. Reviewed the SQLHistory.xml and confirmed that it is storing null in the file as seen below:
         <ROW>
              <SQL><![CDATA[null]]></SQL>
              <Connection><![CDATA[null]]></Connection>
              <TimeStamp><![CDATA[null]]></TimeStamp>
              <Type><![CDATA[null]]></Type>
              <Executed><![CDATA[null]]></Executed>
         </ROW>
    I haven't seen anyone else post this, and I'm hoping I'm not the only one experiencing this.
    Thanks for any help,
    Mark

    I ran into the same thing and to correct it I opened my SqlHistory.xml file and removed the following sections:
    <ROW>
              <SQL><![CDATA[null]]></SQL>
              <Connection><![CDATA[null]]></Connection>
              <TimeStamp><![CDATA[null]]></TimeStamp>
              <Type><![CDATA[null]]></Type>
              <Executed><![CDATA[null]]></Executed>
         </ROW>
    Once I removed all those I restarted sql-developer and it doesn't seem to be creating any more of those entries.
    Dennis

  • Loading multiple physical records into a logical record

    Hello,
    I'm not sure if this is the right place to post this thread.
    I have to import data from a fixed length positioned text file into a oracle table using sql loader.
    My sample input file (which has 3 columns) looks like:
    Col1 Col2 Col3
    1 A abcdefgh
    1 A ijklmnop
    1 A pqrstuv
    1 B abcdefgh
    1 B ijklmn
    2 A abcdefgh
    3 C hello
    3 C world
    The above text file should be loaded into the table as:
    Col1 Col2 Col3
    1 A abcdefghijklmnpqrstuv
    1 B abcdefghijklmn
    2 A abcdefgh
    3 C helloworld
    My question: Is there a way tht i can use the logic of loading multiple physical records into a logical record in my oracle tables. Please suggest.
    Thanks in advance.

    Hi,
    user1049091 wrote:
    Kulash,
    Thanks for your reply.
    The order of the concatenated strings is important as the whole text is split into several physical records in the flat file and has to be combined into 1 record in Oracle table.
    My scenario is we get these fixed length input files from mainframes on a daily basis and this data needs to be loaded into a oracle table for reporting purpose. It needs to be automated.
    Am still confused whether to use external table or a staging table using sql loader. Please advise with more clarity as am a beginner in sql loader. Thanks.I still think an external table would be better.
    You can create the external table like this:
    CREATE TABLE     fubar_external
    (      col1     NUMBER (2)
    ,      col2     VARCHAR2 (2)
    ,      col3     VARCHAR2 (50)
    ORGANIZATION  EXTERNAL
    (       TYPE             ORACLE_LOADER
         DEFAULT DIRECTORY  XYZ_DIR
         ACCESS PARAMETERS  (
                                 RECORDS DELIMITED BY     NEWLINE
                          FIELDS  (   col1        POSITION (1:2)
                                      ,   col2        POSITION (3:4)
                               ,   col3        POSITION (5:54)
         LOCATION        ('fubar.txt')
    );where XYZ_DIR is the Oracle Directory on the database server's file system, and fubar.txt is the name of the file on that directory. Every day, when you get new data, just overwrite fubar.txt. Whenever you query the table, Oracle will read the file that's currently on that directory. You don't have to drop and re-create the table every day.
    Note that the way you specify the columns is similar to how you do it in SQL*Loader, but the SEQUENCE generator doesn't work in external files; use ROWNUM instead.
    Do you need to populate a table with the concatenated col3's, or do you just need to display them in a query?
    Either way, you can reference the external table the same way you would reference a regular, internal table.

  • Sqlldr is loading only 1st record from xml document

    Hi,
    I am trying to load XML doc with multiple records using sql*loader.
    I have registered my XSD perfectly.
    This is my control file
    LOAD DATA
    INFILE *
    INTO TABLE Orders APPEND
    XMLType(xmldata)
    FIELDS(
         xmldata LOBFILE (CONSTANT FULDTL_2.xml)
    TERMINATED BY '???')
    BEGINDATA
    FULDTL_2.xml
    -- Here, what I have to give for TERMINATED BY '???'
    My xml doc
    <Order ID="146120486" Status="CL" Comments="Shipped On 08/05/2008"/>
    <Order ID="143417590" Status="CL" Comments="Handset/Device has been received at NRC" ShipDate=""/>
    sqlldr is loading only 1st record from the file.
    How can I make it to load all the records from my xml doc.
    Thanks in advance.

    thanks for both the replies above - essentially the same correct solution.
    something worth noting now that I've written and tested both a SAX solution and a DOM solution is that there is a significant (4 x) time penalty using SAX.
    I considering dividing the vector I am storing/recovering into chunks and saving each chunk separately using DOM to speed things up...
    any thoughts on this approach?

  • Essbase substitution variable used for SQL Dimension load-URGENT

    Hi All,
    I am creating one dimension through SQL Dimension load rule writing by parent child build rule. The SQL query is like below---
    distinct trim(dist_mobile),trim(ret_mobile) from dist_retailer al1 where al1.proc_dt=to_date(&Proc_date,'dd/mm/yyyy')
    When I fixed the value of proc_date (e.g.- '27/09/2008') then it is retrieving data properly, but when I try to make the same as a essbase variable as shown above (to give user the priviledge to select for which date data will be fetched from RDBMS to create the dim) and after setting the aforesaid value of that variable in essbase subs var screen and click 'OK/Retrieve' in rule,it is returning no rows executing the query as well as no error coming.
    I guess in query nothing is wrong but the subs variable part is not working. Can anybody please give some insight to resolve the problem.
    In this context, I would like to mention that I will have to use substitution variable in some other rule file also to automate the load process. How can I use essbase subs variable in SQL load rule? Could you please show me a proper summarise query illustrating how to use the subs var in aforesaid purpose for the sake of understanding?
    Thanks in advance.

    Hi,
    Sorry for delayed response. Appreciate your inputs. At last I have found out the solution which is as below----
    distinct trim(dist_mobile),trim(ret_mobile) from dist_retailer al1 where al1.proc_dt=to_date('&Proc_Dt','dd/mm/yyyy')
    after setting the substitution variable as Proc_Dt and set the value as 27/09/2008 (without any quotation mark or such sign) now I checked and now it is retrieving fine.
    Thanks & Regards.

  • Loading a blob record

    Hi,
    In my program I must put some new record in a database. The problems come when I have to load the column of blob type. I'd want to put into that field the contents of an array of byte[ ].

    This is my exact code
            //Connecting database
            MyDBConnection mdbc=new MyDBConnection();
            mdbc.init();
            Connection conn=mdbc.getMyConnection();
            try {
               Statement stmt= conn.createStatement();
            } catch (SQLException ex) {
                ex.printStackTrace();
    // Other code
    public void updateDataBase(String data1, byte[] data){
    int u = stmt.executeUpdate("insert into myTable (column1) values("
                        +quotate(data1)+" );");
                ResultSet res = stmt.executeQuery("select * from myTable");
                  res.next();
                res.next();
                res.getBlob("data").setBytes(1,data);
    //To easily make quotes
    private  String quotate(String content) {
            return "'"+content+"'";
           

  • HR_BLP_SAVE_TIMEDATA and how to load high volume records onto Infotype 2001

    Because of high data volume (estimated 1 million records each run) and short SLA time requirement (runs every 2 hours), we chose to use functions that are called by CAT6 (Skipping the CATS to HR info types loading process) to load the time records directly into Infotype 2001 and Infotype 2002. 
    Now we discover that some records (sporadically and randomly) don't get loaded onto the infotype and they don't return from the error message table either.  We are wondering whether anyone has used these functions before, and how they resolve the issues of missing records / error handling. 
    We are also wondering if there is any other feasible solution to meet our customer's need.
    The two functions we use are:   HR_BLP_MAINTAIN_TIMEDATA and HR_BLP_SAVE_TIMEDATA

    Hi Curt,
    No, they are 32 bit RGB. I have just made an 8 bit RGB and it gives me the option. Thank you for your help

  • How could I investigate SQL statement from standard audit record ?

    We use Oracle 11gR2.
    We use standard audit , audit_trail=DB.
    We found suspicious audit record but that  SQL_BIND,SQL_TEXT colums were NULL.
    How could I investigate that SQL statement from standard audit record ?

    Only "DB, EXTENDED" would cause the SQL statement to be captured.
    If you have the Diagnostics Pack licence you could try querying DBA_HIST_SQLTEXT (joined to DBA_HIST_SNAPSHOT) -- but this would only list SQLs captured by AWR (i.e. the "Top 'N'" SQLs in that snapshot).
    Hemant K Chitale

  • DAE.DB_READ_FAILED   java.sql.SQLException: Got a null connection

    While adding / updating user in OIM, I am getting error on random basis.
    Sometime the system is allowing to add / update and sometimes it is giving below mentioned error.
    Due to this, there is huge impact on production with 30,000+ users in OIM
    Please help ASAP.
    WARN,29 Aug 2012 14:48:10,813,[XELLERATE.DATABASE],Trying to get the connection count : 0
    WARN,29 Aug 2012 14:48:10,816,[XELLERATE.DATABASE],Trying to get the connection count : 1
    WARN,29 Aug 2012 14:48:10,820,[XELLERATE.DATABASE],Trying to get the connection count : 2
    WARN,29 Aug 2012 14:48:10,823,[XELLERATE.DATABASE],Trying to get the connection count : 3
    WARN,29 Aug 2012 14:48:10,826,[XELLERATE.DATABASE],Trying to get the connection count : 4
    ERROR,29 Aug 2012 14:48:10,827,[XELLERATE.DATABASE],Class/Method: DirectDB/getConnection encounter some problems: Error while retrieving database connection.Please check for the follwoing
    Database srever is running.
    Datasource configuration settings are correct.
    ERROR,29 Aug 2012 14:48:10,828,[XELLERATE.DATABASE],Class/Method: tcDataBase/readPartialStatement encounter some problems: Got a null connection
    java.sql.SQLException: Got a null connection
         at com.thortech.xl.dataaccess.tcDataBase.readPartialStatement(Unknown Source)
         at com.thortech.xl.dataobj.tcDataBase.readPartialStatement(Unknown Source)
         at com.thortech.xl.dataobj.tcDataBase.readStatement(Unknown Source)
         at com.thortech.xl.dataobj.tcDataBase.getError(Unknown Source)
         at com.thortech.xl.dataobj.tcDataObj.handleError(Unknown Source)
         at com.thortech.xl.dataobj.tcDataObj.handleError(Unknown Source)
         at com.thortech.xl.dataobj.tcDataObj.save(Unknown Source)
         at com.thortech.xl.dataobj.tcTableDataObj.save(Unknown Source)
         at com.thortech.xl.dataobj.tcRCE.reapplyRules(Unknown Source)
         at com.thortech.xl.ejb.databeansimpl.tcRCEBean.reapplyRules(Unknown Source)
         at com.thortech.xl.ejb.beans.tcRCE_4tknfu_EOImpl.reapplyRules(tcRCE_4tknfu_EOImpl.java:45)
         at com.thortech.xl.ejb.beans.tcRCE_4tknfu_EOImpl_WLSkel.invoke(Unknown Source)
         at weblogic.rmi.internal.activation.ActivatableServerRef.invoke(ActivatableServerRef.java:90)
         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)
    ERROR,29 Aug 2012 14:48:10,829,[XELLERATE.SERVER],Class/Method: tcDataObj/handleError encounter some problems: {1}
    com.thortech.xl.orb.dataaccess.tcDataAccessException
         at com.thortech.xl.dataaccess.tcDataAccessExceptionUtil.createException(Unknown Source)
         at com.thortech.xl.dataaccess.tcDataBase.createException(Unknown Source)
         at com.thortech.xl.dataaccess.tcDataBase.readPartialStatement(Unknown Source)
         at com.thortech.xl.dataobj.tcDataBase.readPartialStatement(Unknown Source)
         at com.thortech.xl.dataobj.tcDataBase.readStatement(Unknown Source)
         at com.thortech.xl.dataobj.tcDataBase.getError(Unknown Source)
         at com.thortech.xl.dataobj.tcDataObj.handleError(Unknown Source)
         at com.thortech.xl.dataobj.tcDataObj.handleError(Unknown Source)
         at com.thortech.xl.dataobj.tcDataObj.save(Unknown Source)
         at com.thortech.xl.dataobj.tcTableDataObj.save(Unknown Source)
         at com.thortech.xl.dataobj.tcRCE.reapplyRules(Unknown Source)
         at com.thortech.xl.ejb.databeansimpl.tcRCEBean.reapplyRules(Unknown Source)
         at com.thortech.xl.ejb.beans.tcRCE_4tknfu_EOImpl.reapplyRules(tcRCE_4tknfu_EOImpl.java:45)
         at com.thortech.xl.ejb.beans.tcRCE_4tknfu_EOImpl_WLSkel.invoke(Unknown Source)
         at weblogic.rmi.internal.activation.ActivatableServerRef.invoke(ActivatableServerRef.java:90)
         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)
    Caused by [Nested Exception]:
    java.sql.SQLException: Got a null connection
         at com.thortech.xl.dataaccess.tcDataBase.readPartialStatement(Unknown Source)
         at com.thortech.xl.dataobj.tcDataBase.readPartialStatement(Unknown Source)
         at com.thortech.xl.dataobj.tcDataBase.readStatement(Unknown Source)
         at com.thortech.xl.dataobj.tcDataBase.getError(Unknown Source)
         at com.thortech.xl.dataobj.tcDataObj.handleError(Unknown Source)
         at com.thortech.xl.dataobj.tcDataObj.handleError(Unknown Source)
         at com.thortech.xl.dataobj.tcDataObj.save(Unknown Source)
         at com.thortech.xl.dataobj.tcTableDataObj.save(Unknown Source)
         at com.thortech.xl.dataobj.tcRCE.reapplyRules(Unknown Source)
         at com.thortech.xl.ejb.databeansimpl.tcRCEBean.reapplyRules(Unknown Source)
         at com.thortech.xl.ejb.beans.tcRCE_4tknfu_EOImpl.reapplyRules(tcRCE_4tknfu_EOImpl.java:45)
         at com.thortech.xl.ejb.beans.tcRCE_4tknfu_EOImpl_WLSkel.invoke(Unknown Source)
         at weblogic.rmi.internal.activation.ActivatableServerRef.invoke(ActivatableServerRef.java:90)
         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)
    DEBUG,29 Aug 2012 14:48:10,830,[XELLERATE.SERVER],Class/Method: tcDataBase/getError entered.
    DEBUG,29 Aug 2012 14:48:10,831,[XELLERATE.SERVER],Class/Method: tcDataBase/isActionLoggable entered.
    DEBUG,29 Aug 2012 14:48:10,831,[XELLERATE.SERVER],Class/Method: tcDataBase/isActionLoggable left.
    DEBUG,29 Aug 2012 14:48:10,831,[XELLERATE.SERVER],Class/Method: tcDataBase/logError entered.
    ERROR,29 Aug 2012 14:48:10,831,[XELLERATE.DATABASE],Error: Error Keyword: DAE.DB_READ_FAILED
    Description: Could not execute database read. The database encountered a problem with the specified SQL query.
    Remedy: Check the database query. Contact your system adminstrator.
    Action: E
    Severity: H
    Help URL:
    Detail:
    com.thortech.xl.orb.dataaccess.tcDataAccessException: DB_READ_FAILEDDetail: SQL: select err_key, err_code, err_desc, err_rowver, err_remedy, err_count, err_last_occurance, err_action, err_help_url, err_severity from err where err_code='DOBJ.UPDATE_FAILED'Description: Got a null connectionSQL State: Vendor Code: 0Additional Debug Info:com.thortech.xl.orb.dataaccess.tcDataAccessException
         at com.thortech.xl.dataaccess.tcDataAccessExceptionUtil.createException(Unknown Source)
         at com.thortech.xl.dataaccess.tcDataBase.createException(Unknown Source)
         at com.thortech.xl.dataaccess.tcDataBase.readPartialStatement(Unknown Source)
         at com.thortech.xl.dataobj.tcDataBase.readPartialStatement(Unknown Source)
         at com.thortech.xl.dataobj.tcDataBase.readStatement(Unknown Source)
         at com.thortech.xl.dataobj.tcDataBase.getError(Unknown Source)
         at com.thortech.xl.dataobj.tcDataObj.handleError(Unknown Source)
         at com.thortech.xl.dataobj.tcDataObj.handleError(Unknown Source)
         at com.thortech.xl.dataobj.tcDataObj.save(Unknown Source)
         at com.thortech.xl.dataobj.tcTableDataObj.save(Unknown Source)
         at com.thortech.xl.dataobj.tcRCE.reapplyRules(Unknown Source)
         at com.thortech.xl.ejb.databeansimpl.tcRCEBean.reapplyRules(Unknown Source)
         at com.thortech.xl.ejb.beans.tcRCE_4tknfu_EOImpl.reapplyRules(tcRCE_4tknfu_EOImpl.java:45)
         at com.thortech.xl.ejb.beans.tcRCE_4tknfu_EOImpl_WLSkel.invoke(Unknown Source)
         at weblogic.rmi.internal.activation.ActivatableServerRef.invoke(ActivatableServerRef.java:90)
         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 Nishith,
    max connection pool size is already set to 50 , which is recommended.
    Please Advise.
    Thanks
    Rachit

  • Fetching null records out of a function takes much longer than non-null

    Hi,
    We have a function that is called thousands of times on SQL. This function has a SELECT than can return one row at max.
    We realized that when the SQL statement doesn't return any record, it takes 3x times longer in the fetch phase.
    I made a simple test with three functions were each one was executed 1000 times. The first one has an extra outer join that guarantees that it always returns one record, a second one with an explicit cursor that can return 0 records and a third one with an implicit cursor that can also return 0 records.
    Here is the sample test code:
    DECLARE
    -- Local variables here
    CURSOR c IS
    SELECT teste_vasco.teste_vasco1(epis.id_episode) as val
    FROM episode epis
    WHERE rownum <= 1000;
    TYPE t_c IS TABLE OF c%ROWTYPE;
    l_c t_c;
    BEGIN
    -- Test statements here
    OPEN c;
    FETCH c BULK COLLECT
    INTO l_c;
    CLOSE c;
              for i in l_c.first..l_c.last
              loop
              dbms_output.put_line(i || ' :' || l_c(i).val);
              end loop;
    END;
    The difference between the tests is that instead of calling the vasco1 function, vasco2 and vasco3 is called.
    ###Test1
    -Function vasco1:
    FUNCTION teste_vasco1(i_episode IN episode.id_episode%TYPE) RETURN VARCHAR2 IS
    l_dt_set TIMESTAMP WITH LOCAL TIME ZONE;
    l_flg_stage VARCHAR2(3);
    l_dt_warn TIMESTAMP WITH LOCAL TIME ZONE;
    CURSOR c_care_stage IS
    SELECT cs.dt_set, cs.flg_stage, cs.dt_warn
    FROM episode epis
    LEFT JOIN care_stage cs ON (cs.id_episode = epis.id_episode AND cs.flg_active = 'Y')
    WHERE epis.id_episode = i_episode;
    BEGIN
    OPEN c_care_stage;
    FETCH c_care_stage
    INTO l_dt_set, l_flg_stage, l_dt_warn;
    CLOSE c_care_stage;
    IF l_dt_set IS NULL
    THEN
    RETURN NULL;
    END IF;
    RETURN l_dt_set || l_flg_stage || l_dt_warn;
    EXCEPTION
    WHEN OTHERS THEN
    pk_alert_exceptions.raise_error(error_code_in => SQLCODE, text_in => SQLERRM);
    pk_alert_exceptions.reset_error_state;
    RETURN NULL;
    END teste_vasco1;
    -Trace file:
    SELECT TESTE_VASCO.TESTE_VASCO1(EPIS.ID_EPISODE) AS VAL
    FROM
    EPISODE EPIS WHERE ROWNUM <= 1000
    call count cpu elapsed disk query current rows
    Parse 1 0.01 0.00 0 0 0 0
    Execute 1 0.00 0.00 0 0 0 0
    Fetch 1 0.04 0.06 0 8 0 1000
    total        3      0.06       0.07          0          8          0        1000
    Misses in library cache during parse: 1
    Optimizer mode: ALL_ROWS
    Parsing user id: 286 (recursive depth: 1)
    Rows Row Source Operation
    1000 COUNT STOPKEY (cr=8 pr=0 pw=0 time=2035 us)
    1000 INDEX FAST FULL SCAN EPIS_EPISODE_INFO_UI (cr=8 pr=0 pw=0 time=1030 us)(object id 153741)
    SELECT CS.DT_SET, CS.FLG_STAGE, CS.DT_WARN
    FROM
    EPISODE EPIS LEFT JOIN CARE_STAGE CS ON (CS.ID_EPISODE = EPIS.ID_EPISODE AND
    CS.FLG_ACTIVE = 'Y') WHERE EPIS.ID_EPISODE = :B1
    call count cpu elapsed disk query current rows
    Parse 1 0.00 0.00 0 0 0 0
    Execute 1000 0.07 0.05 0 0 0 0
    Fetch 1000 0.01 0.02 0 4001 0 1000
    total     2001      0.09       0.07          0       4001          0        1000
    Misses in library cache during parse: 1
    Misses in library cache during execute: 1
    Optimizer mode: ALL_ROWS
    Parsing user id: 286 (recursive depth: 2)
    ###Test2
    -Function vasco2:
    FUNCTION teste_vasco2(i_episode IN episode.id_episode%TYPE) RETURN VARCHAR2 IS
    l_dt_set TIMESTAMP WITH LOCAL TIME ZONE;
    l_flg_stage VARCHAR2(3);
    l_dt_warn TIMESTAMP WITH LOCAL TIME ZONE;
    CURSOR c_care_stage IS
    SELECT cs.dt_set, cs.flg_stage, cs.dt_warn
    FROM care_stage cs
    WHERE cs.id_episode = i_episode
    AND cs.flg_active = 'Y';
    BEGIN
    OPEN c_care_stage;
    FETCH c_care_stage
    INTO l_dt_set, l_flg_stage, l_dt_warn;
    IF c_care_stage%NOTFOUND
    THEN
    CLOSE c_care_stage;
    RETURN NULL;
    END IF;
    CLOSE c_care_stage;
    IF l_dt_set IS NULL
    THEN
    RETURN NULL;
    END IF;
    RETURN l_dt_set || l_flg_stage || l_dt_warn;
    EXCEPTION
    WHEN OTHERS THEN
    pk_alert_exceptions.raise_error(error_code_in => SQLCODE, text_in => SQLERRM);
    pk_alert_exceptions.reset_error_state;
    RETURN NULL;
    END teste_vasco2;
    -Trace File:
    SELECT TESTE_VASCO.TESTE_VASCO2(EPIS.ID_EPISODE) AS VAL
    FROM
    EPISODE EPIS WHERE ROWNUM <= 1000
    call count cpu elapsed disk query current rows
    Parse 1 0.00 0.00 0 0 0 0
    Execute 1 0.00 0.00 0 0 0 0
    Fetch 1 0.00 0.27 0 8 0 1000
    total        3      0.00       0.27          0          8          0        1000
    Misses in library cache during parse: 0
    Optimizer mode: ALL_ROWS
    Parsing user id: 286 (recursive depth: 1)
    Rows Row Source Operation
    1000 COUNT STOPKEY (cr=8 pr=0 pw=0 time=2048 us)
    1000 INDEX FAST FULL SCAN EPIS_EPISODE_INFO_UI (cr=8 pr=0 pw=0 time=1045 us)(object id 153741)
    SELECT CS.DT_SET, CS.FLG_STAGE, CS.DT_WARN
    FROM
    CARE_STAGE CS WHERE CS.ID_EPISODE = :B1 AND CS.FLG_ACTIVE = 'Y'
    call count cpu elapsed disk query current rows
    Parse 1 0.00 0.00 0 0 0 0
    Execute 1000 0.03 0.05 0 0 0 0
    Fetch 1000 0.00 0.00 0 2001 0 1
    total     2001      0.03       0.06          0       2001          0           1
    Misses in library cache during parse: 0
    Optimizer mode: ALL_ROWS
    Parsing user id: 286 (recursive depth: 2)
    Rows Row Source Operation
    1 TABLE ACCESS BY INDEX ROWID CARE_STAGE (cr=2001 pr=0 pw=0 time=11082 us)
    1 INDEX RANGE SCAN CS_EPIS_FACT_FST_I (cr=2000 pr=0 pw=0 time=7815 us)(object id 688168)
    ###Test3
    -Function vasco3
    FUNCTION teste_vasco3(i_episode IN episode.id_episode%TYPE) RETURN VARCHAR2 IS
    l_dt_set TIMESTAMP WITH LOCAL TIME ZONE;
    l_flg_stage VARCHAR2(3);
    l_dt_warn TIMESTAMP WITH LOCAL TIME ZONE;
    BEGIN
    BEGIN
    SELECT cs.dt_set, cs.flg_stage, cs.dt_warn
    INTO l_dt_set, l_flg_stage, l_dt_warn
    FROM care_stage cs
    WHERE cs.id_episode = i_episode
    AND cs.flg_active = 'Y';
    EXCEPTION
    WHEN no_data_found THEN
    RETURN NULL;
    END;
    IF l_dt_set IS NULL
    THEN
    RETURN NULL;
    END IF;
    RETURN l_dt_set || l_flg_stage || l_dt_warn;
    EXCEPTION
    WHEN OTHERS THEN
    pk_alert_exceptions.raise_error(error_code_in => SQLCODE, text_in => SQLERRM);
    pk_alert_exceptions.reset_error_state;
    RETURN NULL;
    END teste_vasco3;
    -Trace file:
    SELECT TESTE_VASCO.TESTE_VASCO3(EPIS.ID_EPISODE) AS VAL
    FROM
    EPISODE EPIS WHERE ROWNUM <= 1000
    call count cpu elapsed disk query current rows
    Parse 1 0.00 0.00 0 0 0 0
    Execute 1 0.00 0.00 0 0 0 0
    Fetch 1 0.25 0.27 0 8 0 1000
    total        3      0.25       0.27          0          8          0        1000
    Misses in library cache during parse: 1
    Optimizer mode: ALL_ROWS
    Parsing user id: 286 (recursive depth: 1)
    Rows Row Source Operation
    1000 COUNT STOPKEY (cr=8 pr=0 pw=0 time=2033 us)
    1000 INDEX FAST FULL SCAN EPIS_EPISODE_INFO_UI (cr=8 pr=0 pw=0 time=1031 us)(object id 153741)
    SELECT CS.DT_SET, CS.FLG_STAGE, CS.DT_WARN
    FROM
    CARE_STAGE CS WHERE CS.ID_EPISODE = :B1 AND CS.FLG_ACTIVE = 'Y'
    call count cpu elapsed disk query current rows
    Parse 1 0.00 0.00 0 0 0 0
    Execute 1000 0.07 0.06 0 0 0 0
    Fetch 1000 0.00 0.00 0 2001 0 1
    total     2001      0.07       0.06          0       2001          0           1
    Misses in library cache during parse: 1
    Misses in library cache during execute: 1
    Optimizer mode: ALL_ROWS
    Parsing user id: 286 (recursive depth: 2)
    Rows Row Source Operation
    1 TABLE ACCESS BY INDEX ROWID CARE_STAGE (cr=2001 pr=0 pw=0 time=11119 us)
    1 INDEX RANGE SCAN CS_EPIS_FACT_FST_I (cr=2000 pr=0 pw=0 time=7951 us)(object id 688168)
    As you can see, in the first example the fetch time of the SELECT in the function vasco1 takes 0.02 seconds and 0.06 in the SELECT of the test script. This test returned 1000 non-null records.
    In the tests 2 and 3, the fetch phase of the SELECT in the test script takes much more time - 0.27 seconds, despite the fetch of the SELECT in the functions (vasco2 and vasco3) took 0.00 seconds (as it only returned 1 row for the 1000 executions) and the only difference between them is the function that is called. Both test2 and test3 returned 999 null records and 1 non-null record.
    How it's possible than a select null records takes much longer than selecting non-null records?
    Hope you can understand the problem and thank you in advance for any help or suggestions.

    Thank you for the replies...
    But the thing is that the SELECT in the function is very fast and the fetch phase takes no time (0.00 second).
    And, as you can see in the execution plan, there's no need for a full index scan...only a range scan is performed:
    SELECT CS.DT_SET, CS.FLG_STAGE, CS.DT_WARN
    FROM
    CARE_STAGE CS WHERE CS.ID_EPISODE = :B1 AND CS.FLG_ACTIVE = 'Y'
    call count cpu elapsed disk query current rows
    Parse 1 0.00 0.00 0 0 0 0
    Execute 1000 0.07 0.06 0 0 0 0
    Fetch 1000 0.00 0.00 0 2001 0 1
    total     2001      0.07       0.06          0       2001          0           1
    Misses in library cache during parse: 1
    Misses in library cache during execute: 1
    Optimizer mode: ALL_ROWS
    Parsing user id: 286 (recursive depth: 2)
    Rows Row Source Operation
    1 TABLE ACCESS BY INDEX ROWID CARE_STAGE (cr=2001 pr=0 pw=0 time=11119 us)
    1 INDEX RANGE SCAN CS_EPIS_FACT_FST_I (cr=2000 pr=0 pw=0 time=7951 us)(object id 688168)
    But, the fetch phase of the SQL that calls the function that has this query takes 0,27 seconds.
    As far as the contex switch, we are aware of that, but we can have modularity with this solution and the first function also have many context switching and is must faster.
    Edited by: Pretender on Mar 18, 2009 3:38 PM

  • Count NULL Records

    Hi,
      I am trying to count null records in the email field by using a running total. However, the running total is not calculating it correctly. I am using SQL Server and I have checked the database to make sure the cells are actually null and are not blank.  What formula do I need to use to get the running total to work? I have tried isNull() and that didn't work. Here is my current formula:
    {vwGenPatInfo.Patient_Email} = "" and
    Next ({vwEncounterForms.Patient_ID}) <> {vwEncounterForms.Patient_ID}

    1) Is this a running total field or did you create a manual running total?
    2)  Why are you comparing the next record?
    3)  Do you have "Convert NULL values to Default" turned on in your report or global options?

Maybe you are looking for