on 08-22-2013 8:33 AM
Hi,
Data have been inserted in SBO HANA 9.0. When I make a Query in the HANA Studio I got no result by this Query:
select * from "TRAININGDB_ENGLISH"."OITM" WHERE "ItemCode" = 'PURSER'
when I change the Query to:
select * from "TRAININGDB_ENGLISH"."OITM" WHERE TRIM("ItemCode") = 'PURSER'
I got a correct result.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Manfred,
Cloud you post OITM table structure? It is column or row table?
Regards,
Jerry
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jerry,
that is the structure of the OITM : (the beginn and the end).
with RTRIM and LTRIM I got also everytime a result.
CREATE ROW TABLE "TRAININGDB_ENGLISH"."OITM" ( "ItemCode" NVARCHAR(20) CS_STRING NOT NULL,
"ItemName" NVARCHAR(100) CS_STRING,
"FrgnName" NVARCHAR(100) CS_STRING,
"ItmsGrpCod" SMALLINT CS_INT DEFAULT 100,
"CstGrpCode" SMALLINT CS_INT DEFAULT -1,
....
"U_beas_prodrelease" CHAR(1) CS_FIXEDSTRING,
"U_beas_mps" CHAR(1) CS_FIXEDSTRING,
PRIMARY KEY ( "ItemCode" ) )
Regards
MAnfred
Well, trim = ltrim(rtrim(data)), but since the data already does not have any blank space as confirmed by Manfred, none of the trim functions should have impact on the query output.
Also the replace function did not show any blank values in the data.
I tried to create a row table with varchar field and inserted data smaller than the column width. But I could get the result without the need to use trim function.
I am not sure, but this could also be a bug. Back to a basic question, can you please check and confirm if your DB server and HANA studio are on the same revision.
Regards,
Ravi
Hi Manfred,
May be it could be a bug. Can you please check one thing, just to be very sure.
Please update the table as follows:
update "TRAININGDB_ENGLISH"."OITM" set "ItemCode" = 'PURSER'
WHERE "ItemCode" = 'PURSER'; -- TRIM("ItemCode") = 'PURSER' -- please check which ever works.
The update is to ensure that you have the data without any blank spaces and then you can try the select statement again.
If it still doesn't work, then it is a bug for sure.
Can you please check the feasibility to upgrade to more recent revisions.
Regards,
Ravi
Hi Manfred,
I have checked and tested based on posted table structure, It has no problem, I could not find reason, it maybe encode issue.
Could you try below sql statement to check again.
UPDATE "TRAININGDB_ENGLISH"."OITM" SET "ItemCode"='PURSER' WHERE TRIM("ItemCode") = 'PURSER';
select * from "TRAININGDB_ENGLISH"."OITM" WHERE "ItemCode" = 'PURSER';
Regards,
Jerry
Hi Ravi,
Thank you for your reminder, I checked, sorry for my missed this part.
Based Manfred's test result, I agreed with you, it should be imported data encoding issue.
Hi Manfred,
Please ignore my posted comments within today, you can check it based on Ravi's suggestion. You can change encoding to UTF-8 as well, I think.
Regards,
Jerry
Hi Manfred,
Please run the following query to identify the blank spaces in the data.
select lenght('PURSER') as "L1", length("ItemCode") as "L2", replace("ItemCode", ' ', 'XX') from "TRAININGDB_ENGLISH"."OITM" WHERE "ItemCode" like '%PURSER%'
compare the first length L1 with L2 and check if the blank spaces in third column are replaced by XX.
Regards,
Ravi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Manfred,
If there are no blank spaces, then trim really doesn't remove anything. Can you please check the following query:
select * from "TRAININGDB_ENGLISH"."OITM" WHERE "ItemCode" like 'PURSER';
If there are no blank spaces and the value is indeed just 'PURSER', then the query should return the data.
You can also check ascii(left("ItemCode", 1)) to check if it returns 32 for blank value.
Regards,
Ravi
Hi Manfred,
The table("OITM") should be have record with space word, you can check your original imported data whether contain space word or not.
besides, could you also check column type for "itemcode"? it is char or varchar type or other type.
If the column type is char, then it will auto-insert space word, if the record has no enough characters.
Regards,
Jerry
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
78 | |
9 | |
9 | |
7 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.