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.

174<br />

RETURN NUMBER IS<br />

the_Rowcount NUMBER;<br />

rg_id RecordGroup;<br />

gc_id GroupColumn;<br />

col_val VARCHAR2(80);<br />

Exit_Function Exception;<br />

BEGIN<br />

/*<br />

** Determine if record group exists, and if so get its ID.<br />

*/<br />

rg_id := Find_Group( the_rg_name );<br />

IF Id_Null(rg_id) THEN<br />

Message(’Record Group ’||the_rg_name||’ does not exist.’);<br />

RAISE Exit_Function;<br />

END IF;<br />

/*<br />

** Make sure the column name specified exists in the<br />

** record Group.<br />

*/<br />

gc_id := Find_Column( the_rg_name||’.’||the_rg_column );<br />

IF Id_Null(gc_id) THEN<br />

Message(’Column ’||the_rg_column||’ does not exist.’);<br />

RAISE Exit_Function;<br />

END IF;<br />

/*<br />

** Get a count of the number of records in the record<br />

** group<br />

*/<br />

the_Rowcount := Get_Group_Row_Count( rg_id );<br />

/*<br />

** Loop through the records, getting the specified column’s<br />

** value at each iteration and comparing it to ’the_value’<br />

** passed in. Compare the values in a case insensitive<br />

** manner.<br />

*/<br />

FOR j IN 1..the_Rowcount LOOP<br />

col_val := GET_GROUP_CHAR_CELL( gc_id, j );<br />

/*<br />

** If we find a match, stop and return the<br />

** current row number.<br />

*/<br />

IF UPPER(col_val) = UPPER(the_value) THEN<br />

RETURN j;<br />

END IF;<br />

END LOOP;<br />

/*<br />

** If we get here, we didn’t find any matches.<br />

*/<br />

RAISE Exit_Function;<br />

EXCEPTION<br />

WHEN Exit_Function THEN<br />

RETURN 0;<br />

END;

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

Saved successfully!

Ooh no, something went wrong!