Home » Developer & Programmer » Forms » Where clause problem (Dev 10g,windows Xp)
Where clause problem [message #438041] Wed, 06 January 2010 23:00 Go to next message
mahmud732
Messages: 82
Registered: October 2009
Location: Dhaka
Member
Dear all,

I have a table named test(A VARCHAR2(10),B VARCHAR2(10),C VARCHAR2(10));

Now i want to select all from table test with where clause:
I would like to use where clause like in the form.
select * from test where :x=100;

Here x will be A=100 OR B=100 OR C=100
That is when i pass vallue for x=A then this will return
all the rows according to column A=100;
when i pass vallue for x=B then this will return
all the rows according to column B=100;
when i pass vallue for x=C then this will return
all the rows according to column C=100;

How does it possible.

Its recomended that i have done it using Report builder.

Now i need it to Oracle Developer 10g forms.

It is very urgent.


Regards

Mahmud.
Re: Where clause problem [message #438060 is a reply to message #438041] Thu, 07 January 2010 00:31 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Use the 'default_where' clause on your block. Put the 'a', 'b', or 'c' into a control block item and in the 'pre-query' trigger on the data block define which item is to be searched.

David
Re: Where clause problem [message #438133 is a reply to message #438060] Thu, 07 January 2010 04:11 Go to previous messageGo to next message
mahmud732
Messages: 82
Registered: October 2009
Location: Dhaka
Member
Dear Mr. Martin,

This is a solution of one type.
But I need the following:

I have a form with two text field field1 and field2 with a button.
field1 gives month as field2 gives column name
and the button containing following code:

insert into x(a,b,c)
select a,b,c from test where month=:month and
field2=100;


here field2 will be a or b or c;

this return null;

How does it possible to recover,Please...........

Regards
Mahmud
Re: Where clause problem [message #438135 is a reply to message #438041] Thu, 07 January 2010 04:14 Go to previous messageGo to next message
cookiemonster
Messages: 13938
Registered: September 2008
Location: Rainy Manchester
Senior Member
I'm amazed it doesn't give an error.
You need to use dynamic sql to do that.
Re: Where clause problem [message #438716 is a reply to message #438133] Mon, 11 January 2010 23:29 Go to previous message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
I really, really hope that this is a student design and not a real world production application.

I believe that you need to rethink your design as expecting a user to know the names of table columns is not realistic.

David
Previous Topic: Oracle Form Very slow
Next Topic: How to scroll mouse in oracle form
Goto Forum:
  


Current Time: Fri Sep 20 04:51:16 CDT 2024