0

I have two tables as

CREATE TABLE table1(id NUMBER, name VARCHAR2(10));
CREATE TABLE table2(id NUMBER, dept VARCHAR2(4));

Now, I want to create a view containing id and name from the table table1 and dept from the table table2. I have a query like

CREATE VIEW table_view 
AS SELECT t1.id,t1.name,t2.dept 
FROM table1 t1 full outer join table2 t1 
ON t1.id = t2.id;

But I get the error: ORA-00904: "T2"."ID": invalid identifier. Help me clear the error. Thanks.

1
  • you have wrong alias at table2 t1 Commented Oct 18, 2016 at 6:17

1 Answer 1

1

You gave both tables the same alias outer join table2 t1 should be outer join table2 t2

CREATE VIEW table_view 
AS SELECT t1.id,t1.name,t2.dept 
FROM table1 t1 
   full outer join table2 t2 --<< here 
                ON t1.id = t2.id;
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.