-- Copyright © Oracle Corporation 1995. All Rights Reserved. -- The procedures in this SQL module are called by the C program -- SQL$INTRO_LOAD_EMPL_H.C. -- ----------------------------------------------------------------------------- -- Header Information Section ----------------------------------------------------------------------------- MODULE INTRO_LOAD_EMPL_C -- Module name LANGUAGE C -- Language of calling program AUTHORIZATION SAMPLE_USER -- Authorization ID ALIAS RDB$DBHANDLE -- Default alias PARAMETER COLONS -- Parameters are prefixed by colons ----------------------------------------------------------------------------- -- DECLARE Statements Section ----------------------------------------------------------------------------- -- Declare the alias using the file name. DECLARE ALIAS FOR FILENAME ROOT:INTRO_PERSONNEL ----------------------------------------------------------------------------- -- Procedure Section -- In every procedure, declare SQLCODE, a parameter that stores a value -- that represents the execution status of SQL statements. ----------------------------------------------------------------------------- -- This procedure uses the executable statement SET TRANSACTION to start -- a transaction. The EMPLOYEES, JOB_HISTORY, and DEPARTMENTS tables are -- reserved because of constraint checking. PROCEDURE SET_TRANS SQLCODE; SET TRANSACTION READ WRITE RESERVING EMPLOYEES FOR EXCLUSIVE WRITE, JOB_HISTORY FOR SHARED READ, DEPARTMENTS FOR SHARED READ; -- This procedure inserts the employee data into the EMPLOYEES table. PROCEDURE INSERT_DATA SQLCODE -- Declare the parameters by which the values are passed between the SQL -- module and the host language. :P_EMPLOYEE_ID CHAR(5) :P_LAST_NAME CHAR(14) :P_FIRST_NAME CHAR(10) :P_MIDDLE_INITIAL CHAR(1) :P_ADDRESS_DATA CHAR(25) :P_CITY CHAR(20) :P_STATE CHAR(2) :P_POSTAL_CODE CHAR(5) :P_BIRTHDAY DATE VMS :P_SEX CHAR(1); -- The list of names that follows the INSERT clause names the columns -- in the table that are to be used for the insert. -- The list of names in the VALUES clause corresponds to the variables -- declared in the procedure. INSERT INTO EMPLOYEES (EMPLOYEE_ID, LAST_NAME, FIRST_NAME, MIDDLE_INITIAL, ADDRESS_DATA, CITY, STATE, POSTAL_CODE, BIRTHDAY, SEX ) VALUES (:P_EMPLOYEE_ID, :P_LAST_NAME, :P_FIRST_NAME, :P_MIDDLE_INITIAL, :P_ADDRESS_DATA, :P_CITY, :P_STATE, :P_POSTAL_CODE, :P_BIRTHDAY, :P_SEX); --This procedure commits the transaction. PROCEDURE COMMIT_TRANS SQLCODE; COMMIT;