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

      <tfoot id='SpxrO'></tfoot>

    2. <small id='SpxrO'></small><noframes id='SpxrO'>

    3. Oracle PL/SQL select into 变量

      时间:2023-11-02
    4. <legend id='dD4GX'><style id='dD4GX'><dir id='dD4GX'><q id='dD4GX'></q></dir></style></legend>
          • <bdo id='dD4GX'></bdo><ul id='dD4GX'></ul>

            <i id='dD4GX'><tr id='dD4GX'><dt id='dD4GX'><q id='dD4GX'><span id='dD4GX'><b id='dD4GX'><form id='dD4GX'><ins id='dD4GX'></ins><ul id='dD4GX'></ul><sub id='dD4GX'></sub></form><legend id='dD4GX'></legend><bdo id='dD4GX'><pre id='dD4GX'><center id='dD4GX'></center></pre></bdo></b><th id='dD4GX'></th></span></q></dt></tr></i><div id='dD4GX'><tfoot id='dD4GX'></tfoot><dl id='dD4GX'><fieldset id='dD4GX'></fieldset></dl></div>
          • <tfoot id='dD4GX'></tfoot>

                <tbody id='dD4GX'></tbody>

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

              • 本文介绍了Oracle PL/SQL select into 变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我尝试在 SQL Developer 中运行以下查询,但收到错误消息.我试图声明两个局部变量(var_num1 和 payDate),然后设置变量.有谁知道我可能做错了什么?我知道 Oracle SQL 与 SQL Server 略有不同.

                I am trying to run the following query in SQL Developer, but I am receiving an error. I am trying to declare two local variables (var_num1 and payDate) and then set the variables. Does anyone know what I can be doing incorrectly? I know Oracle SQL is a little different than SQL Server.

                DECLARE
                  var_num1 number; 
                  payDate date;
                 BEGIN 
                  var_num1 := 100; 
                  payDate := '10/1/2013'
                  BEGIN 
                    SELECT * FROM Paycode WHERE PaycodeID = var_num1 and PaycodeDate = payDate;
                  End;
                END; 
                

                <小时>

                Error report:
                ORA-06550: line 6, column 2:
                PLS-00428: an INTO clause is expected in this SELECT statement
                06550. 00000 -  "line %s, column %s:
                %s"
                *Cause:    Usually a PL/SQL compilation error.
                *Action:
                

                推荐答案

                在 PL/SQL 中不能使用没有 INTO 子句的 SELECT.SELECT 的输出必须存储在某处.例如.表或变量或记录.请参阅下面的示例如何将 SELECT 语句的结果存储到记录中.

                You cannot use SELECT without INTO clause in PL/SQL. The output of the SELECT must be stored somewhere. Eg. table or variable or perhaps a record. See example below how to store result of the SELECT statement into record.

                DECLARE
                  var_num1 number; 
                  payDate date;
                  v_result Paycode%ROWTYPE;
                BEGIN 
                  var_num1 := 100; 
                  payDate := '10/1/2013';
                
                    SELECT * INTO v_result
                    FROM Paycode
                    WHERE PaycodeID = var_num1 and PaycodeDate = payDate;
                
                END; 
                

                这篇关于Oracle PL/SQL select into 变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:ALL_PROCEDURES 视图不显示 PROCEDURE_NAME 下一篇:如何在语句的触发器内获取受语句影响的行数

                相关文章

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

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

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