views:

206

answers:

2

I had a discussion today regarding an Oracle procedure I wrote some time ago.

I wanted to get 7500 user email addresses from Active Directory using PL/SQL. AD will return a maximum of 1000 rows and the LDAP provider used by Oracle will not support paging.

Therefore, my solution was to filter on the last two characters of the sAMAccountName (*00,*01,*02...etc.). This results in 126 queries (100 for account names ending in digits, 26 for those ending in a letter...this was sufficient for my AD setup).

The person I was speaking to (it was a job interview by the way) said he could have done it a better way, but he would not tell me what that method was.

Could anybody hazard a guess at what this method was?

A: 

If the result set is sorted by name, you could just ask for the next 1.000 with a name greater than the last one. And repeat it until you get either less than 1.000 or no more results.

Robert Giesecke
Good suggestion, unfortunately the OpenLDAP provider does not support sorting either, and the results do not come back sorted by sAMAccountName.
David Neale
A: 

Really trivial, as a job interview question, I don't know the skills they required, but in my opinion it's a strange "Oracle" question because it requires the need of a detailed knowledge of Microsoft AD, but no particular PL/SQL knowledge.

You probably had to say to use Attribute Range Retrieval. Here it is explained http://msdn.microsoft.com/en-us/library/Aa772308

Alessandro Rossi
OpenLDAP doesn't support that either.
David Neale