如何在oracle中运行多个选择查询 [英] How to run more than 1 select query in oracle
问题描述
我正在编写一个程序,其中我想执行多个选择查询。
以下是我正在寻找的代码片段,当我运行时snippet我得到一个错误,说在这个SELECT语句中需要一个INTO子句第二个选择查询。
在SQL中我们可以编写这样的查询,但是在PL / Sql中它不允许。我是PL / Sql的初学者。我正在使用Sql开发人员编写查询&运行脚本。
任何帮助都将不胜感激。
提前致谢。
我尝试过:
I was writing a procedure wherein i wanted to execute more than 1 select query.
Below is the snippet of what i was looking for, when i run the snippet i get an error saying "an INTO clause is expected in this SELECT statement" the 2nd select query.
In SQL we could write such queries, but in PL/Sql it doesn't allow. I am a beginner in PL/Sql. I am using Sql developer to write queries & run the scripts.
Any help would be appreciated.
Thanks in advance.
What I have tried:
declare
varruleid NUMBER(38,0);
Begin
Select RL.RULEID into varruleid from RULELIB RL where RL.RULEID = 5048;
select * from TESTFUNCTIONINTEST where RULEID=varruleid;
End;
推荐答案
/*add this to your declaration */
-- declare (record) variable 'tftrec' to match table structure
tftrec TESTFUNCTIONINTEST%rowtype;
/* and in your code */
select * into tftrec from testfunctionintest where ruleid = varruleid;
检查: plsql - Oracle中的多个select语句 - Stack Overflow [ ^ ] - 解释清楚。
Check this: plsql - Multiple select statement in Oracle - Stack Overflow[^] - well explained.
这篇关于如何在oracle中运行多个选择查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!