#NEWLINE# def autoinc_sql( self , table , column ) : #NEWLINE# #INDENT# sq_name = self . _get_sequence_name ( table ) #NEWLINE# tr_name = self . _get_trigger_name ( table ) #NEWLINE# tbl_name = self . quote_name ( table ) #NEWLINE# col_name = self . quote_name ( self ) #NEWLINE# sequence_sql = ( '\nDECLARE\n    i INTEGER;\nBEGIN\n    SELECT COUNT(*) INTO i FROM USER_CATALOG\n        WHERE TABLE_NAME = \'%(sq_name)s\' AND TABLE_TYPE = \'SEQUENCE\';\n    IF i = 0 THEN\n        EXECUTE IMMEDIATE \'CREATE SEQUENCE "%(sq_name)s"\';\n    END IF;\nEND;\n/' % locals ( ) ) #NEWLINE# trigger_sql = ( '\nCREATE OR REPLACE TRIGGER "%(tr_name)s"\nBEFORE INSERT ON %(tbl_name)s\nFOR EACH ROW\nWHEN (new.%(col_name)s IS NULL)\n    BEGIN\n        SELECT "%(sq_name)s".nextval\n        INTO :new.%(col_name)s FROM dual;\n    END;\n/' % locals ( ) ) #NEWLINE# return ( sequence_sql , trigger_sql )