如何从文件中获取记录以在select语句中使用这些记录?

时间:2022-12-21 22:14:48

i have a file that consists of ids.

我有一个由ids组成的文件。

my statement is

我的陈述是

select * from table_name where id in (?)

? in the statement should have ids.....but those ids are in file.

?在声明中应该有ids .....但那些ID存档。

help me please what i have to write in the place of ? symbol

请帮我,我要写的是什么?符号

without creating table in database cant we done above thing?

没有在数据库中创建表我们做了上面的事情?

Thanks in advance

提前致谢

2 个解决方案

#1


4  

You should import the file into the database.

您应该将文件导入数据库。

You can use SQL*Loader for that, or create a table with ORGANIZATION EXTERNAL

您可以使用SQL * Loader,或使用ORGANIZATION EXTERNAL创建表

#2


0  

You could compose the SQL query as a string in the (PHP/C#/Java/other) code that uses the database. I'd really think that either keeping the IDs in the database or importing the file would be the easiest way, if there isn't something about your constraints that prevents it.

您可以将SQL查询编写为使用数据库的(PHP / C#/ Java / other)代码中的字符串。我真的认为,如果没有关于你的约束的东西阻止它,要么保留数据库中的ID或导入文件将是最简单的方法。

#1


4  

You should import the file into the database.

您应该将文件导入数据库。

You can use SQL*Loader for that, or create a table with ORGANIZATION EXTERNAL

您可以使用SQL * Loader,或使用ORGANIZATION EXTERNAL创建表

#2


0  

You could compose the SQL query as a string in the (PHP/C#/Java/other) code that uses the database. I'd really think that either keeping the IDs in the database or importing the file would be the easiest way, if there isn't something about your constraints that prevents it.

您可以将SQL查询编写为使用数据库的(PHP / C#/ Java / other)代码中的字符串。我真的认为,如果没有关于你的约束的东西阻止它,要么保留数据库中的ID或导入文件将是最简单的方法。