user803860
user803860

Reputation: 319

Invalid oracle view column

I am creating a view and one of my field in the view is PO field ( it is a primary key of output table)

In output table primary key is composite key ( Id+ cntrid)

i was writing the following statement to get unique key

select  (po_cntr || proj_id) PO

but it is still showing dup, what is missing here?

Upvotes: 1

Views: 137

Answers (1)

Dave Costa
Dave Costa

Reputation: 48111

Sounds like the concatenated values are not unique.

For instance if you have two rows like this:

PO_CNTR    PO_ID
ABC12      1
ABC1       21

Then the concatenated value for both would be 'ABC121'.

The most likely easiest solution is to include a delimiter in the concatenated field:

select  (po_cntr || '-' || proj_id) PO

Upvotes: 2

Related Questions