Fieldname truncated in sql/data/fieldname

Author: eugene.truter@sita.co.za (eg)

Hi, I'm using sql/data/fieldname to return the fieldname selected but it seems that the fieldname is truncated to the length of the result of the field. Is this correct? (example: in $IDF: "select U_VLAB, ICDEFINED from UCSCH" will return fieldnames of U_VLAB and I in the first row. Was kind of hoping for U_VLAB and ICDEFINED). Cheers e

6 Comments

  1. Hi e, May I assume that you are using Oracle? The described behavior is (AFAIK) specific for the Oracle connectors and it's occurring for both sql/data and sql/print. The field names are "shortened" according to the size of the data (e.g. ICDEFINED is a Boolean field with the size 1). This issue already has been recognized as BUG 30845 and it's currently under review. At this moment I cannot provide you any info about if and when this problem could be resolved. If you need more details then please log a call with Uniface Support. And for the given example there is of course a simple workaround: since the specific field names that are returned by sql/data/fieldname are already known the result list could be easily updated. And in case all fields are read (e.g. "select * from UCSCH") then the complete field names could be retrieved using the following (Oracle-specific) SQL statement:

    • "select COLUMN_NAME from ALL_TAB_COLUMNS where TABLE_NAME='UCSCH'"

    I hope this helps. Best regards, Daniel


    Author: diseli (daniel.iseli@uniface.com)
  2. Hi Daniel, Thanks for the feedback. You are right, I'm using Oracle and I've just tested the scenario on SLE and see that it does indeed return the full names of the fields. Unfortunately I won't be able to use the suggested COLUMN_NAME from ALL_TAB_COLUMNS option as the select statements select specific fields from the tables which makes it quite hard to determine with code as the select statements can get quite fancy/ridiculous. Bug fix will help in the long run, I just need to get all my users off XP first (sigh). All the best. e.


    Author: eg (eugene.truter@sita.co.za)
  3. Hi Eugene, I presume you've tried this? 'select U_VLAB, ICDEFINED as ICDEFINED from UCSCH' hth, Knut


    Author: Knut (knut.dybendahl@gmail.com)
  4. Hi Knut, Yes, I tried the alias but alas! Like Daniel said, it looks like it only happens with the Oracle driver (haven't tried it on any of the other major DBMS drivers) but it works on SLE.  I implemented a workaround in the meantime, not ideal but for now must do as I said I still have users on XP so a patch won't help me in anyway. Thanx for the response though! Cheers! e.


    Author: eg (eugene.truter@sita.co.za)
  5. Thanks for sharing this. I use Oracle almost all the time so I'm used to this behavior. It's the same in SQLPlus in oracle and is exactly the same if you use sql/print in Uniface. Oracle truncates the names of columns according to column "width". So if it is a boolean in Uniface then it is char(1) in Oracle so we see only the first letter of the column name. But as I said it is the same in sqlplus or anything (in Oracle) so we're used to it.


    Author: sochaz (zdenek.socha@fullsys.cz)
  6. Just an update on this if anyone is interested. Found a workaround on this, in your select statement, concat the fieldname with single quotes and use an alias to give the full heading name. Seems like oracle reserves around 30 characters for the name. Something like this (select u_version || '' Version from tablename). Cheers e.


    Author: eg (eugene.truter@sita.co.za)