To make this a little easier, I have adjusted the SQLs
1) To determine the consolidation table
Use this SQL:
select p.id, a.name as 'category',
ltrim(str(1900+(p.updper&536608768)/262144)) + '.' +
right('00'+ltrim(str((p.updper&253952)/8192)),2) as 'period',
b.name as 'scope',
c.name as 'variant',
d.name as 'currency'
from ct_coref p, ct_phase a, ct_scope_code b, ct_variant c, ct_curncy d
where a.id=p.phase and
p.scope = b.id and
p.variant=c.id and
p.curncy = d.id
This will visualize the ct_coref table. Based on this, check the consolidation definition (CA, DP, SC, VA, CC) and see what ID is linked. In my example, ID=33, so the table used is ct_co0033
2) Check the consolidation table
Use this SQL:
SELECT
a.period,
ltrim(str(1900+(a.period&536608768)/262144)) + '.' +
right('00'+ltrim(str((a.period&253952)/8192)),2) as 'period',
a.entity,
b.name 'entity',
a.entorig,
c.name 'orig entity',
a.accnt,
d.name 'account',
a.flow,
e.name 'flow',
a.nature,
f.name 'audit',
a.partner,
g.name 'partner',
a.ctshare,
h.name 'share',
a.curncy,
i.name 'currnecy',
a.techorig,
j.name 'technical origin',
a.globorig,
k.name 'global origin',
a.journal,
l.name 'journal',
a.pmu,
m.name,
a.mu,
n.name,
a.enumber 'JE nr.',
a.amount,
a.convamount,
a.consamount
FROM ct_co0033 a
left outer join ct_entity b ON a.entity = b.id
left outer join ct_entity c on a.entorig = c.id
left outer join ct_account d on a.accnt = d.id
left outer join ct_flow e on a.flow = e.id
left outer join ct_nature f on a.nature = f.id
left outer join ct_entity g on a.partner = g.id
left outer join ct_entity h on a.ctshare = h.id
left outer join ct_curncy i on a.curncy = i.id
left outer join ct_techorig j on a.techorig = j.id
left outer join ct_site k on a.globorig = k.id
left outer join ct_journal l on a.journal = l.id
left outer join ct_mu m on a.pmu = m.id
left outer join ct_mu n on a.mu = n.id
This will now show the ID + "description" of the corresponding table.
An error in each pair would be:
- a non 0 value in 1st column
- a NULL in the 2nd column
For example:
Note: the columns 'enumber', 'amount', 'consamount' and "convamount' cannot lead to the 'invalid pointer' problem. I've left them in the SQL, for clarity
Marc