Insert select working and mload failing - teradata

I am facing one issue where I am able to insert into a table using normal insert select. However, when i am using the multiload to load the same table the records goes into the error table with the Error 6706: Untranslatable character error.
The column PROD_NAME is defined as UNICODE and arabic values along with numbers and % is coming into that column when doing a normal insert select.
My question is why is that not failing for normal insert select and failing in mload.
Also, how can i handle that in mload?
Thanks.

Related

REPLACE is not working inside plsql procedure

I am writing a procedure with a cursor that take table name and column name from a lookup table we have in DB. This table has a mapping of table name and columns.
These two info I am collecting in a variable and running a select query to see if the data in that column is number or not. for example:-
select TO_NUMBER(REGEXP_REPLACE(v_landing_column,'',''))
from v_landing_table
Here v_landing_column is a column name and v_landing_table is a table name. One of the values in v_landing_column is 12,300 which is a number but because of , the loop flow is going into exception where I am dumping error record in a seperate table.
I tried using REPLACE also with above syntax but still flow is dumping this record with value 12,300 into error table. How to remove , from 12,300 inside plsql procedure using execute immediate?

Teradata inserting into a table with a generated UPI

Hoping you all can help. I have a created table with a UPI (incremental index) and when I run the macro to insert in continuously gives me the error that "the positional assignment list has too few values". I have verified that the two tables match except for the UPI ID. How do you account for that field in the insert macro so that the table and the macro have the same number of assignments?
The list of values specified by the INSERT statement is shorter than the list of columns in the table. This error occurs on the INSERT statement.
try to check the origem table with the match of the destiny table.

Whats the correct syntax for on conflict do update sqlyte?

I am trying to insert clients on a table(importing them from a csv), the email column needs to be unique(in the csv the a client can appear more than one time, the last instance has the correct info) and the ids are created with an autoincrementing value (this is why i cant use select or replace), im trying to use the syntax found in the sqlite guide(and in every question about ON CONFLICT DO UPDATE found here) but sqlite throws a
SQL logic error near "ON" :syntax error
the query goes like this(using VB)
sqlQuery = "INSERT INTO clients(name1,name2,address1,address2,plz,city,country,phoneNumber1,phoneNumber2,cellPhoneNumber,fax,email) VALUES (?,?,?,?,?,?,?,?,?,?,?,?) ON CONFLICT(email) DO UPDATE SET name1=excluded.name1,name2=excluded.name2,address1=excluded.address1,address2=excluded.address2,plz=excluded.plz,city=excluded.city,country=excluded.country,phoneNumber1=excluded.phoneNumber1,phoneNumber2=excluded.phoneNumber2,cellPhoneNumber=excluded.cellPhoneNumber,fax=excluded.fax,email=excluded.email;

Tying table records together in SQLite3

I am currently working on a database structure in SQLite Studio (not sure whether that's in itself important, but might as well mention), and error messages are making me wonder whether I'm just going at it the wrong way or there's some subtlety I'm missing.
Assume two tables, people-basics (person-ID, person-NAME, person-GENDER) and people-stats (person-ID, person-NAME, person-SIZE). What I'm looking into achieving is "Every record in people-basics corresponds to a single record in people-stats.", ideally with the added property that person-ID and person-NAME in people-stats reflect the associated person-ID and person-NAME in people-basics.
I've been assuming up to now that one would achieve this with Foreign Keys, but I've also been unable to get this to work.
When I add a person in people-basics, it works fine, but then when I go over to people-stats no corresponding record exists and if I try to create one and fill the Foreign Key column with corresponding data, I get this message: "Cannot edit this cell. Details: Error while executing SQL query on database 'People': no such column: people-basics.person" (I think the message is truncated).
The DDL I currently have for my tables (auto-generated by SQLite Studio based on my GUI operations):
CREATE TABLE [people-basics] (
[person-ID] INTEGER PRIMARY KEY AUTOINCREMENT
UNIQUE
NOT NULL,
[person-NAME] TEXT UNIQUE
NOT NULL,
[person-GENDER] TEXT
);
CREATE TABLE [people-stats] (
[person-NAME] TEXT REFERENCES [people-basics] ([person-NAME]),
[person-SIZE] NUMERIC
);
(I've removed the person-ID column from people-stats for now as it seemed like I should only have one foreign key at a time, not sure whether that's true.)
Alright, that was a little silly.
The entire problem was solved by removing hyphens from table names and column names. (So: charBasics instead of char-basics, etc.)
Ah well.

Can select individual columns but not select *

I have a SQLite DB that have a corrupted table somehow. I can't access the table in my sqlite gui tool but when I query the same table with just a single column, I get the value fine.
So this do NOT work(SQL Error: SQL logic error or missing database):
select * from table
This DOES work:
select column from table
Result back from this query is the value of column. Perfectly normal result.
Any suggestions how this can happen? Any suggestion for any analysis tool for the actual file?
Seems that one of the columns were corrupt and prevented the select * to fully work. But the question remains, what can possibly be written to this column that prevents a select?

Resources