* Standard COBOL (file "CDR004.SCO") calling SQL * procedures in file "CDR004.MCO"
**************************************************************** * * COMMENT SECTION * * DATE 1989/04/07 STANDARD COBOL LANGUAGE * NIST SQL VALIDATION TEST SUITE V6.0 * DISCLAIMER: * This program was written by employees of NIST to test SQL * implementations for conformance to the SQL standards. * NIST assumes no responsibility for any party's use of * this program. * * CDR004.SCO * WRITTEN BY: SUN DAJUN * TRANSLATED AUTOMATICALLY FROM EMBEDDED COBOL BY CHRIS SCHANZLE * * THIS ROUTINE TESTS THE <CHECK> CONSTRAINT. * * REFERENCES * AMERICAN NATIONAL STANDARD database language - SQL * with Integrity Enhancement * * SECTION 6.8 * <check constraint definition>::= * CHECK (<search condition>) ****************************************************************
******************** BEGIN TEST0310 ****************** *This procedure tests if x NOT IN and NOT x IN of the *CHECK specification has the same meaning . * CHECK condition * NOT GRADE IN (5,22) on STAFF12
******************** BEGIN TEST0311 ******************* *This test check the constraint NOT NULL in column *definition constraint. * CHECK condition * NOT NULL in EMPNAME def. of STAFF15 * INSERT NULL INTO EMPNAME explicitly
* EXEC SQL INSERT INTO STAFF15 * VALUES('E2',NULL,52,'Newyork') END-EXEC CALL"SUB20"USINGSQLCODE MOVESQLCODETO SQL-COD MOVESQLCODETO code1 * EXEC SQL SELECT COUNT(*) INTO :count2 * FROM STAFF15 END-EXEC CALL"SUB21"USINGSQLCODE count2 MOVESQLCODETO SQL-COD DISPLAY" The correct answer is :" DISPLAY" SQLCODE of second INSERT not equal to 0." DISPLAY" count1 is 1" DISPLAY" count2 is 1" DISPLAY" Your answer is :" DISPLAY" SQLCOD of second INSERT is ", code1 DISPLAY" count1 is ", count1 DISPLAY" count2 is ", count2 if (code1 NOT = 0 AND count1 = 1 AND count2 = 1) then * EXEC SQL INSERT INTO TESTREPORT * VALUES('0311','pass','MCO') END-EXEC CALL"SUB22"USINGSQLCODE MOVESQLCODETO SQL-COD DISPLAY" *** pass *** " else * EXEC SQL INSERT INTO TESTREPORT * VALUES('0311','fail','MCO') END-EXEC ADD 1 TO errcnt CALL"SUB23"USINGSQLCODE MOVESQLCODETO SQL-COD DISPLAY" cdr004.sco *** fail *** " END-IF DISPLAY"================================================"
DISPLAY" " * EXEC SQL COMMIT WORK; CALL"SUB24"USINGSQLCODE MOVESQLCODETO SQL-COD **************** END TEST 0311 **********
******************** BEGIN TEST0312 ******************* *This test checks NOT NULL in table definition con- *straint. * CHECK condition * EMPNAME IS NOT NULL. on STAFF15 * INSERT VALUE INTO all columns except EMPNAME
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.