Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with for loop

Status
Not open for further replies.

shzza1234

IS-IT--Management
Apr 14, 2006
3
GB
Hi all,

I am trying to get the value of a checkbox (htmldb_item.checkbox(1, s.student_id) PRESENT) to determine if the database is updated. If the box is checked then it should write to the database once. If not then it should not do anything.

At the moment, it is writing twice if checked and once if not checked.

htmldb_application.g_f01 is a global variable where it stores the value of the checkbox.

select htmldb_item.checkbox(1, s.student_id) PRESENT,
s.student_id STUDENTID_L,
s.f_name FNAME_L,
s.s_name SNAME_L
from students s
where s.fclass_id = :p201_CLASS_ID

DECLARE
BEGIN
FOR i in 1..htmldb_application.g_f01.count
LOOP
INSERT INTO Attendances(student_id, register_id)
VALUES(htmldb_application.g_f01(i), :p201_REGISTER);
COMMIT;
END LOOP;
END;


Can anyone help?

Thanks.
 
the best i can do for you is to point out that this is not a question for the ANSI SQL forum

what database are you using? what front end language are you using?

chances are we have a more suitable forum for them

r937.com | rudy.ca
 
Hi Rudy

I am using Oracle Application Express and the language is PL/SQL
 
try one of these:

forum185 -- Oracle: Oracle release - 5, 6, and 7
forum186 -- Oracle: Oracle release - 8 and 8i
forum759 -- Oracle: Oracle release - 9i
forum1177 -- Oracle: Oracle release 10g
forum465 -- Oracle certification and testing
forum1426 -- Utah Oracle Users Group (UTOUG)
forum880 -- Oracle: Oracle9iAS Application Server
forum44 -- Oracle: Web App Server
forum119 -- Oracle: Enterprise Developer Suite
forum161 -- Oracle: Designer
forum259 -- Oracle: Developer
forum391 -- Oracle ERP Solutions
forum441 -- Oracle: JDeveloper
forum443 -- Oracle: WebDB
forum442 -- Oracle: Reports

r937.com | rudy.ca
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top