× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Confirmed on both my boxes and I tried inserting a record in the production
database and that did not fail. Weird.

INSERT INTO G2PROD/TRIP_NOTE (ADDED_TIMESTAMP, ADDED_USER_ID,
UPDATED_TIMESTAMP, UPDATED_USER_ID, OBJECT_VERSION, TRIP_ID,
SUBJECT, NOTE, CUSTOMER_ID, USER_WHO_ADDED, NOTE_NUMBER,
CREATED_DATE) VALUES(current timestamp, 43, current timestamp, 43,
0, 232907, 'APPOINTMENT', ' D', 49863, 43, 5, Current Timestamp)

A statement like this one was failing yesterday on this table and I
confirmed that the constraint was defined as NOTE <> '<b>'. Hmmm.


On Fri, Apr 9, 2010 at 9:31 AM, Alan Campin <alan0307d@xxxxxxxxx> wrote:

Hmmm. This is very interesting. I tried defining a test table with the
following DDL and I cannot get it to fail this morning. Yesterday on a
production table I was getting insert errors when the first character was a
blank but on the test table I am not getting it. It is performing as
expected.

CREATE TABLE G2ALN.TEST_BLANK (
ID BIGINT GENERATED ALWAYS AS IDENTITY (
START WITH 1 INCREMENT BY 1
NO MINVALUE NO MAXVALUE
NO CYCLE NO ORDER
CACHE 20 )
,
AVARCHAR VARCHAR(10) CCSID 37 NOT NULL ,
ACLOB CLOB(1048576) CCSID 37 NOT NULL ) ;

ALTER TABLE G2ALN.TEST_BLANK
ADD CONSTRAINT G2ALN.Q_G2ALN_TEST_BLANK_ACLOB_00001
CHECK( ACLOB <> ' ' ) ;

ALTER TABLE G2ALN.TEST_BLANK
ADD CONSTRAINT G2ALN.Q_G2ALN_TEST_BLANK_AVARCHAR_00001
CHECK( AVARCHAR <> ' ' ) ;

INSERT INTO G2ALN/TEST_BLANK (AVARCHAR, ACLOB) VALUES(' Mary',
'SAM')

INSERT INTO G2ALN/TEST_BLANK (AVARCHAR, ACLOB) VALUES('Willie',
' GREEN')

No error on either one.

SELECT ID, AVARCHAR, Cast(ACLOB As VarChar(128)) FROM
g2aln/test_blank

Id Varchar CAST function
1 Mary SAM
2 Willie GREEN


On Fri, Apr 9, 2010 at 6:32 AM, Charles Wilt <charles.wilt@xxxxxxxxx>wrote:

Bryce,

I was thinking Alan's issue might be related to '' vs. ' '....

So I tried it both ways. Both cases work the same.

I'd say either Alan is missing a PTF or his Check constraint isn't
defined like he thinks it it.

The only way I could get <b>THOMAS<b><b><b> to not work was to have a
constraint (fld1 not like ' %' )


Charles


On Fri, Apr 9, 2010 at 8:23 AM, Bryce Martin <BMartin@xxxxxxxxxxxx>
wrote:
Maybe I'm missing something, but wouldn't you just do NAME <> '';

No space inside. Then won't it look to see if the value you are
comparing
to is empty(all blanks)? That is how I do it in my sql statements....
then again, our text fields don't usually start with a blank so maybe I
have potential bugs all over the place.


Thanks
Bryce Martin
Programmer/Analyst I
570-546-4777



Alan Campin <alan0307d@xxxxxxxxx>
Sent by: midrange-l-bounces@xxxxxxxxxxxx
04/08/2010 07:38 PM
Please respond to
Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxx>


To
Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxx>
cc

Subject
Constraint comparing blanks.






When you are declare DDL for an SQL defined table we use a lot of stuff
like
this

NAME <> ' ';

I would have thought that this would expand to be compare say 10 char
name
to 10 char blank but I saw today that is not true.

If you have the following in a field name the test will fail because it
only
looks at the first character.

<b>THOMAS<b><b><b> where <b> is a blank.

What is the correct way to declare this test? In RPG you have a *ALL' '
but
not in SQL.

You surely don't want to code

NAME <> ' '

I know there has to be a simple way to do it. Just can't think of it off
the
top of my head.
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.



--- This message (including any attachments) is intended only for the
use of the individual or entity to which it is addressed and may contain
information that is non-public, proprietary, privileged, confidential, and
exempt from disclosure under applicable law. If you are not the intended
recipient, you are hereby notified that any use, dissemination,
distribution, or copying of this communication is strictly prohibited. If
you have received this communication in error, please notify us and destroy
this message immediately. ---
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.


--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.




As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.