Hey Focs! I haven't been on Focal Point for a while. I hope I didn't miss anything exciting
Please take a look at the two Ad Hoc procedures below and tell me if I'm dreaming or something...
TABLE FILE SYSCOLUM
PRINT TBNAME TABLE_NAME FILENAME
WHERE TBNAME EQ 'car';
END
This returns TBNAME TABLE_NAME FILENAME car car CAR
and this
TABLE FILE SYSCOLUM
PRINT TBNAME TABLE_NAME FILENAME
WHERE TBNAME EQ 'CAR';
END
returns TBNAME TABLE_NAME FILENAME CAR CAR CAR
How can this be???This message has been edited. Last edited by: Dan Pinault,
7.7.05M/7.7.03 HF6 on Windows Server 2003 SP2 output to whatever is required.
November 16, 2011, 05:18 PM
njsden
quote:
I'm dreaming or something...
No, you're not ... unless we both are.
In fact, I queried SYSCOLUM with other variations of 'CAR': Car, cAr, CAr, etc. and in all cases, TBNAME and TABLE_NAME fields display the value exactly as it was specified in the WHERE condition.
SYSCOLUM is a "special" master and perhaps its internal wiring is designed to work that way. I tested querying other master files (the ones I have defined over a few Oracle tbles) and the behaviour is the same so it's nothing related only to FOCUS files.
Well, table names are of course case-insensitive in SQL, so those results amount to the same thing for SQL. You'd expect to get the table name case-folded to either upper-case or lower-case in a consistent manner, though.
However, it gets more interesting when you use LIKE...
TABLE SYSCOLUM
BY TBNAME
BY TABLE_NAME
BY FILENAME
WHERE TBNAME LIKE 'car%';
END
That gets us: car car CAR
Now try it in uppercase:
TABLE SYSCOLUM
BY TBNAME
BY TABLE_NAME
BY FILENAME
WHERE TBNAME LIKE 'CAR%';
END
That get us: nothing!
I think there may be a difference to do with NLS handling between those two operators.
WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010 : Member of User Group Benelux :
November 17, 2011, 04:59 AM
HÃ¥kan
My best guess would be it rather depends on whether you set the collation to be case-sensitive or not. It's not a matter of NLS.
Hmm - I'll take a look at the collation settings. For most things we are doing it's not an issue but we've starting using the &&IBI_IF_FLDS variable to limit access to certain fields. Everywhere else we reference table names in upper case but in this particular case (pun intended) we need to do it like this...
WHERE ((TBNAME EQ 'mytable') AND (NAME EQ 'COL1' OR 'COL2' OR 'COL3'));
Thanks to everyone for confirming my sanity
Dan
7.7.05M/7.7.03 HF6 on Windows Server 2003 SP2 output to whatever is required.
November 18, 2011, 01:32 PM
Norb Eckert
Frankly Dan, I'm not so sure that this does confirm your sanity.