1. A computer-operated apparatus for generating selectivity values in a database management system (DBMS), the DBMS having one or more tables for storing data, each table having zero or more user-defined routines (UDRs), said apparatus comprising: a feature vector extractor coupled to said one or more database tables, said feature vector extractor being adapted to convert said UDR into a base representation; a neural network coupled to the feature vector extractor for generating selectivity values based on the base representation; and an optimizer coupled to said neural network, said optimizer dynamically applying said neural network to determine an optimum query search sequence for the DBMS based on the generated selectivity values.