0

I have a word/excel/pdf document with ids. there are about 200 thousand of them, maybe more. how do I take these IDs from a document and enter them into an sql query so that each id corresponds to a value from the table in the query?

damnetime
  • 1
  • 3
  • Does this answer your question? [Loading data from a text file to a table in oracle](https://stackoverflow.com/questions/3750538/loading-data-from-a-text-file-to-a-table-in-oracle) – nofinator Nov 21 '22 at 16:05
  • No, i have to insert all of IDs into “where” in sql query. – damnetime Nov 21 '22 at 16:07
  • My mistake. You'll need to use save it as a text or CSV file, then use a tool like Python to convert all the IDs into a WHERE string. 200K might be too many for Oracle to process in one batch though. – nofinator Nov 21 '22 at 16:11
  • For that many ids, I would probably still load them into a table so that your actual where clause could just be along the lines of `id IN (SELECT id from newtable)`. If you really want to format it, I would use regex find-and-replace in VI (if you're familiar with it). Keep in mind that if you are hardcoding `IN`/`NOT IN` statements, you're limited to 999 values by Oracle per `IN`, so you will either need to use multiple conditions like `IN (...) OR IN (...) OR...`. You might run up to the Oracle limit on statement length (409,600) – EdmCoff Nov 21 '22 at 16:18

1 Answers1

0

I suggest pasting the IDs in an excel file then construct your queries in the sheet

陳禮文
  • 11
  • 1