PLS-00428: an INTO clause is expected in this SELECT statement(PLS-00428:此 SELECT 语句中需要 INTO 子句)
问题描述
我想将 Rownum 存储为变量而不是使用昂贵的 Join.我需要从 Select 语句中获取它,因为 Rownum 在各种环境中会有所不同,因此它不能是代码中的文字字符串.
I am wanting to store a Rownum as a variable rather than use a costly Join. I need to get this from a Select statement as the Rownum will be different on various environments so it cannot be a literal string in the code.
对于上下文,此查询在 Oracle Siebel CRM 模式上执行,并检索特定类型和属性的一些产品.
For context, this query is executed on Oracle Siebel CRM schema and it retrieves some products of specific type and attributes.
我尝试在 Toad 和 Oracle SQL Developer 中使用以下 SQL 代码,但是出现以下错误:
I tried using the following SQL code in Toad and Oracle SQL Developer, however I am getting the following error:
PLS-00428:此 SELECT 语句中需要 INTO 子句
PLS-00428: an INTO clause is expected in this SELECT statement
这是代码
推荐答案
在 PLSQL 块中,select 语句的列必须赋值给变量,而在 SQL 语句中则不然.
In PLSQL block, columns of select statements must be assigned to variables, which is not the case in SQL statements.
第二个 BEGIN 的 SQL 语句没有 INTO 子句,这导致了错误.
The second BEGIN's SQL statement doesn't have INTO clause and that caused the error.
参考资料
http://docs.oracle.com/cd/E11882_01/appdev.112/e25519/static.htm#LNPLS00601http://docs.oracle.com/cd/B19306_01/appdev.102/b14261/selectinto_statement.htm#CJAJAAIGhttp://pls-00428.ora-code.com/
这篇关于PLS-00428:此 SELECT 语句中需要 INTO 子句的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!