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.

152<br />

*/<br />

<strong><strong>Form</strong>s</strong>_DDL(my_stmt);<br />

IF NOT <strong>Form</strong>_Success THEN<br />

Message (’Table Creation Failed’);<br />

ELSE<br />

Message (’Table Created’);<br />

END IF;<br />

END;<br />

Example 3:<br />

/*<br />

** Built-in: FORMS_DDL<br />

** Example: The statement parameter can be a block<br />

** of dynamically created PL/SQL code.<br />

*/<br />

DECLARE<br />

procname VARCHAR2(30);<br />

BEGIN<br />

IF :global.flag = ’TRUE’ THEN<br />

procname := ’Assign_New_Employer’;<br />

ELSE<br />

procname := ’Update_New_Employer’;<br />

END IF;<br />

<strong><strong>Form</strong>s</strong>_DDL(’Begin ’|| procname ||’; End;’);<br />

IF NOT <strong>Form</strong>_Success THEN<br />

Message (’Employee Maintenance Failed’);<br />

ELSE<br />

Message (’Employee Maintenance Successful’);<br />

END IF;<br />

END;<br />

Example 4:<br />

/*<br />

** Built-in: FORMS_DDL<br />

** Example: Issue the SQL statement passed in as an argument,<br />

** and return a number representing the outcome of<br />

** executing the SQL statement.<br />

** A result of zero represents success.<br />

*/<br />

FUNCTION Do_Sql (stmt VARCHAR2, check_for_locks BOOLEAN := TRUE)<br />

RETURN NUMBER<br />

IS<br />

SQL_SUCCESS CONSTANT NUMBER := 0;<br />

BEGIN<br />

IF stmt IS NULL THEN<br />

Message (’DO_SQL: Passed a null statement.’);<br />

RETURN SQL_SUCCESS;<br />

END IF;<br />

IF Check_For_Locks AND :System.<strong>Form</strong>_Status = ’CHANGED’ THEN<br />

Message (’DO_SQL: <strong>Form</strong> has outstanding locks pending.’);<br />

RETURN SQL_SUCCESS;<br />

END IF;<br />

<strong><strong>Form</strong>s</strong>_DDL(stmt);<br />

IF <strong>Form</strong>_Success THEN<br />

RETURN SQL_SUCCESS;<br />

ELSE<br />

RETURN Dbms_Error_Code;<br />

END IF;<br />

END;

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

Saved successfully!

Ooh no, something went wrong!