Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Simple Question regarding PL-SQL and Cursors, with a FORMS twist.
When using an explicit cursor tied to a select statement, is the select run
automatically, or does it wait until you OPEN the cursor?
Reason for my question.......
I am building a form related to personnel. The first field is Social
Security Number. In the "when-validate-item" trigger, I want to check to
see if the current SSN exists in the table. If not, the user continues
adding a new person. If a single value exits, I want to populate the
remaining fields with that record. If more than one of the current SSN
exists (hopefully not often) I want a list of values to come up with those
records having that SSN, thus allowing the user to choose one to populate
the remaing fields with.
My idea is to user cursor(s), and an IF-THEN block. If rowcount for the cursor = 0 then enter new person, if rowcount = 1 then fetch the record, if rowcount >1 allow user to select with LOV.
Is a cursor the best way to implement this functionality? Is there another way? I am concerned with running a select statement inefficiently, thus my question of when does the select statement run.
Any suggestions would be greatly appreciated.
Thanks in advance,
Michael Received on Fri Jun 26 1998 - 10:50:00 CDT