DBMS_PROFILER Empty

Hi,
I'm having some problems with DBMS_PROFILER. I have a good sized PL/SQL package, approximately 2000 lines, that I am trying to profile. I do a DBMS_PROFILER.START_PROFILER at the beginning of the whole process and a DBMS_PROFILER.STOP_PROFILER at the end. Then I user the profiler.sql script to generate the formatted HTML page of the run. I've done this countless times and have had a good experience. Sometimes however the results would be a little off...
Sometimes I'd run it and get an HTML with no source listing even though I had explicitly re-compiled the package (normally with debugging because I've found DBMS_PROFILER works better with it on). Sometimes I'd get the source listing, but none of the times or execution counts where there. Instead they were all zeroes. I've looked in the source tables and see the _DATA table does contain the zeroes so the profiler.sql script seems to be working fine.  Other times it would normally and give me good results.
Now, recently, no matter what I try, I cannot get a good run of data. I've looked online and the only "instructions" I see for DBMS_PROFILER are to create the tables/ sequences and then add the calls to your PL/SQL, the little bit about compiling in debug is something I found myself, so I'm really lost as what to try. I think when I first started working with DBMS_PROFILER there were some grants that had to be done, but if those weren't in place it wouldn't even run.
I did drop and recreate the tables/ sequences and that did not help.
Does anyone have anything else I might try? I should mention I'm on Oracle 11g. Here is the exact version from sqlplus when I log in. I'm not sure what version of DBMS_PROFILER I have if it really even has one.
Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production
Thanks,
Kevin

Well sorry about resurrecting the old post, but I figured out what the issue is. In the profiler.sql script that generates a fancy HTML report from the DBMS_PROFILER tables there is a DEF statement like the following.
DEF p_top = 10;
This is defining how many longest running lines to show in the summary at the beginning of the report. Later in the script there is a line that looks like this.
:v_top := TO_NUMBER('&&p_top');
This is assigning the value from p_top to v_top, but for some reason getting the value isn't making it over correctly. I think v_top is just getting a NULL. Worst of all it's inconsistent. Sometimes it seems to work and sometimes it doesn't.
The quick and dirty fix I came up with was to just hard code the value for v_top. For good measure I commented out the first DEF line I mentioned as well.
:v_top := 10;
There is a preliminary update this script does to plsql_profiler_units and plsql_profiler_data to the spare1 and spare2 columns which flags the top longest running lines with a rank. If this update fails to mark any lines, because of a missing value for v_top, then the rest of the script fails to correctly generate the report. I'm not sure why this DEF statement is giving me so much trouble, but I'd be curious if someone had an answer.
There is also an auxiliary fix, which I actually found first, where if you go to the c1_units cursor at the bottom of the script and comment out the requirement that spare1 IS NOT NULL in the SQL you can get the source to print out with the counts and timings, but that doesn't fix the issue with the top 10 table.
CURSOR c1_units IS
SELECT unit_number,
unit_owner,
unit_name,
unit_type,
spare1,
spare2
FROM plsql_profiler_units
WHERE runid = :v_runid
--AND spare1 IS NOT NULL
ORDER BY
unit_number;
Thanks,
Kevin

Similar Messages

  • DBMS_PROFILER tables empty

    Hi,
    I ran the following code to profile my code:
    <h6>
    DECLARE
    l_result BINARY_INTEGER;
    retcode number;
    errbuf varchar2(500);
    BEGIN
    l_result := DBMS_PROFILER.start_profiler(run_comment => 'xxotc_cust_class_stage_t: ' || SYSDATE);
    my_pkg.main ( errbuf
    ,retcode
    ,'/usr/tmp'
    ,'small_file.txt'
    l_result := DBMS_PROFILER.stop_profiler;
    END;
    </h6>
    After the program completes, when I query the profiler tables plsql_profiler_runs and plsql_profiler_units I do not find any data.
    Is there anything wrong that I am doing?
    Thanks.

    I am not sure what all tables, sequences are required, but here is what I found on my system:
    SELECT owner, object_name, object_type, status
    FROM dba_objects
    WHERE object_name LIKE 'PLSQL%'
    ORDER BY 1, 3
    Row#     OWNER     OBJECT_NAME     OBJECT_TYPE     STATUS
    1     APPS     PLSQL_PROFILER_UNITS     SYNONYM     VALID
    2     APPS     PLSQL_PROFILER_RUNS     SYNONYM     VALID
    3     APPS     PLSQL_PROFILER_RUNNUMBER     SYNONYM     VALID
    4     APPS     PLSQL_PROFILER_DATA     SYNONYM     VALID
    5     SYS     PLSQL_PROFILER_RUNNUMBER     SEQUENCE     VALID
    6     SYS     PLSQL_TRACE_RUNNUMBER     SEQUENCE     VALID
    7     SYS     PLSQL_TRACE_RUNS     TABLE     VALID
    8     SYS     PLSQL_PROFILER_UNITS     TABLE     VALID
    9     SYS     PLSQL_PROFILER_RUNS     TABLE     VALID
    10     SYS     PLSQL_PROFILER_DATA     TABLE     VALID
    11     SYS     PLSQL_TRACE_EVENTS     TABLE     VALID

  • Analyze dbms_profiler

    Hi folks!
    I'm at the beginning of analyze PL/SQL code. I'm using dbms_profiler. For one of our packages, dbms_profiler show me:
    Top 10 profiled source lines in terms of Total Time (plsql_profiler_data)
    Top Total Time1 Times Executed Min Time2 Max Time2 Unit Owner Name Type Line Text
    1 75.76 431010 0.00 0.01 1 USER package PACKAGE BODY 165 fetch c_IconsByDist bulk collect into l_IDs; 
    2 72.13 431010 0.00 0.01 1 USER package PACKAGE BODY 161 fetch c_CountByDist bulk collect into tmp_NumsAs you can see this row of code fetches cursor into collection. Cursor:
    cursor c_IconsByDist is
          select i.icon_id
          from (select rownum as num, column_value as icon_id
                from table(tmp_IDs)) i,
               (select rownum as num, column_value as dist
                from table(tmp_Distances)) d,
               (select column_value as dist
                from table(tmp_Nums)) t
          where i.num = d.num and
                d.dist = t.dist
          order by d.dist;May be, I can speed up this piece of code? Any ideas :)
    Regards,
    Pavel.

    Thanks for reply. Code of this function:
    function get_icon(
        p_Table varchar2,
        p_ID number)
        return number
      as
        l_ID      number;
        l_x       number;
        l_y       number;
        l_flag    boolean;
        l_Table   varchar2(128);
        arr_IDs   gg_utils.TSuperNumberArray := gg_utils.TSuperNumberArray();
        l_IDs     TNumberArray := TNumberArray();
        tmp_IDs   TNumberArray := TNumberArray(null);
        tmp_TypeIDs TNumberArray := TNumberArray(null);
        cursor c_RegulationProt is
          select p.object_id, u.type as object_type_id
          from   regulation_prot p, units u
          where  p.id = p_ID AND u.id = p.object_id;
        -- more simple than regulation_ascr view
        cursor c_Regulations is
          SELECT DISTINCT object_id, object_type_id
          FROM reg_ascr
          WHERE id = p_ID;
      begin
        DBMS_APPLICATION_INFO.SET_MODULE(G_MODULE_NAME, 'get_icon');
        l_Table := upper(p_Table);
        if l_Table IN ('PROTS', 'CHEMS', 'UNITS') then
          -- Some kind of Units
          l_IDs := get_icon_ids(p_ID);
        elsif l_Table = 'REACTS' then
          -- Reactions
          l_IDs := get_icon_ids(p_ID, -1);
        elsif l_Table = 'GENES' then
          -- Genes
          l_IDs := get_icon_ids(p_ID, -2);
        elsif l_Table = 'FUNCS' then
          -- Enzymes (funxtions)
          l_IDs := get_icon_ids(p_ID, -3);
        elsif l_Table = 'CLASS' then
          -- For this type of p_Table forms Collection of Collections (TSuperNumberArray)
          -- First source of object types and IDs
          open c_RegulationProt;
          fetch c_RegulationProt bulk collect into tmp_IDs, tmp_TypeIDs;
          close c_RegulationProt;
          if tmp_IDs.count = 0 then
            -- Second source of object types and IDs when first source is empty
            open c_Regulations;
            fetch c_Regulations bulk collect into tmp_IDs, tmp_TypeIDs;
            close c_Regulations;
          end if;
          -- fill arr_IDs with collections of get_icon_ids
          if tmp_IDs.count = 0 then
            l_IDs := get_icon_ids(p_ID);
            arr_IDs.extend;
            arr_IDs(1) := l_IDs;
          else
            arr_IDs.extend(tmp_IDs.count);
            for i in 1..tmp_IDs.count loop
              l_IDs := get_icon_ids(tmp_IDs(i), tmp_TypeIDs(i));
              arr_IDs(i) := l_IDs;
            end loop;
          end if;
        else
          sys_error.raise_error(sys_error.UNKNOWN_ICON_TYPE, l_Table);
        end if;
        l_ID := -1;
        -- for 'CLASS' use collection of collections "arr_IDs" insted of single collection "l_IDs"
        if l_Table = 'CLASS' then
          l_x := arr_IDs.count;
        else
          l_x := l_IDs.count;
        end if;
        if l_x = 0 then
          l_ID := 3;
        elsif l_x = 1 then
          l_ID := l_IDs(1);
        else
          if arr_IDs.count > 0 then
            l_IDs := TNumberArray();
            -- put in l_IDs only IDs, which exists in all of arrays
            -- first, get array with maximum count of elements
            l_x := 0;
            l_y := 0;
            for i in 1..arr_IDs.count loop
              if arr_IDs(i).count > l_x then
                l_x := arr_IDs(i).count;
                l_y := i;
              end if;
            end loop;
            -- now tmp_IDs have maximum of elements
            tmp_IDs := arr_IDs(l_y);
            -- trying find any elements of tmp_IDs in other arrays
            for i in 1..tmp_IDs.count loop
              l_flag := true;
              for j in 1..arr_ids.count loop
                l_flag := l_flag AND (tmp_IDs(i) member of arr_IDs(j));
                exit when not l_flag;
              end loop;
              if l_flag then
                l_IDs.extend;
                l_IDs(l_IDs.LAST) := tmp_IDs(i);
              end if;
            end loop;
          end if;
          if l_IDs.count > 0 then
            l_ID := l_IDs(1);
          end if;
        end if;
        if l_ID < 0 then
          l_ID := 1;
        end if;
        DBMS_APPLICATION_INFO.SET_MODULE(null, null);
        return l_ID;
      end get_icon;And this function call another function as you can see:
      function get_icon_ids(
        p_ID integer,
        p_TypeID integer default null)
        return TNumberArray
      as
        l_TypeID      integer;
        is_gene       integer;
        l_IDs         TNumberArray := TNumberArray(null);
        tmp_IDs       TNumberArray := TNumberArray(null);
        tmp_Distances TNumberArray := TNumberArray(null);
        tmp_Nums      TNumberArray;
       cursor c_KndUnitIcons(p_TypeID integer) is
          select default_icon_id as icon_id, 1000 as dist
          from   knd_units
          where  ID = p_TypeID;
        cursor c_SelfIcons is
          select icon_id, 0 as dist
          from proticons
          where prot_id = p_ID;
        cursor c_UnitIcons is
          select distinct i.icon_id, r.dist
          from proticons i, unitrelflat r
          where r.unitg = i.prot_id and
                r.unitm = p_ID and
                r.dist >= 0
          order by r.dist;
        cursor c_IconsG is
          select i.icon_id, 0 as dist
          from proticons i, geneprot g
          where i.prot_id = g.prot and
                g.gene = p_ID;
        cursor c_IconsG2 is
          select i.icon_id, r.dist
          from protrelflat r, proticons i, geneprot g
          where r.protgrp = i.prot_id and
                r.protmbr = g.prot and
                r.dist >= 0 and
                g.gene = p_ID
          order by r.dist;
        -- get distances with only icon
    -->>>>Spent the most time of execution
        cursor c_CountByDist is
          select d.dist
          from (select rownum as num, column_value as icon_id
                from table(tmp_IDs)) i,
               (select rownum as num, column_value as dist
                from table(tmp_Distances)) d
          where i.num = d.num
          having count(icon_id) = 1
          group by dist
          order by dist;
        -- found distances for only icons from c_CountByDist
    -->>>>Spent the most time of execution
        cursor c_IconsByDist is
          select i.icon_id
          from (select rownum as num, column_value as icon_id
                from table(tmp_IDs)) i,
               (select rownum as num, column_value as dist
                from table(tmp_Distances)) d,
               (select column_value as dist
                from table(tmp_Nums)) t
          where i.num = d.num and
                d.dist = t.dist
          order by d.dist;
        procedure fill_by_default(
          p_TypeID integer,
          p_DefaultID number default 1)
        as
          l_ID       number;
          l_Distance number;
        begin
          open c_KndUnitIcons(p_TypeID);
          fetch c_KndUnitIcons into l_ID, l_Distance;
          close c_KndUnitIcons;
          tmp_IDs.extend(1);
          tmp_IDs(tmp_IDs.count) := nvl(l_ID, p_DefaultID);
          tmp_Distances.extend(1);
          tmp_Distances(tmp_Distances.count) := nvl(l_Distance, 2000);
        end fill_by_default;
        procedure fill_for_units(
          p_TypeID integer)
        as
        begin
          -- first, find self icon
          open c_SelfIcons;
          fetch c_SelfIcons bulk collect into tmp_IDs, tmp_Distances;
          close c_SelfIcons;
          if tmp_IDs.count = 0 then
            open c_UnitIcons;
            fetch c_UnitIcons bulk collect into tmp_IDs, tmp_Distances;
            close c_UnitIcons;
          end if;
          fill_by_default(p_TypeID);
        end fill_for_units;
      begin
        DBMS_APPLICATION_INFO.SET_MODULE(G_MODULE_NAME, 'get_icon_ids');
        l_TypeID := nvl(p_TypeID, unit_service.get_type_id(p_ID));
        case l_TypeID
          when -2 then
            -- for Genes
            open c_IconsG;
            fetch c_IconsG bulk collect into tmp_IDs, tmp_Distances;
            close c_IconsG;
            if tmp_IDs.count = 0 then
              open c_IconsG2;
              fetch c_IconsG2 bulk collect into tmp_IDs, tmp_Distances;
              close c_IconsG2;
            end if;
            if tmp_IDs.count = 0 then
              tmp_IDs.extend(1);       -- tmp_IDs is null after empty bulk collect
              tmp_IDs(1) := 1;
              tmp_Distances.extend(1); -- tmp_Distances is null after empty bulk collect
              tmp_Distances(1) := 1;
            end if;
          when -1 then
            fill_by_default(l_TypeID);
          when -3 then
            fill_by_default(l_TypeID);
          else
            fill_for_units(l_TypeID);
        end case;
        open c_CountByDist;
        fetch c_CountByDist bulk collect into tmp_Nums;
        close c_CountByDist;
        open c_IconsByDist;
        fetch c_IconsByDist bulk collect into l_IDs;
        close c_IconsByDist;
        if l_IDs.count = 0 then
          l_IDs.extend(1);
          if p_TypeID = -1 then
            l_IDs(1) := 54;
          else
            l_IDs(1) := 1;
          end if;
        end if;
        DBMS_APPLICATION_INFO.SET_MODULE(null, null);
        return l_IDs;
      end get_icon_ids;Now, I reviewing the code. Any help is appreciated.
    Regards,
    Pavel.

  • Cannot assign an empty string to a parameter with JDBC type VARCHAR

    Hi,
    I am seeing the aforementioned error in the logs. I am guessing its happening whenever I am starting an agent instance in PCo. Can somebody explain whats going on?
    Regards,
    Chanti.
    Heres the complete detail from logs -
    Log Record Details   
    Message: Unable to retreive path for , com.sap.sql.log.OpenSQLException: Failed to set the parameter 1 of the statement >>SELECT ID, PARENTID, FULLPATH, CREATED, CREATEDBY, MODIFIED, MODIFIEDBY, REMOTEPATH, CHECKEDOUTBY FROM XMII_PATHS WHERE FULLPATH =  ?  <<: Cannot assign an empty string to a parameter with JDBC type >>VARCHAR<<.
    Date: 2010-03-12
    Time: 11:32:37:435
    Category: com.sap.xmii.system.FileManager
    Location: com.sap.xmii.system.FileManager
    Application: sap.com/xappsxmiiear

    Sounds like a UI browsing bug (when no path is selected from a catalog tree folder browser) - I would suggest logging a support ticket so that it can be addressed.

  • Oracle, Null and empty Strings

    Currently I'm facing problems with a class, which contains a String, which
    is set to "" (empty String).
    When the class is persistent, oracle writes null to the table column
    (which seems to be common oracle behaviour) and when retrieving the class,
    the field is set to null as well, giving me a lot of null-pointer
    exceptions.
    Anyway ... I can cope with that (just a lot of extra work)
    far worse is the problem, wenn searching objects, that have this field set
    to "" oder null.
    Oracle can't find the records because JDO creates Querys "where
    string=null" or "where string=''" , where oracle expects "where string is
    null" to find the records.
    Is there a workaround or solution ?

    Yeah, that would work as well, thx, but since I have to cope with
    null-Strings now everywhere in my program, it doesn't hurt just to forbid
    empty strings on the program side.
    In future times I'll test on Oracle first, then porting to DB/2 - this way
    I suppose work is far less to garant compability.
    Nevertheless ... having to set the bankcode into quotes is a kodo bug in
    my opinion.
    Kodo knows the type of classfields (in this case string) and shouldn't
    send the parameter as a BigDecimal to the database.
    Given that, and having only bankcodes of null (only neccesary when using
    Oracle), the method would look like:
    public Collection getAccounts (String bankCode)
    throws Exception
    return getAccounts (Account.class, "bankcode=="+bankcode);
    which is how a transparent persistent layer, um, should be , um , I mean
    ... just transparent ;-D
    Marc Prud'hommeaux wrote:
    Stefan-
    Couldn't you just do something like:
    public Collection getAccounts (String bankCode)
    throws Exception
    String filter;
    if (bankCode == null || bankCode.length () == 0)
    filter = "(bankCode == null || bankCode == "")";
    else
    filter = "bankCode == "" + bankCode + """;
    return getAccounts (Account.class, filter);
    If I understand the problem correctly, this should work for all the
    databases.
    In article <[email protected]>, Stefan wrote:
    What operations are you performing to cause this SQL to be issued? You
    say you are having trouble removing objects, but this is clearly not a
    DELETE statement. Is this the SQL that is issued when looking up
    objects by identity?I'm not removing objects, I was removing just quotes from parameters ;-)
    A string column... is it also represented as a string field in your class?Yeah ... just to give you an impression of the code:
    First we have a class, representing a bank account:
    public class Account {
    private AccountMgr myAccountMgr;
    private String bankCode;
    private String id;
    Note, that in nearly all cases bankCode will be a number or null.
    I have a second class "AccountMgr", which does all of the persistant stuff
    (seaching, making persistent etc.)
    This class has two methods, one versatile (protected) to retrieve accounts
    by a given filterString and one who just returns accounts by bankCode,
    building the expected filterstring. Here is my current working version:
    public class AccountMgr {
    public Collection getAccounts(String bankCode) throws Exception {
    if (bankCode!=null) {
    if (bankCode.equals("")) {
    throw new Exception("check code, bankCode='' not allowed to get
    same behavior from DB2 and Oracle");
    // if set, quote the bankCode
    bankCode="""+bankCode+""";
    return getAccounts(Account.class,"bankCode=="+bankCode);
    protected Collection getAccounts(Class accountClass, String filterAdd)
    throws Exception {
    PersistenceManager pm = MyHelper.getPersistenceManager();
    String filter="";
    if (filterAdd!=null && !filterAdd.trim().equals("")) {
    filter+=filterAdd + " && ";
    filter += "myAccountMgr==_accMgr";
    Query query = pm.newQuery(accountClass, filter);
    query.declareParameters("AccountMgr _accMgr");
    return (Collection) query.execute(this);
    As you can see, in the first method I have to set the bankCode into
    quotes, when it's not null.
    This is because otherwise a filter like "bankCode=1234" will be translated
    in a way, where 1234 is send as a BigDecimal to the database:
    [...] executing statement <4239745>: (SELECT [...] FROM JDO_ACCOUNT t0
    WHERE t0.BANKCODE = ? : [reused=1;params={(BigDecimal) 1234}]
    Marc Prud'hommeaux [email protected]
    SolarMetric Inc. http://www.solarmetric.com

  • NULL and Empty String

    Hi There,
    As far as I know, Null is not the same as an empty string; however, when I try this out, I get some unexpected results (well, at least unexpected for my liking):
    SQL> CREATE TABLE TS (MID NUMBER,
      2  MDESC VARCHAR2(20) DEFAULT '' NOT NULL);
    Table created.
    SQL> INSERT INTO TS VALUES(1,'');
    INSERT INTO TS VALUES(1,'')
    ERROR at line 1:
    ORA-01400: cannot insert NULL into ("TT"."TS"."MDESC")So, according to the above scenario, I can't insert an empty string!! However, an empty string is a valid string that doesn't have tuples/data!!
    How come Oracle translates the null string '' as NULL?
    Thanks

    William Robertson wrote:
    There is a special case to do with CHAR values, whereby '' counts as a string and so gets blank-padded, whereas NULL does not.Are you referring to:
    SQL> DECLARE
      2      flag CHAR(2);
      3      PROCEDURE check_null (p_flag IN CHAR)
      4      IS
      5      BEGIN
      6        IF p_flag = '  '
      7        THEN
      8          dbms_output.put_line ('flag is equal to ''  ''');
      9        ELSIF p_flag IS NULL
    10        THEN
    11          dbms_output.put_line ('flag is null');
    12        ELSE
    13          dbms_output.put_line ('other');
    14        END IF;
    15      END;
    16    BEGIN
    17      flag := '';
    18      check_null (flag);
    19      flag := NULL;
    20      check_null (flag);
    21    end;
    22  /
    flag is equal to '  '
    flag is null
    PL/SQL procedure successfully completed.
    SQL> alter session set events '10932 trace name context forever, level 16384';
    Session altered.
    SQL> DECLARE
      2      flag CHAR(2);
      3      PROCEDURE check_null (p_flag IN CHAR)
      4      IS
      5      BEGIN
      6        IF p_flag = '  '
      7        THEN
      8          dbms_output.put_line ('flag is equal to ''  ''');
      9        ELSIF p_flag IS NULL
    10        THEN
    11          dbms_output.put_line ('flag is null');
    12        ELSE
    13          dbms_output.put_line ('other');
    14        END IF;
    15      END;
    16    BEGIN
    17      flag := '';
    18      check_null (flag);
    19      flag := NULL;
    20      check_null (flag);
    21    end;
    22  /
    flag is null
    flag is null
    PL/SQL procedure successfully completed.
    SQL> SY.
    P.S. Don't ask me why normal (or at least consistent) behavior is not the default.

  • Null and empty string not being the same in object?

    Hello,
    I know that null and empty string are interpreted the same in oracle.
    However I discovered the strange behaviour concerning user defined objects:
    create or replace
    TYPE object AS OBJECT (
    value VARCHAR2(2000)
    declare
    xml xmltype;
    obj object;
    begin
    obj := object('abcd');
    xml := xmltype(obj);
    dbms_output.put_line(xml.getStringVal());
    obj.value := '';
    xml := xmltype(obj);
    dbms_output.put_line(xml.getStringVal());
    obj.value := null;
    xml := xmltype(obj);
    dbms_output.put_line(xml.getStringVal());
    end;
    When creating xml from object, all not-null fields are transformed into xml tag.
    I supposed that obj.value being either '' or null will lead to the same result.
    However this is output from Oracle 9i:
    <OBJECT_ID><VALUE>abcd</VALUE></OBJECT_ID>
    <OBJECT_ID><VALUE></VALUE></OBJECT_ID>
    <OBJECT_ID/>
    Oracle 10g behaves as expected:
    <OBJECT><VALUE>abcd</VALUE></OBJECT>
    <OBJECT/>
    <OBJECT/>
    However Oracle 9i behaviour leads me to the conclusion that oracle
    must somehow distinguish between empty string and null in user defined objects...
    Can someone clarify this behaviour?
    Thus is it possible to test if object's field is empty or null?

    However Oracle 9i behaviour leads me to the conclusion that oracle
    must somehow distinguish between empty string and null in user defined objects...
    Can someone clarify this behaviour?
    Thus is it possible to test if object's field is empty or null?A lot of "fixes" were done, relating to XML in 10g and the XML functionality of 9i was known to be buggy.
    I think you can safely assume that null and empty strings are treated the same by Oracle regardless. If you're using anything less than 10g, it's not supported any more anyway, so upgrade. Don't rely on any assumptions that may appear due to bugs.

  • Difference in Null and Empty String

    Hi,
    I have been wondering about the difference between Null and Empty String in Java. So I wrote a small program like this:
    public class CompareEmptyAndNullString {
         public static void main(String args[]) {
              String sNull = null;
              String sEmpty = "";
              try {
                   if (sNull.equalsIgnoreCase(sEmpty)) {
                        System.out.println("Null and Empty Strings are Equal");
                   } else {
                        System.out.println("Null and Empty Strings are Equal");
              } catch (Exception e) {
                   e.printStackTrace();
    This program throws Exception: java.lang.NullPointerException
         at practice.programs.CompareEmptyAndNullString.main(CompareEmptyAndNullString.java:10)
    Now if I change the IF Clause to if (sEmpty.equalsIgnoreCase(sNull)) then the Program outputs this: Null and Empty Strings are Equal
    Can anyone explain why this would happen ?
    Thanks in Advance !!

    JavaProwler wrote:
    Saish,
    Whether you do any of the following code, the JUnit Test always passes: I mean he NOT Sign doesnt make a difference ...
    assert (! "".equals(null));
    assert ("".equals(null));
    You probably have assertions turned off. Note the the assert keyword has nothing to do with JUnit tests.
    I think that older versions of JUnit, before assert was a language keyword (which started in 1.4 or 1.5), had a method called assert. Thus, if you have old-style JUnit tests, they might still compile, but the behavior is completely different from what it was in JUnit, and has nothing to do with JUnit at all.
    If you turn assertions on (-ea flag in the JVM command line, I think), the second one will throw AssertionError.

  • Check for null and empty - Arraylist

    Hello all,
    Can anyone tell me the best procedure to check for null and empty for an arraylist in a jsp using JSTL. I'm trying something like this;
    <c:if test="${!empty sampleList}">
    </c:if>
    Help is greatly appreciated.
    Thanks,
    Greeshma...

    A null check might not be you best option.  If your requirement is you must have both the date and time component supplied in order to populate EventDate, then I would use a Script Functoid that takes data and time as parameters.
    In the C# method, first check if either is an empty string, if so return an empty string.
    If not, TryParse the data, if successful, return a valid data string for EventDate.  If not, error or return empty string, whichever satsifies the requirement.

  • Interactive Report view is empty

    Hi,
    I'm on CRM 7.0 EHP3. I'm encountering empty report criteria and display when open the Campaign effectiveness and all other interactive report page. Please see the screen shot below. There is no error message on the screen, as well as ST22.
    I've configured the interactive report and ran the configuration wizard /CRMBW/CONFIG_WIZARD successfully and no error found.
    Also the roles SAP_CRM_OR_ADMIN, SAP_CRM_OR_CONFIG and SAP_CRM_OR_USER and SAP_ALL are given to the user in both clients.
    Please let me know what could be the causes.
    Thanks in advance.
    cheers,
    julius

    Okay, problem seems solved. I don't know if it is a bug or a feature... (: Anyway, this view selects data from threads that had been created from a portal application. And if you create threads from WC_Collaboration server admin console, there's no data will be selected with FORUMCRAWLER_VW view. Sorry, have no time to check SQL query for those DB view, may be this behaviour is reasonable.
    Edited by: Insomnium on 17.01.2013 2:33

  • Print empty report

    Can I somehow print an empty report, and specify with a parameter how many times it should be repeated?
    The report is a form with checkboxes, and sometimes we want the empty one for someone to fill in when out on the field. And since this form is a subreport, we cant print the entire report over again, but need the subreport to be repeated, let's say five times.
    /Thank you!

    Please re-post if this is still an issue or purchase a case and have a dedicated support engineer work with you directly

  • My photos just became empty boxes, if I click on them they open, but I can't see them at a glance. Anyone know why? thanks

    My photos on iphotos just became empty boxes, bordered by white intermittent lines. If I click on a photo it comes up, but I can't see what each photo is at a glance. Any ideas how to resolve this? thanks

    Back Up and try rebuild the library: hold down the command and option (or alt) keys while launching iPhoto. Use the resulting dialogue to rebuild. Include the options to rebuild the thumbnails.
    Regards
    TD

  • Error while running fiori application in launchpad which is having image in its empty view

    Hi Experts,
                   I have created a fiori application using odata services and uploaded it into launchpad.I want to display image in its empty view. It is getting displayed when i run the application on eclipse but i am getting the error for the same when i run it on launchpad.
    Below is the error:
    "NetworkError: 404 NOT FOUND - http://ws-sapsvr01:8010/sap/bc/ui5_ui5/ui2/ushell/shells/abap/img/TeamSAP.jpg"
    Can any body help me solve this issue why i am getting this??
    Thanks & Regards.
    Rahul.

    Hi Masa,
    In my case, i've the file 'preco_ok.jpg' located inside my extended project (Z_MM_MyProject -> WebContent -> images)
    And I refer it as follow:
    <Image src="images/preco_ok.jpg" class="spaceIndicator"/>
    In the local enviroment it is ok, but on launchpad, the 404 error is shown:
    GET http://host:port/sap/bc/ui5_ui5/ui2/ushell/shells/abap/images/preco_ok.jpg 404 (NOT FOUND)
    Thank you for your support.

  • OBI 11G sUnquotedTableName.empty() error while creating a report

    hello guru's
    We have a problem when trying to build a report in OBI 11G. We have migrated an RPD from 10 to 11 and one 1 installation DEV all is OK, on TEST we get all kind of problems.
    One of the main issues is when trying to build a report and clicking on the + to expand a node of a dimension object we hget the sUnquotedTableName.empty() error
    When going to the logs I see the following details of the error.
    Does anyone have a clue and can help us out?
    Koen Verheyen
    ProblemhMessage Level 10
    Relationship ID 0:1
    Component OBIPS
    Module saw.httpserver.processrequest
    Host XXXXXXX
    Host IP Address XXXXXX
    Thread ID 2836335504
    ECID 0000Ijcd5UzFw000jzwkno1Clgr10001eK
    Message
    Assertion failure: !sUnquotedTableName.empty() at line 1936 of /scratch/aime1/adestore/views/aime1_dadvfa0138/bifndn/analytics_web/main/project/webutil/tablenameutils.cpp
    Supplemental Detail
    File:tablenameutils.cpp
    Line:1936
    Location:
    saw.httpserver.processrequest
    saw.rpc.server.responder
    saw.rpc.server
    saw.rpc.server.handleConnection
    saw.rpc.server.dispatch
    saw.threadpool
    saw.threads
    SessionID: 07vh3ae7bqk8nsnslpm32fhtcm9nsc5cd7va98q
    AuthProps: AuthSchema=UidPwd|PWD=******|UID=koen_verheyen|User=koen_verheyen|RunAs=koen_verheyen
    ecid: 0000Ijcd5UzFw000jzwkno1Clgr10001eK,0:1
    ThreadID: 2836335504
    HttpCommand: JSONRequestTableColumns
    RemoteIP: 10.10.1.15
    HttpArgs:

    Hi,
    I am newly using BI publisher . I am using 10.1.3.4.0 . I am just trying to create a report in test name. that is the first step to create a report where i am getting error. I am using default RPD paint , where all the user and Groups are defined .

  • Is there a way to prevent users from sending empty or incomplete PDF forms?

    Hi all,
    Using Acrobat Professional 8, I made a fillable form to individuals to fill in and submit to me as a pdf attachment to an e-mail or print out it and fill by hand.
    Question 1. I want to make sure they don't send incomplete or empty forms back to me. Is there a way to do that?
    2. The form is 8.5x15 inches. I want it to look like one continuous page on screen but print as 2 letter size pages. However, when i go to print it, acrobat scales it down to fit in one page which makes the text too small to read.
    Please advise! Thanks.
    Karen

    On Question 2:
    when you get to the Print menu in Acrobat/Reader look for scale to fit paper and uncheck if there is a reference to Full size check that.

Maybe you are looking for

  • Multiple users on a network share: how to manage versions, prevent overwriting?

    Setting up file shares on a Mini Server with 10.8 server. How can a group of users share access to a volume, while managing versions of a file (other than saving with a new file name) and preventing two users editing a file simultaneously and overwri

  • Why can't I click on video to move/resize it anymore?

    I'm new to Pr, and am currently testing it out on the trial period of CS6. I've already made one sequence where I loaded in 4 videos, then simply clicked on them in the workspace to move/resize them into each corner of the screen. It was dead simple,

  • Tips to debug logical database

    Hello Experts, In tcode LX02 there were items displayed despite these items are GI'ed already this only happens in our production box and not in our testing box. Can you guide/help me or any tricks for me to debug logical database? Thanks in advance!

  • Thread pool and use database table as queue

    is this possible to use database table as queue rather than using "LinkedBlockingQueue"..and store in memory ? If yes, how do i serialized the task object into table and how to retrieve the task object back when need to be execute by executorservice.

  • Aperture 3 and Nik software trial.

    i can't use the plugins and aperture crashes when clicking on these plugins, i only downloaded the trial version this morning.I am using aperture 3.4.5,am i missing some kind of download?cheers.