ghalib ghalib - 5 months ago 20
SQL Question

Select error : ORA-00918: column ambiguously defined

I am trying to get some data from 2 synonyms by specific

BENEFICIARY_CIVIL_NUMBER
but I get an error

SELECT n.NAME_A, m.MOTHER_NAME_A
FROM S_S_CSPF_NRS_PERSON_V N, S_S_CSPF_NRS_MOTHER_V M
WHERE BENEFICIARY_CIVIL_NUMBER = 1111111

Answer

My guess is that the BENEFICIARY_CIVIL_NUMBER column exists in both S_S_CSPF_NRS_PERSON_V and S_S_CSPF_NRS_MOTHER_V.

You need to specify it too. Either:

where n.BENEFICIARY_CIVIL_NUMBER = 1111111

or:

where m.BENEFICIARY_CIVIL_NUMBER = 1111111

Also, what is BENEFICIARY_CIVIL_NUMBER data type? Varchar?