Cannot create a record in ZIP/postal Codes [closed] - dynamics-ax-2009

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I try to import 90 records from a .txt-file into a table in: Administration > Administration Area > Periodic > Data export/import > Definition Groups
I've made a new Definition Group, set the name and type (Custom) of it and Selected the Default file name.
In the Table setup I deleted all records and selected the table where I want to import the records, Import status = Import.
After clicking on the import-button in the Definition group-window I'm getting error-messages for every record and no data is imported:
ERROR message sais: Cannot create a record in ZIP/postal Codes (CLIAddressZipCode).
ZIP/postal Code: , . The record already exists.
EXAMPLE OF A RECORD:
1440;Les Frèchaux;175557;BRAINE-LE-CHÂTEAU
The 1st field is the zipcode, the 2nd is the street, the 3rd is the ID, the 4th field is the city.
UPDATE:
I will try to add an if-statement: to check if the record already exists, if not the record will be inserted.

Check for unique indexes in table CLIAddressZipCode (this is not a standard table).
This problem arises when your input contain two records which have the same values in the index fields.
The second record will throw the error when inserted saying: The record already exists.

It's probably a related table that it's inserting into and/or a blank '' record at the very beginning/end. CLIAddressZipCode is custom. Perhaps you're inserting into AddressZipCode, and there is code that will insert into CLIAddressZipCode or vice versa and one of those tables contains the duplicate data.

Could the data be concatenated in some way? eg 12345 is concatenated to 1234 which is the same as 1234.

Related

SAP BODS - Getting PK violation from a Table Comparison

I want to read from a table, change a couple column values for a few lines in a query, then update those lines on the same table.
I'm using SAP BODS, and that's what I tried:
I was about to insert images but just found out I can't insert images until 10 rep.
Anyway, I created a DataFlow where I have the same table as source and target.
A query to filter (using where) and change values (using mapping). And then a Table Comparison (where I expected those lines to be set to update, in this particular case), set table name on first entry, then PK in 'input primary key' and then the two columns I want to change in 'Compare columns'. No other changes from default that I can recall.
Got no warnings on 'validate all', and on execution I receive an ORA-00001 for the PK.
So ... I thought the Table Comparison would try to update, but seems like it's trying to insert instead. I want to know what I'm doing wrong and how could I get the job to do those updates. Thanks in advance.
Ps. I did search SO before asking and didn't find anything relevant.
Ok
So, turns out I just found what's going on a few minutes after posting the question.
Wasn't sure if I should answer my own question and took a look at this Etiquette for answering your own question
and decided to come back here and answer my own question.
For some reason I got stuck thinking that it was something to do with the Table Comparison trying to insert a line with a PK that's already there, instead of doing the update I wanted.
But after going back to the job to take another look at the issue, it occurred to me that maybe the problem could be a duplicate in the incoming data set. Made a few adjustment to filter those, and voilà.

A store has n customers and anyone can visit them any time throughout the year

A store has n customers and anyone can visit them any time throughout the year. Data is stored in a file. Design a data structure to find if a given person visited on a date or not.
Could anyone suggest data structure I shall use in this case?
I'd suggest this: Every customer is stored in one line while you include the customer name first and then the date. You can split them with commas or something.
These are some examples
Name,Date
Name, Date
Name|Date
Name | Date
Just choose something that will be the easiest for you to use and to retrieve the information correctly with using string .split or .substring.
The problem statement does not state whether or not a customer may visit the store numerous times during the year so assuming that they can I would use a Map data-structure, where the key is the name of the customer and the value is the set of dates the customer visited the store. The data can be stored in the file using XML.

Add New Varchar2 Field in Oracle SQL Developer [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 9 years ago.
I'm new to Oracle. I need to add a varchar2 field to an existing table which is 50 bytes in length.
I right clicked on the table like this:
...Then I arrive at this field:
I do not know what to do here. I was expecting to see a 'type', 'size'and 'units' prompt like in the schema-design-GUI view (where I would enter ~varchar2, 45, and bytes respectively). I don't know what to make of the precisions and scale fields; I thought those were for numbers.
You're adding a column. Give it a name ("Column Name"), a type (select from "Data Type" drop-down), and a length ("Precision"). If it's a NUMBER type, you can give it a scale (place to the right of the decimal). In your specific example, give your column a name, leave data type drop-down at VARCHAR2, and specify 50 for precision.

how to identify which column has changed [duplicate]

This question already has an answer here:
How to check if a columns value was explicitly specified in a PL/SQL BEFORE UPDATE trigger?
(1 answer)
Closed 8 years ago.
Is there an efficient method to identify which column has changed in a table in Oracle using a trigger? How to check if only one column (of interest) or all other columns also changed?
As the post Alex Pole pointed in your comments states, you could use the UPDATING function.
But you can also develop different triggers for updating specific columns with "BEFORE UPDATE OF" clause, witch is the optimal option if there is no code to share among the actions for the involved columns.

Detecting change in xml structure stored as clob [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I have a table that contains an xml document stored as a clob.
TabA
----
Name varchar2(30) (PK)
Definition clob
other attributes
Note: "Definition" is the clob column that stores the XML.
Typical data volume: 1500 rows.
My requirement is to do some kind of recon and only process those rows on a daily basis that have undergone change to the XML and process those rows that have come in as new.
Identifying rows that came in new and processing only them is easy and can be done with "minus" on the name.
But, is there a good way to identify the XMLs in the existing rows that have undergone change ?
For eg: If an element within an XML has been removed or its attributes changed from the previous day, then I should be able to process that "Name" row.
Example of the typical XML in the table:
<?xml version="1.0" encoding="UTF-8"?>
<dataMart asOfDriver="EFFECTIVE_DATE" chainedData="false" classification="" convertUsingFxRate="false" coreEntityIndicator="false" createdAt="2011-12-22T17:41:11.002" createdBy="user1" description="" entitled="false" entitlementDriver="false" hierarchicalFlag="false" innerJoin="false" intent="Intermediate" lastUpdatedAt="2012-07-26T16:11:42.424" lastUpdatedBy="p459807" martType="SPOT" martUsage="Persistent" ownerRole="Meta Model SSC" preAggregatedData="false" referenceDataIndicator="false" retention="" rollupFunction="" staticAggregationOnly="false" status="ACTIVE" tags="">
<name>Name1</name>
<sources>
<source isDefault="false" name="S1"></source>
</sources>
<rowType-mapping>
<rowType identifier="0">
<element alias="E1" name="E1" source="" sourceAlias="" sourceType="system" trackSource="false">
<description localDescription="false"></description>
<validationRule type="None"></validationRule>
<mapping columnName="E1" function="" tableName="TABA"></mapping>
<Opaque />
</element>
More element tags
...<element> </element>
</rowType>
</rowType-mapping>
<parameters>
<parameter filter="N" name="P1">
<![CDATA[PM]]>
</parameter>
</parameters>
</dataMart>
Any pointers would be much appreciated.
I would recommend using trigger to log changed items to another table. Process what ever was logged in the log table for a particular day.
On how to compare two XMLs refer to this
It would only be possible if you keep a record of your previous (old) xml in a log or temp table before updating the New XML.
By the looks of the question, it seems that you not only want to compare the XML with its previous version but also find out "what has changed?".
A good way to compare and find what has changed is to do a diff between the old and new XML. Here is a package which does a diff on CLOB. See if you can use it to fit your needs.
Or
You can convert the CLOB to Varchar using dbms_lob.substr( clob_column, for_how_many_bytes, from_which_byte ); and then do something like below to do a diff on the two new VARCHARs-
SELECT LTRIM(RTRIM(TRANSLATE('abcdef','abc',RPAD(' ',LENGTH('abcdef'))))) val
FROM dual;
VAL
----------
def

Resources