Home » Developer & Programmer » Forms » Using Queries with Forms
icon7.gif  Using Queries with Forms [message #163712] Sat, 18 March 2006 12:11 Go to next message
pam_W_85@yahoo.co.uk
Messages: 4
Registered: March 2006
Location: Manchester
Junior Member
Hello,

I am trying to link a query that will run in an oracle form but the user will need to enter the criteria for the search. I have the code to run this query in islq and it works. The code is:

SELECT * from members
WHERE member_name = '&Enter_name';

I think the code should be:

CREATE VIEW existingmember AS (
SELECT * from members
WHERE member_name = '&Enter_name');

I just don't know how to do the last part '&Enter_Name' I think I need to use a PARAMETER?

Pam
Re: Using Queries with Forms [message #163719 is a reply to message #163712] Sat, 18 March 2006 15:24 Go to previous messageGo to next message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Is it really necessary? Because, when you create a form, simply press <Enter query>, enter search criteria (your &Enter_name) and press <Execute query>. This is built-in functionality of Oracle Forms and there's no need to code it.
Re: Using Queries with Forms [message #163740 is a reply to message #163719] Sun, 19 March 2006 04:59 Go to previous messageGo to next message
pam_W_85@yahoo.co.uk
Messages: 4
Registered: March 2006
Location: Manchester
Junior Member
Sounds simple! Could you explain how to do this? When I create the form I use the data block wizard.. should I select the tables I need for the query? Where should I put the code for the query? Can I make a button to run the query?

Pam
Re: Using Queries with Forms [message #163751 is a reply to message #163712] Sun, 19 March 2006 07:23 Go to previous messageGo to next message
boseinfo
Messages: 22
Registered: December 2005
Location: Bahrain
Junior Member
helo

After creating form, go to data block properties and give the where clause at 'WHERE Clause' property.
Re: Using Queries with Forms [message #163753 is a reply to message #163751] Sun, 19 March 2006 07:36 Go to previous messageGo to next message
pam_W_85@yahoo.co.uk
Messages: 4
Registered: March 2006
Location: Manchester
Junior Member
Hi,

I typed in:

member_name = '&Enter_name' in the where clause but when I try to enter the query in run time I get an error saying that the query could not be executed...


Pam
Re: Using Queries with Forms [message #163764 is a reply to message #163740] Sun, 19 March 2006 15:17 Go to previous messageGo to next message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
OK, so you followed the Data Block Wizard and created a default form. That's all you've been supposed to do, nothing more and nothing less to make it work.

One of the simplest forms could be the one created on 'dept' table of Scott's schema (you know, 'scott/tiger'?). When such a form is created, run it.

To enter query mode, click on "Enter query" button on the toolbar (or, alternatively, click on "Help - Show keys" menu to find out which (combination of) key(s) enters query mode - could be F7, for example).

Now you're in query mode and database waits for you to enter query condition. Enter, for example, value of 10 into the 'deptno' field.

To execute query, click on "Execute query" button (or, also in "Help - Show keys" menu, find out key(s) to do it - might be F8). Now you'll see the whole record containing data about department number 10.

That should be all.
Re: Using Queries with Forms [message #163944 is a reply to message #163764] Mon, 20 March 2006 22:34 Go to previous message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Pamela,

Go to http://www.oracle.com/technology/documentation/forms.html. Find 'Guidelines for Building Applications' and 'Form Builder Reference'. Download them for future reference, and use the 'search' facility of Adobe Reader to access the bits and pieces you need.

Also look at the demos that are available from that site.

David
Previous Topic: Calendar worked BUT now failed
Next Topic: Loading of Forms4.5 & Forms 6i in the single system
Goto Forum:
  


Current Time: Fri Sep 20 04:44:32 CDT 2024