如何运行多个 SQL 查询? [英] How to run multiple SQL queries?
本文介绍了如何运行多个 SQL 查询?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个创建表查询,一个更新查询,然后删除表查询.我需要一次性运行这三个查询.这样做的最佳方法是什么?
I have a create table query, an update query ,and then drop table query. I need to run these three queries in one shot. What is the best way to do this?
Example
1st Query: Create table A.
2nd Query: Update value in table A
3rd Query: Drop table A.
不是一个一个地运行这三个查询,我想通过 PLSQL 或其他方式运行它们.请帮忙.
Instead of running these three queries one by one, I want to run them in on go either by PLSQL or some other way. Please help.
推荐答案
将 3 个查询用分号隔开:
Put the 3 queries following each other separated by a semi-colon:
SELECT *
FROM table_to_be_selected;
DROP TABLE the table_to_be_dropped;
TRUNCATE TABLE table_to_be_truncated;
您可以将这些查询连接到一个字符串中并执行该字符串.
You can concatenate these queries in a string and execute that string.
另一种方法是解决方案.
这篇关于如何运行多个 SQL 查询?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文