FUNCTION CREATETAB RETURN BOOLEAN IS
BEGIN
SRW.DO_SQL('CREATE TABLE CHECK (EMPNO NUMBER NOT NULL
PRIMARY KEY, SAL NUMBER (10,2)) PCTFREE 5
PCTUSED 75');
RETURN(TRUE);
EXCEPTION
WHEN SRW.DO_SQL_FAILURE THEN
SRW.MESSAGE(100, 'ERROR WHILE CREATING CHECK TABLE.');
SRW.MESSAGE(50, 'REPORT WAS STOPPED BEFORE THE RUNTIME
PARAMETER FORM.');
RAISE SRW.PROGRAM_ABORT;
END;
/* Suppose you want to create a "table of contents" by getting the
** first character of a column's value, and page number on which its
** field fires to print. Assume that you want to put the "table of contents"
** into a table named SHIP. You could write the following construct:
*/
DECLARE
PAGE_NO NUMBER;
PAGE_FOR INDEX NUMBER;
SORT_CHAR CHAR(1);
CMD_LINE CHAR(200);
BEGIN
SORT_CHAR := :SORT_NAME ;
IF :CALLED = 'Y' THEN
SRW.GET_PAGE_NUM(PAGE_FOR_ INDEX);
SRW.USER_EXIT('RWECOP PAGE_FOR_INDEX
P_START_PAGENO');
SRW.MESSAGE(2,TO_CHAR(:P_ START_PAGENO));
END IF;
SRW.GET_PAGE_NUM(PAGE_NO);
CMD_LINE := 'INSERT INTO SHIP VALUES
('''||SORT_CHAR||''','||TO_ CHAR(PAGE_NO)||')';
SRW.MESSAGE(2,CMD_LINE);
SRW.DO_SQL(CMD_LINE);
COMMIT;
EXCEPTION
WHEN DUP_VAL_ON_INDEX THEN
NULL;
WHEN SRW.DO_SQL_FAILURE THEN
SRW.MESSAGE(1,'FAILED TO INSERT ROW INTO SHIP
TABLE');
WHEN OTHERS THEN
COMMIT;
END;
BEGIN
SRW.DO_SQL('CREATE TABLE CHECK (EMPNO NUMBER NOT NULL
PRIMARY KEY, SAL NUMBER (10,2)) PCTFREE 5
PCTUSED 75');
RETURN(TRUE);
EXCEPTION
WHEN SRW.DO_SQL_FAILURE THEN
SRW.MESSAGE(100, 'ERROR WHILE CREATING CHECK TABLE.');
SRW.MESSAGE(50, 'REPORT WAS STOPPED BEFORE THE RUNTIME
PARAMETER FORM.');
RAISE SRW.PROGRAM_ABORT;
END;
/* Suppose you want to create a "table of contents" by getting the
** first character of a column's value, and page number on which its
** field fires to print. Assume that you want to put the "table of contents"
** into a table named SHIP. You could write the following construct:
*/
DECLARE
PAGE_NO NUMBER;
PAGE_FOR INDEX NUMBER;
SORT_CHAR CHAR(1);
CMD_LINE CHAR(200);
BEGIN
SORT_CHAR := :SORT_NAME ;
IF :CALLED = 'Y' THEN
SRW.GET_PAGE_NUM(PAGE_FOR_
SRW.USER_EXIT('RWECOP PAGE_FOR_INDEX
P_START_PAGENO');
SRW.MESSAGE(2,TO_CHAR(:P_
END IF;
SRW.GET_PAGE_NUM(PAGE_NO);
CMD_LINE := 'INSERT INTO SHIP VALUES
('''||SORT_CHAR||''','||TO_
SRW.MESSAGE(2,CMD_LINE);
SRW.DO_SQL(CMD_LINE);
COMMIT;
EXCEPTION
WHEN DUP_VAL_ON_INDEX THEN
NULL;
WHEN SRW.DO_SQL_FAILURE THEN
SRW.MESSAGE(1,'FAILED TO INSERT ROW INTO SHIP
TABLE');
WHEN OTHERS THEN
COMMIT;
END;
No comments:
Post a Comment