Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi Community,
Is there any way to load table even if Field not found error, with error modes we can avoid failure but we can't load rest of the load.
for Ex:
table:
load*,if(d='a','te','be') as test_flat
from table;
above table d field is not there but we need to avoid failure as well as need to load other fields. it should be dynamic as I mentioned only one field like 'd', but in real there are couple of tables and couple of fields..
-Priya
It's not possible to check the existence of a field within a load-statement. You will always need an additionally outside check if a field exists or not. This could be done by loading only the the first record of a file and then looping through all fields and checking them against your conditions and using this to branch into different load-statements.
By qvd-files is it a bit easier because with the qvd-functions these information could be gathered by reading the qvd-header maybe in this way:
for i = 1 to qvdnooffields('YourQVD')
let vFieldCheck = match(qvdfieldname('YourQVD', $(i)), 'd');
if $(vFieldCheck) = true() then
exit for
end if
next
if $(vFieldCheck) = true() then
LoadStatement1
else
LoadStatement2
end if
Easier then this will be just to use different folders for the different qvd-structures and using then two different load-statements.
- Marcus
Just to know, Can't we do like this?
for i = 1 to qvdnooffields('YourQVD')
let vFieldCheck = match(qvdfieldname('YourQVD', $(i)), 'd');
if $(vFieldCheck) = true() then
LoadStatement1
else
LoadStatement2
end if
next