Calling a Procedure from a Button?
664995Jan 21 2009 — edited Feb 10 2009Hi All,
I'm using Oracle Application Express 11g & I'm currently working on an application. One of the requirements for this particular application is that a user has to be able to enter an applicant's id number (in the id textfield) & if a user clicks a button then they should be able to check in the db whether the applicant exists or not. If the applicant exists then name & surname textfields should be populated with values from the database corresponding to the id number & all these three textfields should be read only. If the applicant doesn't exist then the user will be directed to a page where he/she will fill in new applicant's details.
So, I wrote the following procedure to do that:
CREATE OR REPLACE PROCEDURE search_applicant(
P17_APPLICANT_IDNUMBER IN FIR_APPLICANT.applicant_idnumber%TYPE,
P17_NAME OUT FIR_APPLICANT.name%TYPE,
P17_SURNAME OUT FIR_APPLICANT.surname%TYPE,
P17_COUNT IN FIR_CURRENCY.currency_id%TYPE) IS
BEGIN
SELECT count(*)
INTO P17_COUNT
FROM fir_applicant
WHERE applicant_idnumber = :P17_APPLICANT_IDNUMBER;
IF P17_COUNT > 0 THEN
SELECT name,surname
INTO P17_NAME, P17_SURNAME
FROM fir_applicant
WHERE applicant_idnumber = :P17_APPLICANT_IDNUMBER;
dbms_output.put_line('Name: ' || P17_NAME || ' & Surname: ' || P17_SURNAME);
ELSE
dbms_output.put_line('Applicant does not exit.');
END IF;
EXCEPTION WHEN NO_DATA_FOUND THEN
dbms_output.put_line('Applicant does not exit.');
END;
So far I have not been able to find any help in this regard. I know how to invoke a javascript from a button but I'm not sure how to go about this one.
Any help in this regard is highly appreciated.
THANK YOU
Kamo