According to the ODBC specifications, the result set that
SQLPrimaryKeys returns should sort by TABLE_CAT, TABLE_SCHEM, TABLE_NAME, and KEY_SEQ. Although the Microsoft Oracle Driver sorts by catalog and schema followed by table name, the key sequence is left unordered. This problem only occurs when a schema is specified in the
SQLPrimaryKeys call ("DEMO") in the following example. If DEMO is not specified but is left as null, the result set is returned in the correct order.
Steps to Reproduce Behavior
- From SQL *PLUS, use the following code to create a table:
create table my_table(col1 int, col2 int, col3 int, primary key(col2, col3,col1));
- Open ODBC Test, click Conn from the menu, and then click Full connect. Select the DSN that uses the Microsoft Oracle Driver, and type the User Id and Password.
- Click Catalog, and then click SQLPrimaryKeys to invoke SQLPrimaryKeys.
- In the TableName drop-down list box, click my_table. In the SchemaName drop-down list box, click a valid schema name, and then click OK to invoke the command. You receive the following error message:
- Click Results, and then click Get Data All. In the result set, notice that KEY_SEQ appears as "2, 3, 1" instead of the expected "1,2,3".