String is not null forever?

String a = "";
String b = new String();
a==null? false
b==null? false
why?

you mean a.b are Strings with length 0 but they are
exist so not equal Null?Not quite.
a and b are variables. They hold references. Those references could be null (which means they don't point to an object) but here they're not. They both point to String objects. Those String objects don't happen to contain any characters in their char arrays (the arrays themselves also exist, and have length zero), but the String objects still exist.
Objects (such as Strings) can never be null. That concept doesn't apply. Only references can "be null" (i.e., the value they hold is the null reference -- http://java.sun.com/docs/books/jls/second_edition/html/typesValues.doc.html#11128).
Remember the finger-pointing and paper-writing examples from your other thread? Setting a reference to null is making a fist and pointing at nothing, or erasing whatever is written on a piece of paper. It has nothing to do with any objects. Setting a variable to the empty string "" is pointing your finger at a book that has only a front and back cover, but no pages inside.

Similar Messages

  • Empty string in NOT NULL column

    I'm migrating data to Oracle 9i from a database engine that supports emtpy strings in column with NOT NULL specified in the DDL. I would have thought Oracle would support this, but any attempt to put empty string data into a column created with NOT NULL is returning a 'column does not support nulls'-type error.
    Is there an option to allow this, or does Oracle simply not support this and assumes blank is null?
    Thanks

    I would have thought Oracle would support this, but any attempt to put empty string data into a column created with NOT NULL is returning a 'column does not support nulls'-type error.In Oracle Null means null nothing not even an empty String.
    Yes DB's like Ingress supports this. But I think Oracle is right.
    Is there an option to allow this, or does Oracle simply not support this and assumes blank is null?I am not aware of any options as it is against the basic principles.
    you can find work arounds to do the migration. But storing a blank NO.
    Good Luck
    Vij

  • IS NOT NULL and performance

    I have a performance issue with a query - it would be something like -
    select col1,col2, sum(col3), get_val(col_4)
    from table1
    where
    get_val(col_4) is not null
    group by col1,col2, get_val(col_4)
    I have simplified this but it is something similar. This works great - performance is great. Now I commented out the where clause as I needed to populate null values - and that's it the query does not retrieve the resultset - it keeps running forever. With the where clause it comes back in 60 seconds. There is only one row out of 560 rows that has null value for col_4 which i need to display.
    Any help is appreciated.

    The only difference I notice between the two sqls is HASH(UNIQUE) -
    with IS NOT NULL in where clause -
    SELECT STATEMENT     ALL_ROWS     1598     1     209
    HASH(UNIQUE)          1598     1     209
    HASH(GROUP BY)          1598     1     209
    When is not null is removed from the where clause -
    SELECT STATEMENT     ALL_ROWS     1598     1     206
    HASH(GROUP BY)          1598     1     206          
    I'm guessing that the index is being used in the first scenario and not in the second. Any idea/suggestion as to how to over come this?          
    Thanks

  • Default Value , Not Null and EJB2.1

    Hi ,
    Am using Weblogic10.3 + Oracle Db + EJB2.1 Local Entity Beans .
    The issue is that one of the table has createdDt which is not null and is defualt is set to Sysdate. When I try to create this Entity with createdDt null , I get an exception like below , But since I have mentioned default value , I shouldnt be getting this. Have I missed something ?
    Code is quite straighforward
    Organisation org = organisationHome.create();
    ....org.setter methods..
    java.sql.SQLException: [BEA][Oracle JDBC Driver][Oracle]ORA-01400: cannot insert NULL into ("XXX"."ORGANISATION_T"."CREATEDDT_F")
    ErrorCode=1400 SQLState=23000
    java.sql.SQLException: [BEA][Oracle JDBC Driver][Oracle]ORA-01400: cannot insert NULL into ("XXX"."ORGANISATION_T"."CREATEDDT_F")
         at weblogic.jdbc.base.BaseExceptions.createException(Unknown Source)
         at weblogic.jdbc.base.BaseExceptions.getException(Unknown Source)
         at weblogic.jdbc.oracle.OracleImplStatement.execute(Unknown Source)
         at weblogic.jdbc.base.BaseStatement.commonExecute(Unknown Source)
         at weblogic.jdbc.base.BaseStatement.executeUpdateInternal(Unknown Source)
         at weblogic.jdbc.base.BasePreparedStatement.executeUpdate(Unknown Source)
         at weblogic.jdbcspy.SpyPreparedStatement.executeUpdate(Unknown Source)
         at weblogic.jdbc.wrapper.PreparedStatement.executeUpdate(PreparedStatement.java:159)
         at weblogic.ejb.container.manager.BaseEntityManager.executeInsertStmt(BaseEntityManager.java:763)
         at weblogic.ejb.container.internal.TxManager$TxListener.executeInsert(TxManager.java:900)
         at weblogic.ejb.container.internal.TxManager$TxListener.executeDBOperations(TxManager.java:831)
         at weblogic.ejb.container.internal.TxManager$TxListener.beforeCompletion(TxManager.java:1054)
         at weblogic.transaction.internal.ServerSCInfo.doBeforeCompletion(ServerSCInfo.java:1217)
         at weblogic.transaction.internal.ServerSCInfo.callBeforeCompletions(ServerSCInfo.java:1195)
         at weblogic.transaction.internal.ServerSCInfo.startPrePrepareAndChain(ServerSCInfo.java:118)
         at weblogic.transaction.internal.ServerTransactionImpl.localPrePrepareAndChain(ServerTransactionImpl.java:1302)
         at weblogic.transaction.internal.ServerTransactionImpl.globalPrePrepare(ServerTransactionImpl.java:2114)
         at weblogic.transaction.internal.ServerTransactionImpl.internalCommit(ServerTransactionImpl.java:263)
         at weblogic.transaction.internal.ServerTransactionImpl.commit(ServerTransactionImpl.java:230)
         at weblogic.ejb.container.internal.BaseRemoteObject.postInvoke1(BaseRemoteObject.java:621)
         at weblogic.ejb.container.internal.StatelessRemoteObject.postInvoke1(StatelessRemoteObject.java:60)
         at weblogic.ejb.container.internal.BaseRemoteObject.postInvokeTxRetry(BaseRemoteObject.java:441)
         at com.tieto.tix.core.domain.DomainServices_7p8lqs_EOImpl.createOrganisation(DomainServices_7p8lqs_EOImpl.java:7717)
         at com.tieto.tix.core.domain.DomainServices_7p8lqs_EOImpl_WLSkel.invoke(Unknown Source)
         at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:589)
         at weblogic.rmi.cluster.ClusterableServerRef.invoke(ClusterableServerRef.java:230)
         at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:477)
         at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
         at weblogic.security.service.SecurityManager.runAs(Unknown Source)
         at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:473)
         at weblogic.rmi.internal.wls.WLSExecuteRequest.run(WLSExecuteRequest.java:118)
         at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
         at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)

    parmTest( , "param2") is syntactically incorrect, so there can be no "workaround".
    In addition to solutions offered by SwapnilVJ and Saransoft84, you could also use a rest parameter:
    function parmTest(... args)
    // set up default values
    var val1:Boolean=true;
    var val2:String="";
    switch(args.length)
      case 0:break;
      case 1:
       if(args[0] is String){val2=args[0] as String;}
       else{val1=args[0] as Boolean;}
       break;
      case 2:
      default:
       val1=args[0] as Boolean;
       val2=args[1] as String;
       break;
       trace(val1 + " " +val2);
    parmTest();
    parmTest("hello");
    parmTest(null,"hello");
    parmTest("hello",null);

  • Problem: textbox leave empty string("") instead of null

    Hello, I have a problem with textboxes. By default, they always are initialized to null, but when I start entering and removing data from textboxes, many times they leave an empty string "" instead of null.
    And, of course, it's not the same a null value as an empty string and thus, I haven't got the expected result in queries to database.
    Thus, I always have to compare textbox values with "" and null. It's very tedious and not elegant solution. I would like to know if there is another way to get the values as null instead of empty strings.

    Yes. Once you entered and remove the text it will evaluated as you told .
    For ur case u can Try the condition as
    if ( instance !=null && instance.length !=0)
    be sure instance != null check b4 other wise u can get NullPointerException

  • Empty strings morphed to NULL ???

    Hi all,
    I am executing the following SQL-statement (short version):
    statement = (OraclePreparedStatement)
    connection.prepareStatement(
    "INSERT INTO TEST VALUES (?)");
    statement.defineColumnType(1, OracleTypes.VARCHAR);
    statement.setString (1,"");
    statement.execute();
    statement.close();
    connection.commit();
    Then I have a look into the table TEST (with SQL-PLUS) and see
    that my stringValue "" morphed to a NULL-value !!!
    Why are "" Strings mapped to NULL ???
    Is there a configuration-parameter to turn this "feature" off ???
    "" is not the same as NULL, is it ???
    Thank You in advance,
    Ralf.
    null

    Ralf Severloh (guest) wrote:
    : Why are "" Strings mapped to NULL ???
    This is a known Oracle feature / bug (depending on your
    perspective). Null strings are equal to null. Try "SELECT 1 FROM
    dual WHERE '' IS NULL;" to prove it.
    : Is there a configuration-parameter to turn this "feature" off
    Not as far as I know.
    : "" is not the same as NULL, is it ???
    Not to my way of thinking, however Oracle disagrees.
    --> Steve
    null

  • Null Pointer exception returned when object is not null!

    I've isolated the problem and cut down the code to the minimum. Why do I get a null pointer exception when the start method is called, when the object objJTextField is not null at this point???? I'm really stuck here, HELP!
    (two small java files, save as BasePage.java and ExtendedPage.java and then run ExtendedPage)
    first file
    ~~~~~~~
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public abstract class BasePage extends JFrame implements ActionListener
    private JPanel objJPanel = null;
    public BasePage()
    setSize(300,200);
    Container objContentPane = getContentPane();
    objJPanel = new JPanel();
    createObjects();
    createPage();
    // Add panels to content pane
    objContentPane.add(objJPanel);
    public void addComponentToPage(JComponent objJComponent)
    objJPanel.add(objJComponent);
    public void addButtonToPage(JButton objJButton)
    objJButton.addActionListener(this);
    objJPanel.add(objJButton);
    public void actionPerformed(ActionEvent objActionEvent)
    System.out.println("Action performed");
    userDefinedButtonClicked(objActionEvent.getActionCommand());
    // overide
    public abstract void createObjects();
    public abstract void createPage();
    public abstract void userDefinedButtonClicked(String sActionCommand);
    file 2
    ~~~~
    import javax.swing.*;
    public class ExtendedPage extends BasePage
    private JTextField objJTextField = null;
    private JButton objJButtonBrowse = null;
    public ExtendedPage()
    super();
    public void createObjects()
    objJTextField = new JTextField(20);
    objJButtonBrowse = new JButton("Start");
    objJButtonBrowse.setActionCommand("START");
    public void createPage()
    addComponentToPage(objJTextField);
    addButtonToPage(objJButtonBrowse);
    public void userDefinedButtonClicked(String sActionCommand)
    if ((sActionCommand != null) && (sActionCommand.equals("START")) )
    start();
    private void start()
    objJTextField.setText("Doesn't work");
    public static void main(String[] args)
    ExtendedPage objEP = new ExtendedPage();
    objEP.show();

    Hello ppaulf,
    Your problem is in your ExtendedPage.java file. You can fix this by changing the line
    private JTextField objJTextField = null;to:
    private JTextField objJTextField = new JTextField();This creates a proper instance.
    Good luck,
    Ming
    Developer Technical Support
    http://www.sun.com/developers/support

  • The string '' is not a valid XsdDateTime value

    I have the TSQL code displayed below, trying to generate the following XML:
    <Provider xmlns="http://www.tn.gov/mental/Schemas/CrisisAssessment" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.tn.gov/mental/Schemas/CrisisAssessment">
    <NPI>1306875695</NPI>
    <FileCreationDate>2014-01-31</FileCreationDate>
    <FileCreationTime>10:51:03</FileCreationTime>
    <Patient>
    <ProviderPatientNo>190366</ProviderPatientNo>
    <LastName>Gi</LastName>
    <FirstName>Brandon</FirstName>
    <PhoneAssessment>
    <ProviderPhoneAssessmentId>4F2E4674-FDB5-4D8F-8D9C-01AFF9DFA3A1</ProviderPhoneAssessmentId>
    <F2FAssessment>
    <ProviderF2FAssessmentId>D0A5A65B-3F30-47A4-A350-AE3CBC68DA25</ProviderF2FAssessmentId>
    <DateTransportedToFacility xsi:nil="true" />
    <TimeTransportedToFacility xsi:nil="true" />
    <FollowupContacted>0</FollowupContacted>
    </F2FAssessment>
    </PhoneAssessment>
    </Patient>
    </Provider>
    But instead this looks like:
    <Provider xmlns="http://www.tn.gov/mental/Schemas/CrisisAssessment" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.tn.gov/mental/Schemas/CrisisAssessment">
    <NPI>1306875695</NPI>
    <FileCreationDate>2014-01-31</FileCreationDate>
    <FileCreationTime>10:51:03</FileCreationTime>
    <Patient>
    <ProviderPatientNo>190366</ProviderPatientNo>
    <LastName>Gi</LastName>
    <FirstName>Brandon</FirstName>
    <PhoneAssessment>
    <ProviderPhoneAssessmentId>4F2E4674-FDB5-4D8F-8D9C-01AFF9DFA3A1</ProviderPhoneAssessmentId>
    <F2FAssessment>
    <ProviderF2FAssessmentId>D0A5A65B-3F30-47A4-A350-AE3CBC68DA25</ProviderF2FAssessmentId>
    <DateTransportedToFacility />
    <TimeTransportedToFacility />
    <FollowupContacted>0</FollowupContacted>
    </F2FAssessment>
    </PhoneAssessment>
    </Patient>
    </Provider>
    This is the TSQL code for this:
    ; with prov as (
    select NPI,FileCreationDate, FileCreationTime
    from July2013_Import_Final
    group by NPI,FileCreationDate, FileCreationTime
    SELECT
    NPI as [NPI],
    FileCreationDate as [FileCreationDate],
    FileCreationTime as [FileCreationTime],
    Select
    ProviderPatientNo ,
    LastName as [LastName],
    FirstName as [FirstName],
    Select
    t_phone.ProviderPhoneAssessmentId,
    t_assess.ProviderF2FAssessmentId as [F2FAssessment/ProviderF2FAssessmentId],
    [DateTransportedToFacility] as [F2FAssessment/DateTransportedToFacility],
    TimeTransportedToFacility AS [F2FAssessment/TimeTransportedToFacility]
    FollowupContacted AS [F2FAssessment/FollowupContacted]
    FROM (select distinct ProviderPatientNo, ProviderPhoneAssessmentId,ProviderF2FAssessmentId
    from #phones where CallDisposition in (1,5,8) and ProviderPhoneAssessmentId = t_base.ProviderPhoneAssessmentId) t_phone
    inner join #Assessments t_assess On t_phone.ProviderPatientNo = t_assess.ProviderPatientNo and t_assess.ProviderF2FAssessmentId is not null
    left join #Drugs d on d.ProviderF2FAssessmentId = t_assess.ProviderF2FAssessmentId
    left join #HospAlt ha on ha.ProviderF2FAssessmentId = t_assess.ProviderF2FAssessmentId
    left join #HospDisp hd on hd.ProviderF2FAssessmentId = t_assess.ProviderF2FAssessmentId
    --where t_phone.ProviderPatientNo = '00200791'
    FOR XML PATH('PhoneAssessment'), ELEMENTS, type) AS [*]
    FROM (select distinct ProviderPhoneAssessmentId, ProviderPatientNo,LastName,FirstName,SSN,DOB,Gender,Race,Ethnicity from #base
    ) t_base
    FOR XML PATH('Patient'), type
    from prov
    for xml path(''), root('Provider')
    And I don't want to use the code:
    FOR XML PATH('PhoneAssessment'), ELEMENTS XSINIL, TYPE)
    Because I don't want this behavior for all elements.  How can I modify my SQL query?
    Ryan D

    I see it very quickly when you point it out.  Without your note, it would have taken a good five minutes of painstaking node by node comparison.
    What is the data type of these two columns?  The xml that is produced is like it is a varchar that is empty string. 
    I will assume that these are varchar.  Add the following bits (I have added the full namespace declaration as part of your with clause):
    ; with xmlnamespaces (
    default 'http://www.tn.gov/mental/Schemas/CrisisAssessment'
    , 'http://www.w3.org/2001/XMLSchema-instance' as xsi)
    , prov as (
    case when isnull([DateTransportedToFacility], '') = ''
    then 'true' else null end as [F2FAssessment/DateTransportedToFacility/@xsi:nil],
    [DateTransportedToFacility] as [F2FAssessment/DateTransportedToFacility/*],
    case when isnull([TimeTransportedToFacility], '') = ''
    then 'true' else null end as
    [F2FAssessment/TimeTransportedToFacility/@xsi:nil],
    TimeTransportedToFacility AS [F2FAssessment/TimeTransportedToFacility/*]
    Russel Loski, MCT, MCSE Data Platform/Business Intelligence. Twitter: @sqlmovers; blog: www.sqlmovers.com

  • When primary table is also join table and you have NOT NULL constraints

    Hi,
    Me again. This is similar to the message titled "Problem with an
    optional 1 to 1 relationship modelled using a link table". Whats
    different about this case is we are dealing with a one to many relationship.
    Given this SQL:
    create table person (
    pid INTEGER(10) NOT NULL,
    language_code VARCHAR(3) NOT NULL
    create table language_person (
    pid INTEGER(10) NOT NULL REFERENCES person(pid),
    language_code VARCHAR(3) NOT NULL,
    first_name VARCHAR(20) NOT NULL
    I wrote these classes (abbreviated)
    Person:
    * @jdo:persist
    * @jdo:identity-type application
    * @jdo:objectid-class PersonId
    * @jdo:requires-extent false
    * @jdo:extension vendor-name="kodo" key="table"
    * value="PERSON"
    * @jdo:extension vendor-name="kodo" key="lock-column"
    * value="none"
    * @jdo:extension vendor-name="kodo" key="class-column"
    * value="none"
    public class Person {
    * @jdo:primary-key true
    * @jdo:extension vendor-name="kodo" key="data-column"
    * value="PID"
    private int pid;
    * @jdo:extension vendor-name="kodo" key="data-column"
    * value="LANGUAGE_CODE"
    private String languageCode;
    * @jdo:collection element-type="LanguagePerson"
    * @jdo:extension vendor-name="kodo" key="pid-data-column"
    * value="PID"
    * @jdo:extension vendor-name="kodo" key="table"
    * value="LANGUAGE_PERSON"
    * @jdo:extension vendor-name="kodo" key="pid-ref-column"
    * value="PID"
    * @jdo:extension vendor-name="kodo"
    key="languageCode-data-column"
    * value="LANGUAGE_CODE"
    * @jdo:extension vendor-name="kodo"
    key="languageCode-ref-column"
    * value="LANGUAGE_CODE"
    private Set languagePersons = new HashSet();
    public Person(int pid, String languageCode) {
    this.pid = pid;
    this.languageCode = languageCode;
    public void addLanguagePerson(LanguagePerson languagePerson) {
    languagePersons.add(languagePerson);
    public Set getLanguagePersons() {
    return languagePersons;
    LANGUAGE_PERSON
    * @jdo:persist
    * @jdo:identity-type application
    * @jdo:objectid-class LanguagePersonId
    * @jdo:requires-extent false
    * @jdo:extension vendor-name="kodo" key="table"
    * value="LANGUAGE_PERSON"
    * @jdo:extension vendor-name="kodo" key="lock-column"
    * value="none"
    * @jdo:extension vendor-name="kodo" key="class-column"
    * value="none"
    public class LanguagePerson {
    * @jdo:primary-key true
    * @jdo:extension vendor-name="kodo" key="data-column"
    * value="PID"
    private int pid;
    * @jdo:primary-key true
    * @jdo:extension vendor-name="kodo" key="data-column"
    * value="LANGUAGE_CODE"
    private String languageCode;
    * @jdo:extension vendor-name="kodo" key="data-column"
    * value="FIRST_NAME"
    private String firstName;
    public LanguagePerson(int pid, String languageCode, String firstName) {
    this.pid = pid;
    this.languageCode = languageCode;
    this.firstName = firstName;
    And then I do this:
         PersistenceManager pm = JDOFactory.getPersistenceManager();
    pm.currentTransaction().begin();
    final Person person = new Person(1,"EN");
    final LanguagePerson languagePerson = new
              LanguagePerson(1,"EN","Mike");
    person.addLanguagePerson(languagePerson);
    pm.makePersistent(person);
    pm.currentTransaction().commit();
    The SQL that issues forth is this:
    1125 [main] INFO jdbc.SQL - [ C:6588476; T:6166426; D:2891371 ]
    preparing statement <17089909>: INSERT INTO PERSON(LANGUAGE_CODE, PID)
    VALUES (?, ?)
    1125 [main] INFO jdbc.SQL - [ C:6588476; T:6166426; D:2891371 ]
    executing statement <17089909>: [reused=1;params={(String)EN,(int)1}]
    1125 [main] INFO jdbc.SQL - [ C:6588476; T:6166426; D:2891371 ]
    preparing statement <9818046>: INSERT INTO
    LANGUAGE_PERSON(LANGUAGE_CODE, PID) VALUES (?, ?)
    1125 [main] INFO jdbc.SQL - [ C:6588476; T:6166426; D:2891371 ]
    executing statement <9818046>: [reused=1;params={(String)EN,(int)1}]
    1140 [main] INFO jdbc.SQL - [ C:6588476; T:6166426; D:2891371 ]
    preparing statement <24763620>: INSERT INTO LANGUAGE_PERSON(FIRST_NAME,
    LANGUAGE_CODE, PID) VALUES (?, ?, ?)
    1140 [main] INFO jdbc.SQL - [ C:6588476; T:6166426; D:2891371 ]
    executing statement <24763620>:
    [reused=1;params={(String)Mike,(String)EN,(int)1}]
    And the second INSERT fails on Oracle because FIRST_NAME is null, and
    the table definition requires it to be NOT NULL.
    Is there anyway I can get Kodo to figure out its dealing with the same
    table for inserting the link columns and the full row, and optimize
    accordingly i.e do one INSERT for LANGUAGE_PERSON?
    I guess my only other options are a) introduce an explicit link table or
    b) define a custom mapping?
    Thanks,
    Mike.

    There are examples of 1-Many mappings in the documentation:
    http://www.solarmetric.com/Software/Documentation/latest/docs/
    ref_guide_meta_examples.html
    The important point I think you've missed is that right now, 1-many
    mappings always require an inverse 1-1 mapping. Again, see the docs
    above.
    So your LanguagePerson needs a field of type Person, and whenever you add
    a LanguagePerson to a Person, make sure to set that LanguagePerson's
    Person too. LanguagePerson.person will use the same PID column as
    LanguagePeson.pid. Kodo has no problem with having 2 mappings
    mapped to the same column.
    Kodo 3.0 will allow 1-Many relations without an inverse 1-1.

  • If is not null

    I could not get my VBA to work with is not null, so I did a len statement instead (But that is also not working)
    If the field is not null then...
    Private Sub Form_Load()
    Dim Cfilter As String
    Cfilter = ""
    Filter = ""
    OrderBy = ""
    'On Error GoTo Matzke0001
    'If Forms![View].[Coordinator] = -1 Then
    'Cfilter = " And [Owner]= '" & Forms![View].[LF] & "'"
    'End If
    If Len(Forms![View].[FC-Start]) > 0 Then
    Cfilter = Cfilter & " And [Start] >= Forms![View].[FC-Start] "
    Cfilter = Cfilter & " And [Start] is not null "
    End If
    If Len(Forms![View].[FC-End]) > 0 Then
    Cfilter = Cfilter & " And [Stop] <= Forms![View].[FC-End] "
    Cfilter = Cfilter & " And [Stop] is not null "
    End If
    If Len(Forms![View].[FC-Type]) > 0 Then
    Cfilter = Cfilter & " And [Type] = Forms![View].[FC-Type] "
    End If
    If Len(Forms![View].[FC-Status]) > 0 Then
    Cfilter = Cfilter & " And [Status] = Forms![View].[FC-Status] "
    End If
    If Forms![View].[Minor] = True Then
    Cfilter = Cfilter & " And [Cost] < Forms![View].[FC-Threshold] "
    End If
    If Forms![View].[Major] = True Then
    Cfilter = Cfilter & " And [Cost] >= Forms![View].[FC-Threshold] "
    End If
    'Me.Filter = Mid(Cfilter, 6)
    'FilterOn = True
    'Exit Sub
    'Matzke0001:
    'MsgBox "Error in programming: Please inform the administrator of this program"
    End Sub

    Never mind, I corrected it.  (Disabled my filter line)

  • Insert a single space into a NOT NULL column defined as CHAR(1)

    Hi,
    I am trying to run a C program in which I am inserting a space character into a database table, where the column has been defined as CHAR(1) NOT NULL.
    I am initialising a variable defined in C as: char, with a blank but after running the insert statement I get an error: ORA-01400: cannot insert NULL into �. .
    create table nullTest ( col1 char(1) NOT NULL );
    Sample code:
    EXEC SQL BEGIN DECLARE SECTION;
    char dbo_cValue;
    EXEC SQL END DECLARE SECTION;
    dbo_cValue = � �;
    EXEC SQL
    INSERT
    INTO nullTest
    col1
    VALUES
    :dbo_cValue
    My options are: char_map=charz, code=ANSI_C, mode=ANSI.
    I understand that if I was using char_map = VARCHA2, on input - if the input value contains nothing but blanks Oracle treats it like a null, but I am not using VARCHAR2 option, but CHARZ.
    I tried STRING and other options and I cannot get this to work.
    Is there a way where I can insert a space character into a table (using a C program), which has a constraint of �not null� while using C type variables?
    I would appreciated any help on this.
    Thank you.

    Since you did not post a sample of the code that produces an error, its hard to speculate what might be wrong with it.
    But, the following sample works, and successfully inserts a space into the table.
    #include <sys/types.h>
    #include <stdio.h>
    EXEC SQL INCLUDE SQLCA ;
    EXEC SQL BEGIN DECLARE SECTION ;
            VARCHAR col[10] ;
            char * uid ;
    EXEC SQL END DECLARE SECTION ;
    int main(void)
            uid = (char *)"/" ;
            EXEC SQL connect :uid ;
            printf("Connected to Oracle!\n") ;
            strcpy(col.arr, " ") ;
            col.len = strlen(col.arr) ;
            EXEC SQL insert into ins_null values (:col) ;
            EXEC SQL COMMIT WORK RELEASE ;
    }And, here is the table definition, and a select after running the above program once.
    SQL> create table ins_null(col varchar2(10) not null) ;
    Table created.
    SQL> select ':'||col||':' from ins_null ;
    ':'||COL||':
    1 row selected.
    SQL>

  • "buffer too small for string or missing null byte" inserting CR in excel

    I have created a Crystal Report based on below stored procedure.
    DELIMITER $$
    DROP PROCEDURE IF EXISTS `ww_test`.`PRD_Data_sp` $$
    CREATE PROCEDURE `ww_test`.`PRD_Data_sp` (in cyear int, in cmonth int, in groupby varchar(20), in Inv_type varchar(4))
    BEGIN
      select
              CASE WHEN groupby='Date' THEN  (p.FKDAT)
                   WHEN groupby='SalesOrg' THEN  CONCAT(p.VKORG,'_',p.VTWEG)
              END ,
              sum(p.QTYSAM),
              sum(p.CASESSOLD),
              sum(p.SOLDDOL)
              from ww_test.prd_data p
              where (month(p.FKDAT)=cmonth and year(p.FKDAT)=cyear) and
                     ((p.FKART) is null or not(p.FKART in ("FAZ","ZMBB","FAS",Inv_Type))) and
                     ((p.AUART) is null or not(p.AUART in ("ZMBB")))
              Group by
                  CASE WHEN groupby='Date' THEN  (p.FKDAT)
                       WHEN groupby='SalesOrg' THEN  CONCAT(p.VKORG,'_',p.VTWEG)
                  END
              Order by
                  CASE WHEN groupby='Date' THEN  (p.FKDAT)
                       WHEN groupby='SalesOrg' THEN  CONCAT(p.VKORG,'_',p.VTWEG)
                  END;
    END $$
    DELIMITER ;
    I have used Add Command to create report based on this.
    call ww_test.prd_data_sp({?Year},{?Month},{?GroupBy},{?InvType});
    I am able to refresh the report in crystal and as well in Infoview without any problem.
    But when i try to insert this report in Excel using Live Office it gives me error. I able to insert other crystal reports without any problem.
    An error occurred while opening the report. The report does not exist; you have insufficient rights to open the report; or you cannot make a connection to the BusinessObjects Web Service. (LO 02010)
    Failed to open report (LO 26619)
    Cannot open report document 
    Buffer too small for string or missing null byte.
    can anyone suggest where i am going wrong? Any input is appreciated.
    Crystal Reports 2008
    Live Office XI 3.1
    BOEdge XI 3.1
    Xcelsius 2008
    Thanks ,
    Madhavi

    With the CurrentValue method
    Crpt.ParamFields[3].CurrentValue := memo1.Text;
    Is there another solution ?

  • How to write a create method for a table Not null fields

    Hi all,
    I have a table with four columns,
    process
    prs_seqid NUMBER(4) NOT NULL,
    prs_sbs VARCHAR2(2) NOT NULL,
    prs_name VARCHAR2(64) NOT NULL,
    description VARCHAR2(128)
    Where prs_seqid is primary key and prs_sbs is foreign key.
    I tried to create a CMP bean for this table. I am unable to write a record in table while I can read
    Records from table. These are the create methods
    public Long ejbCreate() throws CreateException {
    return null;
    public Long ejbCreate(Long newPrs_seqid, String newPrs_sbs, String newPrs_name) throws CreateException {
    prs_seqid = newPrs_seqid;
    newPrs_sbs = prs_sbs;
    prs_name = newPrs_name;
    return null;
    public void ejbPostCreate() {
    public void ejbPostCreate(Long newPrs_seqid, String newPrs_sbs, String newPrs_name) {
    When I run the client code �home.create(pk, "AB", "ABC");�
    It throws
    java.rmi.ServerException: RemoteException occurred in server thread; nested exce
    ption is:
    java.rmi.RemoteException: Transaction aborted (possibly due to transacti
    on time out).; nested exception is: javax.transaction.RollbackException; nested
    exception is:
    javax.transaction.RollbackException
    java.rmi.RemoteException: Transaction aborted (possibly due to transaction time
    out).; nested exception is: javax.transaction.RollbackException; nested exceptio
    n is:
    javax.transaction.RollbackException
    javax.transaction.RollbackException
    <<no stack trace available>>
    In log file I got
    java.sql.SQLException: ORA-01400: cannot insert NULL into ("SCOTT"."PROCESSES"."PRS_SBS")
         at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:168)
         at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:208)
         at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:543)
         at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1405)
         at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.java:822)
         at oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.java:1446)
         at oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.java:1371)
         at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1900)
         at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:363)
         at com.sun.ejb.persistence.PersistenceManagerImpl.createRow(PersistenceManagerImpl.java:630)
         at com.sun.ejb.persistence.PersistenceManagerImpl.storeRow(PersistenceManagerImpl.java:412)
         at com.sun.ejb.persistence.PartitionImpl.ejbStore(PartitionImpl.java:555)
         at com.telesenskscl.processes.ProcessesBean_PM.ejbStore(ProcessesBean_PM.java:103)
         at com.sun.ejb.containers.EntityContainer.callEJBStore(EntityContainer.java:1581)
         at com.sun.ejb.containers.EntityContainer.enlistResourcesAndStore(EntityContainer.java:868)
         at com.sun.ejb.containers.EntityContainer.beforeCompletion(EntityContainer.java:853)
         at com.sun.ejb.containers.ContainerSynchronization.beforeCompletion(ContainerSynchronization.java:65)
         at com.sun.jts.jta.SynchronizationImpl.before_completion(SynchronizationImpl.java:48)
         at com.sun.jts.CosTransactions.RegisteredSyncs.distributeBefore(RegisteredSyncs.java:108)
         at com.sun.jts.CosTransactions.TopCoordinator.beforeCompletion(TopCoordinator.java:2289)
         at com.sun.jts.CosTransactions.CoordinatorTerm.commit(CoordinatorTerm.java:233)
         at com.sun.jts.CosTransactions.TerminatorImpl.commit(TerminatorImpl.java:208)
         at com.sun.jts.CosTransactions.CurrentImpl.commit(CurrentImpl.java:386)
         at com.sun.jts.jta.TransactionManagerImpl.commit(TransactionManagerImpl.java:208)
         at com.sun.enterprise.distributedtx.J2EETransactionManagerImpl.commit(J2EETransactionManagerImpl.java:434)
         at com.sun.ejb.containers.BaseContainer.completeNewTx(BaseContainer.java:1460)
         at com.sun.ejb.containers.BaseContainer.postInvokeTx(BaseContainer.java:1278)
         at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:397)
         at com.telesenskscl.processes.ProcessesBean_PM_RemoteHomeImpl.create(ProcessesBean_PM_RemoteHomeImpl.java:41)
         at com.telesenskscl.processes._ProcessesBean_PM_RemoteHomeImpl_Tie._invoke(Unknown Source)
         at com.sun.corba.ee.internal.POA.GenericPOAServerSC.dispatchToServant(GenericPOAServerSC.java:519)
         at com.sun.corba.ee.internal.POA.GenericPOAServerSC.internalDispatch(GenericPOAServerSC.java:204)
         at com.sun.corba.ee.internal.POA.GenericPOAServerSC.dispatch(GenericPOAServerSC.java:112)
         at com.sun.corba.ee.internal.iiop.ORB.process(ORB.java:273)
         at com.sun.corba.ee.internal.iiop.RequestProcessor.process(RequestProcessor.java:84)
         at com.sun.corba.ee.internal.orbutil.ThreadPool$PooledThread.run(ThreadPool.java:99)
    javax.ejb.EJBException: nested exception is: javax.ejb.EJBException: nested exception is: java.sql.SQLException: ORA-01400: cannot insert NULL into ("SCOTT"."PROCESSES"."PRS_SBS")
    javax.ejb.EJBException: nested exception is: java.sql.SQLException: ORA-01400: cannot insert NULL into ("SCOTT"."PROCESSES"."PRS_SBS")
    java.sql.SQLException: ORA-01400: cannot insert NULL into ("SCOTT"."PROCESSES"."PRS_SBS")
         at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:168)
         at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:208)
         at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:543)
         at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1405)
         at oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(TTC7Protocol.java:822)
         at oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.java:1446)
         at oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.java:1371)
         at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1900)
         at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:363)
         at com.sun.ejb.persistence.PersistenceManagerImpl.createRow(PersistenceManagerImpl.java:630)
         at com.sun.ejb.persistence.PersistenceManagerImpl.storeRow(PersistenceManagerImpl.java:412)
         at com.sun.ejb.persistence.PartitionImpl.ejbStore(PartitionImpl.java:555)
         at com.telesenskscl.processes.ProcessesBean_PM.ejbStore(ProcessesBean_PM.java:103)
         at com.sun.ejb.containers.EntityContainer.callEJBStore(EntityContainer.java:1581)
         at com.sun.ejb.containers.EntityContainer.enlistResourcesAndStore(EntityContainer.java:868)
         at com.sun.ejb.containers.EntityContainer.beforeCompletion(EntityContainer.java:853)
         at com.sun.ejb.containers.ContainerSynchronization.beforeCompletion(ContainerSynchronization.java:65)
         at com.sun.jts.jta.SynchronizationImpl.before_completion(SynchronizationImpl.java:48)
         at com.sun.jts.CosTransactions.RegisteredSyncs.distributeBefore(RegisteredSyncs.java:108)
         at com.sun.jts.CosTransactions.TopCoordinator.beforeCompletion(TopCoordinator.java:2289)
         at com.sun.jts.CosTransactions.CoordinatorTerm.commit(CoordinatorTerm.java:233)
         at com.sun.jts.CosTransactions.TerminatorImpl.commit(TerminatorImpl.java:208)
         at com.sun.jts.CosTransactions.CurrentImpl.commit(CurrentImpl.java:386)
         at com.sun.jts.jta.TransactionManagerImpl.commit(TransactionManagerImpl.java:208)
         at com.sun.enterprise.distributedtx.J2EETransactionManagerImpl.commit(J2EETransactionManagerImpl.java:434)
         at com.sun.ejb.containers.BaseContainer.completeNewTx(BaseContainer.java:1460)
         at com.sun.ejb.containers.BaseContainer.postInvokeTx(BaseContainer.java:1278)
         at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:397)
         at com.telesenskscl.processes.ProcessesBean_PM_RemoteHomeImpl.create(ProcessesBean_PM_RemoteHomeImpl.java:41)
         at com.telesenskscl.processes._ProcessesBean_PM_RemoteHomeImpl_Tie._invoke(Unknown Source)
         at com.sun.corba.ee.internal.POA.GenericPOAServerSC.dispatchToServant(GenericPOAServerSC.java:519)
         at com.sun.corba.ee.internal.POA.GenericPOAServerSC.internalDispatch(GenericPOAServerSC.java:204)
         at com.sun.corba.ee.internal.POA.GenericPOAServerSC.dispatch(GenericPOAServerSC.java:112)
         at com.sun.corba.ee.internal.iiop.ORB.process(ORB.java:273)
         at com.sun.corba.ee.internal.iiop.RequestProcessor.process(RequestProcessor.java:84)
         at com.sun.corba.ee.internal.orbutil.ThreadPool$PooledThread.run(ThreadPool.java:99)
    Please help me ASAP. Thanks in advance

    I found problem was with my code. I wrote
    newPrs_sbs = prs_sbs; instead of
    prs_sbs = newPrs_sbs;
    This solves my problem
    Thanks to all.....

  • Why is the output of the program "String S is null"

    public class StaticOverLoad
         public static void get(String S)
              System.out.println("String S is null");
         public static void get(Object O)
              System.out.println("Object O is null");
         public static void main(String args[])
              StaticOverLoad.get(null);
    }

    When the compiler tries to resolve an overloaded, it tries to get the most specific match. String is a subclass of object, so it is not specific. You can the call the other method by being explicit about your argument type.
    StaticOverLoad.get((Object) null);

  • NoOp in setCurrentRowWithKey as the string key is null

    Hi,
    I'm currently using Jdeveloper 10.1.3 SU 4 and developing an ADF Faces / ADF BC application.
    I have one jsf page that shows a table (with rows loaded from a VO), one of the columns is a commandLink which when clicked allows navigation to another jsf page that shows the details of the selected row (also from a VO). The commandLink has its actionListener set to setCurrentRowWithKey. The two VO's have a master-detail relationship through a View Link.
    What happens is that when I click the commandLink in a row of the table the detail page shows the first record of the VO and not the selected one while it is supposed to be resolved by ADF automatically.
    I noticed that when I click the commandLink, the debug information displayed in the console shows this line:
    06/07/11 15:53:08 [404] ** Warning! NoOp in setCurrentRowWithKey as the string key is null!
    Hope anyone can help.
    Thanks.
    Yoel

    There is an explanation of how to do this here:
    http://www.oracle.com/technology/obe/obe1013jdev/masterdetail_adf_bc/master-detail_pagewith_adf_bc.htm#t9

Maybe you are looking for