1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
| PROCEDURE CHARGER_B0337 IS
LConn_conn_id EXEC_SQL.CONNTYPE;
LCu_b0337 EXEC_SQL.CURSTYPE;
LC_sql_stmt VARCHAR2(500);
LI_nIgn PLS_INTEGER;
LC_ta_lib VARCHAR2(30);
LC_ta_code VARCHAR2(5);
LC_t37_type VARCHAR2(1);
BEGIN
GO_BLOCK('B2801');
LConn_conn_id := EXEC_SQL.DEFAULT_CONNECTION;
LCu_b0337 := EXEC_SQL.OPEN_CURSOR(LConn_conn_id);
LC_sql_stmt := 'SELECT TA_LIB, TA_CODE, T37_TYPE ' ||
'FROM B0300, B0337 ' ||
'WHERE TA_TABLE = ''37'' ' ||
'AND TA_CODE = T37_CODE ' ||
'AND TA_ACTI = ''0'' ' ||
'AND T37_CODEOPERANDE1 IS NULL ';
IF :B2800.AN_TYPE = 'C' THEN
LC_sql_stmt := LC_sql_stmt ||
'AND T37_ECHANTILLON = ''O'' ';
ELSIF :B2800.AN_TYPE = 'G' THEN
LC_sql_stmt := LC_sql_stmt ||
'AND T37_AGRE = ''O'' ';
ELSIF :B2800.AN_TYPE = 'N' THEN
LC_sql_stmt := LC_sql_stmt ||
'AND T37_ANALYSE = ''O'' ';
END IF;
LC_sql_stmt := LC_sql_stmt || 'ORDER BY T37_ORDRE';
EXEC_SQL.PARSE(LConn_conn_id, LCu_b0337, LC_sql_stmt);
EXEC_SQL.DEFINE_COLUMN(LConn_conn_id, LCu_b0337, 1, LC_ta_lib, 30);
EXEC_SQL.DEFINE_COLUMN(LConn_conn_id, LCu_b0337, 2, LC_ta_code, 5);
EXEC_SQL.DEFINE_COLUMN(LConn_conn_id, LCu_b0337, 3, LC_t37_type, 1);
LI_nIgn := EXEC_SQL.EXECUTE(LConn_conn_id, LCu_b0337);
WHILE ( EXEC_SQL.FETCH_ROWS(LConn_conn_id, LCu_b0337) > 0 ) LOOP
CREATE_RECORD;
EXEC_SQL.COLUMN_VALUE(LConn_conn_id, LCu_b0337, 1, :B2801.TA_LIB);
EXEC_SQL.COLUMN_VALUE(LConn_conn_id, LCu_b0337, 2, :B2801.T37_CODE);
EXEC_SQL.COLUMN_VALUE(LConn_conn_id, LCu_b0337, 3, :B2801.AN1_TYPE);
END LOOP;
EXEC_SQL.CLOSE_CURSOR(LConn_conn_id, LCu_b0337);
EXEC_SQL.CLOSE_CONNECTION(LConn_conn_id);
FIRST_RECORD;
GO_FIELD('B2800.T48_LIEU');
END; |
Partager