• <bdo id='Afxnd'></bdo><ul id='Afxnd'></ul>

      <small id='Afxnd'></small><noframes id='Afxnd'>

      <tfoot id='Afxnd'></tfoot>

      <legend id='Afxnd'><style id='Afxnd'><dir id='Afxnd'><q id='Afxnd'></q></dir></style></legend>
    1. <i id='Afxnd'><tr id='Afxnd'><dt id='Afxnd'><q id='Afxnd'><span id='Afxnd'><b id='Afxnd'><form id='Afxnd'><ins id='Afxnd'></ins><ul id='Afxnd'></ul><sub id='Afxnd'></sub></form><legend id='Afxnd'></legend><bdo id='Afxnd'><pre id='Afxnd'><center id='Afxnd'></center></pre></bdo></b><th id='Afxnd'></th></span></q></dt></tr></i><div id='Afxnd'><tfoot id='Afxnd'></tfoot><dl id='Afxnd'><fieldset id='Afxnd'></fieldset></dl></div>

        PLS-00428:此 SELECT 语句中需要 INTO 子句

        时间:2023-09-20
          <tfoot id='xYzcx'></tfoot>
          <i id='xYzcx'><tr id='xYzcx'><dt id='xYzcx'><q id='xYzcx'><span id='xYzcx'><b id='xYzcx'><form id='xYzcx'><ins id='xYzcx'></ins><ul id='xYzcx'></ul><sub id='xYzcx'></sub></form><legend id='xYzcx'></legend><bdo id='xYzcx'><pre id='xYzcx'><center id='xYzcx'></center></pre></bdo></b><th id='xYzcx'></th></span></q></dt></tr></i><div id='xYzcx'><tfoot id='xYzcx'></tfoot><dl id='xYzcx'><fieldset id='xYzcx'></fieldset></dl></div>
          1. <small id='xYzcx'></small><noframes id='xYzcx'>

                <tbody id='xYzcx'></tbody>

                <bdo id='xYzcx'></bdo><ul id='xYzcx'></ul>

                • <legend id='xYzcx'><style id='xYzcx'><dir id='xYzcx'><q id='xYzcx'></q></dir></style></legend>
                  本文介绍了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

                  这是代码

                      DECLARE
                      PROD_ROW_ID varchar(10) := NULL;
                  BEGIN
                      SELECT ROW_ID INTO VIS_ROW_ID FROM SIEBEL.S_PROD_INT WHERE PART_NUM = 'S0146404';
                  
                      BEGIN
                          SELECT rtrim(VIS.SERIAL_NUM) || ',' || rtrim(PLANID.DESC_TEXT) || ',' ||
                                 CASE
                                 WHEN PLANID.HIGH = 'TEST123'
                                 THEN
                                     CASE
                                     WHEN to_date(PROD.START_DATE) + 30 > sysdate
                                     THEN 'Y'
                                     ELSE 'N'
                                     END
                                 ELSE 'N'
                                 END
                                 || ',' || 'GB' || ',' ||
                                 rtrim(to_char(PROD.START_DATE, 'YYYY-MM-DD'))
                          FROM SIEBEL.S_LST_OF_VAL PLANID
                              INNER JOIN SIEBEL.S_PROD_INT PROD
                                  ON PROD.PART_NUM = PLANID.VAL
                              INNER JOIN SIEBEL.S_ASSET NETFLIX
                                  ON PROD.PROD_ID = PROD.ROW_ID
                              INNER JOIN SIEBEL.S_ASSET VIS
                                  ON VIS.PROM_INTEG_ID = PROD.PROM_INTEG_ID
                              INNER JOIN SIEBEL.S_PROD_INT VISPROD
                                  ON VIS.PROD_ID = VISPROD.ROW_ID
                          WHERE PLANID.TYPE = 'Test Plan'
                                AND PLANID.ACTIVE_FLG = 'Y'
                                AND VISPROD.PART_NUM = VIS_ROW_ID
                                AND PROD.STATUS_CD = 'Active'
                                AND VIS.SERIAL_NUM IS NOT NULL;
                      END;
                  END;
                  /
                  

                  推荐答案

                  在 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.

                  DECLARE
                     PROD_ROW_ID   VARCHAR (10) := NULL;
                     VIS_ROW_ID    NUMBER;
                     DSC           VARCHAR (512);
                  BEGIN
                     SELECT ROW_ID
                       INTO VIS_ROW_ID
                       FROM SIEBEL.S_PROD_INT
                      WHERE PART_NUM = 'S0146404';
                  
                     BEGIN
                        SELECT    RTRIM (VIS.SERIAL_NUM)
                               || ','
                               || RTRIM (PLANID.DESC_TEXT)
                               || ','
                               || CASE
                                     WHEN PLANID.HIGH = 'TEST123'
                                     THEN
                                        CASE
                                           WHEN TO_DATE (PROD.START_DATE) + 30 > SYSDATE
                                           THEN
                                              'Y'
                                           ELSE
                                              'N'
                                        END
                                     ELSE
                                        'N'
                                  END
                               || ','
                               || 'GB'
                               || ','
                               || RTRIM (TO_CHAR (PROD.START_DATE, 'YYYY-MM-DD'))
                          INTO DSC
                          FROM SIEBEL.S_LST_OF_VAL PLANID
                               INNER JOIN SIEBEL.S_PROD_INT PROD
                                  ON PROD.PART_NUM = PLANID.VAL
                               INNER JOIN SIEBEL.S_ASSET NETFLIX
                                  ON PROD.PROD_ID = PROD.ROW_ID
                               INNER JOIN SIEBEL.S_ASSET VIS
                                  ON VIS.PROM_INTEG_ID = PROD.PROM_INTEG_ID
                               INNER JOIN SIEBEL.S_PROD_INT VISPROD
                                  ON VIS.PROD_ID = VISPROD.ROW_ID
                         WHERE     PLANID.TYPE = 'Test Plan'
                               AND PLANID.ACTIVE_FLG = 'Y'
                               AND VISPROD.PART_NUM = VIS_ROW_ID
                               AND PROD.STATUS_CD = 'Active'
                               AND VIS.SERIAL_NUM IS NOT NULL;
                     END;
                  END;
                  /
                  

                  参考资料

                  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 子句的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:Oracle 11g 通过正则表达式获取所有匹配的事件 下一篇:动态旋转表 Oracle

                  相关文章

                  <i id='aADEN'><tr id='aADEN'><dt id='aADEN'><q id='aADEN'><span id='aADEN'><b id='aADEN'><form id='aADEN'><ins id='aADEN'></ins><ul id='aADEN'></ul><sub id='aADEN'></sub></form><legend id='aADEN'></legend><bdo id='aADEN'><pre id='aADEN'><center id='aADEN'></center></pre></bdo></b><th id='aADEN'></th></span></q></dt></tr></i><div id='aADEN'><tfoot id='aADEN'></tfoot><dl id='aADEN'><fieldset id='aADEN'></fieldset></dl></div>
                  1. <small id='aADEN'></small><noframes id='aADEN'>

                  2. <tfoot id='aADEN'></tfoot>

                      <bdo id='aADEN'></bdo><ul id='aADEN'></ul>
                    <legend id='aADEN'><style id='aADEN'><dir id='aADEN'><q id='aADEN'></q></dir></style></legend>