There is a txt file, where through; listed id and other information. The task to output from the main table all the names whose id matches the id from the file. The question is: can I, without starting a special. a table (because there is no right) to execute such a query? And if so, tell me how? I would be very grateful for any information)

  • All that can help you is the LOAD DATA INFILE construct, but it still requires a table - Anton Shchyrov
  • Use any programming language (you can even bash) to pull out the ID and then send the request. - Dmitriy Simushev

1 answer 1

How many lines in a text file? From the most simple options I see the following: Open your txt file in Excel through the menu "Data" -> "From text". Next, in the wizard, specify the separator ";". Remember to specify a text data type if the ID can start from scratch.

Next, in Excel, create a query text of the following kind:

 select Ваш_ID1 id, поле1, поле2 from dual union all select Ваш_ID2 id, поле1, поле2 from dual union all select Ваш_ID3 id, поле1, поле2 from dual union all select Ваш_IDn id, поле1, поле2 from dual 

This can be done quite easily with the use of the JUMPING function. Next, you can place the resulting structure in SQL with a query to your database.

For example,

 with txt as ( select Ваш_ID1 id, поле1, поле2 from dual union all select Ваш_ID2 id, поле1, поле2 from dual union all select Ваш_ID3 id, поле1, поле2 from dual union all select Ваш_IDn id, поле1, поле2 from dual ) select main.fio, main.id from main join txt on main.id=txt.id 
  • I don’t know for sure (I’ll only get tomorrow), but I suppose that a lot. There in each line id and link, everything is divided through; . - Nat_li