Order_id != Order_id in FOrms 4.0 ???
Date: Sun, 23 Oct 94 09:27:01 -0500
Message-ID: <782908021_at_f573.n115.z1.ftn>
- Quoting Richard D Holowczak to All dated 10-19-94 ***
> Please help me out with this one.
> I have two tables, ORDERS and ORDER_DETAILS.
> The Primary key in ORDERS is:
> ORDER_NUMBER CHAR(40)
> It is also a Foreign Key in ORDER_DETAILS.
> With these two blocks in Forms 4.0, the detail items
> can be inserted, but when I query the detail block,
> no records are found.
There is a good reason for this: by creating the ORDER_NUMBER with a sequence,
you are most likely causing an implicit conversion from a numeric datatype to a
character datatype. Forms 4.0, as you might expect, will be comparing character
values to character values, where
'1' != ' 1' and
'1' != '1 '
As you have discovered, by causing another implicit datatype conversion to a
numeric datatype, a numeric comparison is used, and
1 = 1.
This will cause problems not only with Forms, but any other tool you use, and is a VERY bad idea. Suggestions, in order of preference:
- Use a numeric type in the database for numeric values. You will therefore be comparing numbers to numbers and get the results you expect.
- Use the VARCHAR2 type (instead of CHAR) and perform EXPLICIT conversion so that the character values inserted are consistent.
> The same exact form under Forms 3.0 does not
> have this behaviour.
This indicates that trailing space is the most likely scenario; Forms 3.0 considered '1 ' = '1' because it does not understand the difference between CHAR and VARCHAR2 datatype. Forms 4.0 does, and '1 ' != '1', properly, for CHAR datatypes. (VARCHAR2 datatypes do not store trailing spaces, like the former CHAR datatype under v6.) Received on Sun Oct 23 1994 - 15:27:01 CET