Home » Developer & Programmer » Forms » Query in an oracle form.
Query in an oracle form. [message #203459] Wed, 15 November 2006 03:46 Go to next message
highvoltage
Messages: 12
Registered: October 2006
Location: Singapore
Junior Member
Guys please advice.

I am creating a form in oracle developer suite.

On my form there is a search button.
When i insert the student_id the search button is to return values in the respective field.

Not sure how the query goes into the oracle search button PL/SQL editor

Select * from STUDENT
Where Stud_id = :ADDSTUDENT_BLOCK.Stud_id;
Into
(
:ADDSTUDENT_BLOCK.Stud_id,
:ADDSTUDENT_BLOCK.Stud_gname,
:ADDSTUDENT_BLOCK.Stud_fname,
:ADDSTUDENT_BLOCK.Stud_DOB,
:ADDSTUDENT_BLOCK.Stud_sex,
:ADDSTUDENT_BLOCK.Stud_finloan,
:ADDSTUDENT_BLOCK.Stud_address,
:ADDSTUDENT_BLOCK.Stud_town,
:ADDSTUDENT_BLOCK.Stud_street,
:ADDSTUDENT_BLOCK.Stud_poscode,
:ADDSTUDENT_BLOCK.Stud_contact,
:ADDSTUDENT_BLOCK.nok,
:ADDSTUDENT_BLOCK.nok_contact,
:ADDSTUDENT_BLOCK.nok_relation
);

Please advice.
Re: Query in an oracle form. [message #203482 is a reply to message #203459] Wed, 15 November 2006 04:31 Go to previous messageGo to next message
rameshuddaraju
Messages: 69
Registered: June 2005
Location: India
Member

write a cursor( in button clicked trigger ) which returns rows for your search condition then load the data into respective textboxes
Re: Query in an oracle form. [message #203484 is a reply to message #203459] Wed, 15 November 2006 04:33 Go to previous messageGo to next message
highvoltage
Messages: 12
Registered: October 2006
Location: Singapore
Junior Member
thanks man but how does the coding godude cant seem to get it.
Re: Query in an oracle form. [message #203524 is a reply to message #203459] Wed, 15 November 2006 06:59 Go to previous messageGo to next message
rameshuddaraju
Messages: 69
Registered: June 2005
Location: India
Member

You can use cursor or a select statement.
I am giving you a sample code with select statement.
i donot know the column names of student table so i am using column1 and column2. Please replace those with your original column names.

sample code in the when-button-pressed trigger


strec student%rowtype;

begin

Select * into strec from STUDENT Where Stud_id = :ADDSTUDENT_BLOCK.Stud_id;

:ADDSTUDENT_BLOCK.Stud_id := strec.column1;
:ADDSTUDENT_BLOCK.Stud_gname := strec.column2;

--write the remaining statements here to load the values from strec into your --textboxes

exception

when no_data_found
-- write your code to handel the error if necessary
end;
Re: Query in an oracle form. [message #203616 is a reply to message #203524] Wed, 15 November 2006 19:09 Go to previous messageGo to next message
highvoltage
Messages: 12
Registered: October 2006
Location: Singapore
Junior Member
Hey thanks man it works fine now.
Re: Query in an oracle form. [message #203623 is a reply to message #203616] Wed, 15 November 2006 19:54 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Why don't you just base your block on the table? Forms will do the rest for you.

David
Re: Query in an oracle form. [message #203626 is a reply to message #203623] Wed, 15 November 2006 20:17 Go to previous messageGo to next message
highvoltage
Messages: 12
Registered: October 2006
Location: Singapore
Junior Member
I wish i could man but my assingment requires me to do in manually not the automatic way.
Re: Query in an oracle form. [message #203628 is a reply to message #203626] Wed, 15 November 2006 20:57 Go to previous message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Look at these:
Populate block using cursor
http://www.orafaq.com/forum/m/605/67467/?srch=populate+block+cursor+create_record#msg_605
and my feelings about it.
http://www.orafaq.com/forum/m/134237/67467/?srch=populate+block+cursor+create_record#msg_134237

Loading data into a block MANUALLY
http://www.orafaq.com/forum/m/111031/67693/#msg_111031
MANUAL previous and next master key record retrieval
http://www.orafaq.com/forum/m/111031/67693/#msg_111031
Sample MANUAL get employees form
http://www.orafaq.com/forum/t/52330/67467/

David
Previous Topic: Status of form(Urgent)
Next Topic: setting item property to <Unspecified>
Goto Forum:
  


Current Time: Sun Dec 08 17:56:25 CST 2024