How to remove the message below? - forms

Message => FRM-40831: Truncation occurred: value too long for field PHONE.
I have table named 'CLIENT'. The table has many fields. One of the field name is 'PHONE'. The field data type and length is VARCHAR2(20 byte). By using the 'CLIENT' table I have created a form using Forms Developer 10g. It works fine. But I have changed the field length and Forms Property Value as VARCHAR2(40 byte) and Forms Property > Maximum Length = 40. Now the Form data save smoothly. But when I am going to retrieve data the message shows => FRM-40831: Truncation occurred: value too long for field PHONE.
N.B: The message shows when it gates the value over than 20 characters otherwise not.
How to solve the problem?
Please help me.

Apparently you are facing the multi-byte character set problem.
Define your column as VARCHAR2(40 CHAR).
Currently the column can contain only 40 bytes, so if - as I assume - you use multi-byte character set in your database, the truncation occurs.

Related

I always get a value of 255 characters

I have a table in my Postgres DB. In this table, there is a column city this column has type character and length 255.
When I try to add a city in this column, for example, London and after that, I try to get this city I get a value with 255 lengths.
Looks likes [London....................-255] where dots are empty characters
When I add value in db always doing trim.
I use pg for node js
As the comment says, you don't want to use character(255) as the field type, which is always 255 characters, padded with whitespace.
Instead, you might consider using varchar(255), but even so, you probably don't actually want to limit the length here – Postgres doesn't care, storage-wise!, whereas MySQL does – so just use text.

Getting NULL Value in Stored Procedure TEXT Column

Below Query, I am using to get the SP definition but in TEXT column I am getting as NULL Value in IBM DATA Studio but I am able to CALL the SP.
SELECT PROCNAME, TEXT FROM SYSCAT.PROCEDURES WHERE PROCNAME LIKE '%USP_ABC%'
Please Help
You have confirmed that the syscat.procedures.language is SQL, and that your query-tool is able to display a substr() of the text.
Workaround depends on the length(text) of the row of interest:
SELECT PROCNAME, substr(TEXT,1, 1024) FROM SYSCAT.PROCEDURES WHERE PROCNAME LIKE '%USP_ABC%'
You may need to adjust the length of the substr extract depending on the length of the text and your configuration. For example substr(TEXT, 1, 2048 ) or a higher value for the length as necessary that your query-tool can cope with.
You can find the length of the text column with the LENGTH(TEXT) for the row of interest.
You can also CAST a CLOB to char or varchar to a length that fits within their limits and whatever query tool limitations you have.
Another option is to use a different query tool that can work with CLOB.
Are you using the latest version of Data Studio with the latest fix? It sounds like you might have an invalid UTF-8 character in you SP, or as you are using SUBSTR and SUBSTRING you are breaking a mulit-byte character in two.
You could try setting
-Ddb2.jcc.charsetDecoderEncoder=3
in your eclipse.ini to get Java to use a replacment character rather than replace the invalid string with nul
See this tech note
https://www-01.ibm.com/support/docview.wss?uid=swg21684365
Otherwise, do raise this with IBM Suppport

sqlldr test for number format

I am loading data into Oracle 12c using sqlldr using a CTL file as below :
OPTIONS (rows=1000, bindsize=100000, readsize=100000, silent=header,feedback)
load data
CHARACTERSET UTF8
insert into table TABLEA
fields terminated by '^' optionally enclosed by ','
trailing nullcols
(
NAME,
VOLUME "decode(:VOLUME,null,0,to_number(:VOLUME,'9999999999D999'))",
TEXT
)
I am facing difficulty when the number field VOLUME defined in table as NUMBER(13,3) comes in different formats.
ABCD^1089.830^CIQ
ABCD^1,089.830^CIQ
ABCD^1.089,830^CIQ
Is there a way to load all three formats of number field in field 2 above using sqlldr ?
Expected value in the table is 1089.830 for the all three cases .
Thanks.
This is a tad ugly but it should work. It assumes your volume value data will always have 3 decimal points and the decimal symbol will be a period (based on your number format). First pass removes all region-specific characters, then second pass puts the period in 3 places from the end:
...
VOLUME decimal external "regexp_replace(regexp_replace(:VOLUME, '[\.,]', ''), '([0-9]+)([0-9]{3})', '\\1.\\2')",
...
You may not need the "decimal external", try it without and see.

Problems converting a crystal reports running total string to a number

I have a problem with converting a running totals string to a number.
The running total is set to retrieve the maximum value of a field that contains results. It is reset with change of a group and evaluated by a formula so that only results from a specific test is used.
The result database field is a string since there are test with text results as well as tests with numeric results in the database. The test I'm filtering out only have numeric results (saved as string).
The running total works fine and gives the correct result, but I want to change it from a string to a number to be able to set the number of decimals and use rounding in the report, and this is where my problem begins.
As far as I can tell there is no way of using the format field in this case. (Which is resonable since it is a string field.)
I've tried using a formula field with the following formula:
if isNumeric({#P-LDL}) then toNumber({#P-LDL})
but that returns 0.00 for all non-null values even though the strings are nice things like "2.36" or "3.74" (without the quotes).
I've also tried the old school approach of resetting a global variable in the group head, assigning it a value in the details section when a post with the correct test comes along, and then finally display it in the group footer, but I get the same 0.00 result. I've tried both using a numeric global variable and do the conversion on the details-level, and using a string variable and do the conversion in the footer-level.
Solved it:
if NumericText(Replace({#P-LDL}, ".", ",")) then
ToNumber(Replace({#P-LDL}, ".", ","))
Stupid locales...

How can I truncate data to fit into a field using SQL*Loader? (ORA-12899)

Using Oracle SQL*Loader, I am trying to load a column that was a variable length string (lob) in another database into a varchar2(4000) column in Oracle. We have strings much longer than 4000 characters, but everyone has agreed that these strings can and should be truncated in the migration (we've looked at the data that goes beyond 4000 characters, it's not meaningful). To do so, I specified the column this way in the control file:
COMMENTS CHAR(65535) "SUBSTR(:COMMENTS, 1, 4000)",
However, SQL*Loader still rejects any row where this record is longer than 4000 characters in the data file:
Record 6484: Rejected - Error on table LOG_COMMENT, column COMMENTS.
ORA-12899: value too large for column COMMENTS (actual: 11477, maximum: 4000)
Record 31994: Rejected - Error on table LOG_COMMENT, column COMMENTS.
ORA-12899: value too large for column COMMENTS (actual: 16212, maximum: 4000)
Record 44063: Rejected - Error on table LOG_COMMENT, column COMMENTS.
ORA-12899: value too large for column COMMENTS (actual: 62433, maximum: 4000)
I tried taking a much smaller substring and still got the same error. How can I change my control file to truncate string data longer than 4000 characters into a varchar2(4000) column?
Check to make sure your data ENCODING and Oracle ENCODING are not conflict.
In this case, use CHARACTERSET option when loading.
by all accounts
COMMENTS CHAR(65535) "SUBSTR(:COMMENTS, 1, 4000)",
is the correct syntax.
using sqlldr 11.2.0.1 it works successfully for me up until the point where the input record column is > 4000 where i get a
ORA-01461: can bind a LONG value only for insert into a LONG column
if i switch to a directpath load then i get the smae error as you.
ORA-12899: value too large for column COMMENTS (actual: 4005, maximum: 4000)
in the end i have split it into a 2 stage load.. i now have a staging table with a column of type CLOB which i load with
COMMENTS CHAR(2000000000)
which then gets inserted to eth main table with a
insert into propertable
select dbms_lob.substr(comments,1,4000)
from staging_table;
hope thats helpful