Friday 12 September 2008

Data block wizard problem: cannot select all available columns

I had a problem few days ago with oracle forms builder,  and unfortunately could not find answer on the net why is it happening…
I created a view and needed to make a data block on my canvas, but data block wizard refused to let me choose all available columns in that view:

Let’s start from the beginning.
Let’s say we have a table called test:

Let’s make some (stupid) view of it. Let’s say we need a view that looks like this:
Select id, first , second, first || second as "FIRST AND SECOND TOGETHER" from test

Lets call it test_view.
So, I wrote:
Create view test_view as Select id, first , second, first || second as "FIRST AND SECOND TOGETHER" from test
And I couldn’t use column "FIRST AND SECOND TOGETHER" !!!???

This was the first time this happened to me, and I was working with view in data block wizards before…
After a while I finally found out why this was happening.
It seems that oracle forms builder  won’t let you select column that was named as “” in create view statement.
It is totally legal to say:
 Create view test_view as
Select id, first , second, first || second as "FIRST AND SECOND TOGETHER" from test
And it will work just fine, but you won’t be able to use it in oracle forms builder.
So, at the end, I  was foced to name my column FIRST_AND_SECOND_TOGETHER ( one word!!!) :
CREATE OR REPLACE VIEW TEST_VIEW
AS
select id , first, second , first || second as FIRST_AND_SECOND_TOGETHER from test;
and it worked!!!
I hope this will help someone…




No comments: