11.01.2013 Views

Oracle Forms Developer – Form Builder Reference, Volume 1

Oracle Forms Developer – Form Builder Reference, Volume 1

Oracle Forms Developer – Form Builder Reference, Volume 1

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

532<br />

** from the table in question to insure that there<br />

** aren’t two matching rows.<br />

*/<br />

BEGIN<br />

SELECT description<br />

INTO :Employee.Commplan_Desc<br />

FROM commplan<br />

WHERE commcode = :Employee.Commcode;<br />

EXCEPTION<br />

WHEN No.Data_Found THEN<br />

Message(’Invalid Commission Plan, Use for help’);<br />

RAISE <strong>Form</strong>_trigger_Failure;<br />

WHEN Too_Many_Rows THEN<br />

Message(’Error. Duplicate entries in COMMPLAN table!’);<br />

RAISE <strong>Form</strong>_trigger_Failure;<br />

END;<br />

/*<br />

** Method 2: Using an Explicit Cursor looks a bit more<br />

** daunting but is actually quite simple. The<br />

** SELECT statement is declared as a named cursor<br />

** in the DECLARE section and then is OPENed,<br />

** FETCHed, and CLOSEd in the code explicitly<br />

** (hence the name). Here we guarantee that only a<br />

** single FETCH will be performed against the<br />

** database.<br />

*/<br />

DECLARE<br />

noneFound BOOLEAN;<br />

CURSOR cp IS SELECT description<br />

FROM commplan<br />

WHERE commcode = :Employee.Commcode;<br />

BEGIN<br />

OPEN cp;<br />

FETCH cp INTO :Employee.Commplan_Desc;<br />

noneFound := cp%NOTFOUND;<br />

CLOSE cp;<br />

IF noneFound THEN<br />

Message(’Invalid Commission Plan, Use for help’);<br />

RAISE <strong>Form</strong>_trigger_Failure;<br />

END IF;<br />

END;

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!